Skip to content

Commit

Permalink
Fixes from upstream and test builds
Browse files Browse the repository at this point in the history
  • Loading branch information
dmah42 committed Dec 25, 2016
1 parent dc0f53a commit 0e39052
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 57 deletions.
13 changes: 6 additions & 7 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ cc_library(
name = "benchmark",
srcs = [
"src/arraysize.h",
"src/benchmark_api_internal.h",
"src/benchmark.cc",
"src/benchmark_register.cc",
"src/check.h",
"src/colorprint.cc",
"src/colorprint.h",
Expand All @@ -15,22 +17,19 @@ cc_library(
"src/cycleclock.h",
"src/internal_macros.h",
"src/json_reporter.cc",
"src/log.cc",
"src/log.h",
"src/mutex.h",
"src/reporter.cc",
"src/re.h",
"src/re_posix.cc",
"src/re_std.cc",
"src/reporter.cc",
"src/sleep.cc",
"src/sleep.h",
"src/stat.h",
"src/string_util.cc",
"src/string_util.h",
"src/sysinfo.cc",
"src/sysinfo.h",
"src/walltime.cc",
"src/walltime.h",
"src/timers.cc",
"src/timers.h",
],
hdrs = [
"include/benchmark/benchmark.h",
Expand All @@ -39,7 +38,7 @@ cc_library(
"include/benchmark/reporter.h",
],
visibility = ["//test:__pkg__"],
defines = ["HAVE_STD_REGEX"],
defines = ["HAVE_POSIX_REGEX"],
includes = ["include"],
linkopts = ["-pthread"],
)
2 changes: 1 addition & 1 deletion src/re.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ inline bool Regex::Match(const std::string& str) {
return std::regex_search(str, re_);
}

#else
#elif defined(HAVE_POSIX_REGEX) || defined(HAVE_GNU_POSIX_REGEX)
inline bool Regex::Init(const std::string& spec, std::string* error) {
int ec = regcomp(&re_, spec.c_str(), REG_EXTENDED | REG_NOSUB);
if (ec != 0) {
Expand Down
128 changes: 79 additions & 49 deletions test/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
cc_library(
name = "output_test_helper",
srcs = [
"output_test.h",
"output_test_helper.cc",
],
deps = ["//:benchmark"],
)

cc_binary(
name = "basic_test",
srcs = ["basic_test.cc"],
Expand All @@ -15,7 +24,10 @@ cc_binary(
cc_binary(
name = "complexity_test",
srcs = ["complexity_test.cc"],
deps = ["//:benchmark"],
deps = [
":output_test_helper",
"//:benchmark",
],
linkopts = ["-lm", "-pthread"],
)

Expand All @@ -25,51 +37,69 @@ cc_binary(
# deps = ["//:benchmark"],
# )

#cc_binary(
# name = "diagnostics_test",
# srcs = ["diagnostics_test.cc"],
# deps = ["//:benchmark"],
#)
#
#cc_binary(
# name = "donotoptimize_test",
# srcs = ["donotoptimize_test.cc"],
# deps = ["//:benchmark"],
#)
#
#cc_binary(
# name = "filter_test",
# srcs = ["filter_test.cc"],
# deps = ["//:benchmark"],
#)
#
#cc_binary(
# name = "fixture_test",
# srcs = ["fixture_test.cc"],
# deps = ["//:benchmark"],
#)
#
#cc_binary(
# name = "map_test",
# srcs = ["map_test.cc"],
# deps = ["//:benchmark"],
#)
#
#cc_binary(
# name = "options_test",
# srcs = ["options_test.cc"],
# deps = ["//:benchmark"],
#)
#
#cc_binary(
# name = "reporter_output_test",
# srcs = ["reporter_output_test.cc"],
# deps = ["//:benchmark"],
#)
#
#cc_binary(
# name = "skip_with_error_test",
# srcs = ["skip_with_error_test.cc"],
# deps = ["//:benchmark"],
#)
#
cc_binary(
name = "diagnostics_test",
srcs = ["diagnostics_test.cc"],
deps = ["//:benchmark"],
linkopts = ["-lm", "-pthread"],
)

cc_binary(
name = "donotoptimize_test",
srcs = ["donotoptimize_test.cc"],
deps = ["//:benchmark"],
linkopts = ["-lm", "-pthread"],
)

cc_binary(
name = "filter_test",
srcs = ["filter_test.cc"],
deps = ["//:benchmark"],
linkopts = ["-lm", "-pthread"],
)

cc_binary(
name = "fixture_test",
srcs = ["fixture_test.cc"],
deps = ["//:benchmark"],
linkopts = ["-lm", "-pthread"],
)

cc_binary(
name = "map_test",
srcs = ["map_test.cc"],
deps = ["//:benchmark"],
linkopts = ["-lm", "-pthread"],
)

cc_binary(
name = "options_test",
srcs = ["options_test.cc"],
deps = ["//:benchmark"],
linkopts = ["-lm", "-pthread"],
)

cc_binary(
name = "register_benchmark_test",
srcs = ["register_benchmark_test.cc"],
deps = ["//:benchmark"],
linkopts = ["-lm", "-pthread"],
)

cc_binary(
name = "reporter_output_test",
srcs = ["reporter_output_test.cc"],
deps = [
":output_test_helper",
"//:benchmark",
],
linkopts = ["-lm", "-pthread"],
)

cc_binary(
name = "skip_with_error_test",
srcs = ["skip_with_error_test.cc"],
deps = ["//:benchmark"],
linkopts = ["-lm", "-pthread"],
)

0 comments on commit 0e39052

Please sign in to comment.