From c6f7b720ecfa6db40c648eb05e319f8a817110e9 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Wed, 13 Oct 2021 22:43:08 -0700 Subject: [benchmarks] Move libcxx's fork of google/benchmark and llvm/utils' under third-party This change: - moves the libcxx copy of `google/benchmark` to `third-party/benchmkark` - points the 2 uses of the library (libcxx and llvm/utils) to this copy We picked the licxx copy because it is the most up to date. Differential Revision: https://reviews.llvm.org/D112012 --- third-party/benchmark/test/BUILD | 74 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 third-party/benchmark/test/BUILD (limited to 'third-party/benchmark/test/BUILD') diff --git a/third-party/benchmark/test/BUILD b/third-party/benchmark/test/BUILD new file mode 100644 index 000000000000..1f27f99ede9f --- /dev/null +++ b/third-party/benchmark/test/BUILD @@ -0,0 +1,74 @@ +TEST_COPTS = [ + "-pedantic", + "-pedantic-errors", + "-std=c++11", + "-Wall", + "-Wextra", + "-Wshadow", + # "-Wshorten-64-to-32", + "-Wfloat-equal", + "-fstrict-aliasing", +] + +PER_SRC_COPTS = ({ + "cxx03_test.cc": ["-std=c++03"], + # Some of the issues with DoNotOptimize only occur when optimization is enabled + "donotoptimize_test.cc": ["-O3"], +}) + +TEST_ARGS = ["--benchmark_min_time=0.01"] + +PER_SRC_TEST_ARGS = ({ + "user_counters_tabular_test.cc": ["--benchmark_counters_tabular=true"], + "repetitions_test.cc": [" --benchmark_repetitions=3"], +}) + +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") + +cc_library( + name = "output_test_helper", + testonly = 1, + srcs = ["output_test_helper.cc"], + hdrs = ["output_test.h"], + copts = TEST_COPTS, + deps = [ + "//:benchmark", + "//:benchmark_internal_headers", + ], +) + +[ + cc_test( + name = test_src[:-len(".cc")], + size = "small", + srcs = [test_src], + args = TEST_ARGS + PER_SRC_TEST_ARGS.get(test_src, []), + copts = TEST_COPTS + PER_SRC_COPTS.get(test_src, []), + deps = [ + ":output_test_helper", + "//:benchmark", + "//:benchmark_internal_headers", + "@com_google_googletest//:gtest", + ] + ( + ["@com_google_googletest//:gtest_main"] if (test_src[-len("gtest.cc"):] == "gtest.cc") else [] + ), + # FIXME: Add support for assembly tests to bazel. + # See Issue #556 + # https://github.com/google/benchmark/issues/556 + ) + for test_src in glob( + ["*test.cc"], + exclude = [ + "*_assembly_test.cc", + "link_main_test.cc", + ], + ) +] + +cc_test( + name = "link_main_test", + size = "small", + srcs = ["link_main_test.cc"], + copts = TEST_COPTS, + deps = ["//:benchmark_main"], +) -- cgit v1.2.1