1 TEST_COPTS = [ 2 "-pedantic", 3 "-pedantic-errors", 4 "-std=c++11", 5 "-Wall", 6 "-Wextra", 7 "-Wshadow", 8 # "-Wshorten-64-to-32", 9 "-Wfloat-equal", 10 "-fstrict-aliasing", 11 ] 12 13 PER_SRC_COPTS = ({ 14 "cxx03_test.cc": ["-std=c++03"], 15 # Some of the issues with DoNotOptimize only occur when optimization is enabled 16 "donotoptimize_test.cc": ["-O3"], 17 }) 18 19 20 TEST_ARGS = ["--benchmark_min_time=0.01"] 21 22 PER_SRC_TEST_ARGS = ({ 23 "user_counters_tabular_test.cc": ["--benchmark_counters_tabular=true"], 24 }) 25 26 cc_library( 27 name = "output_test_helper", 28 testonly = 1, 29 srcs = ["output_test_helper.cc"], 30 hdrs = ["output_test.h"], 31 copts = TEST_COPTS, 32 deps = [ 33 "//:benchmark", 34 "//:benchmark_internal_headers", 35 ], 36 ) 37 38 [ 39 cc_test( 40 name = test_src[:-len(".cc")], 41 size = "small", 42 srcs = [test_src], 43 args = TEST_ARGS + PER_SRC_TEST_ARGS.get(test_src, []), 44 copts = TEST_COPTS + PER_SRC_COPTS.get(test_src, []), 45 deps = [ 46 ":output_test_helper", 47 "//:benchmark", 48 "//:benchmark_internal_headers", 49 "@com_google_googletest//:gtest", 50 ] + ( 51 ["@com_google_googletest//:gtest_main"] if (test_src[-len("gtest.cc"):] == "gtest.cc") else [] 52 ), 53 # FIXME: Add support for assembly tests to bazel. 54 # See Issue #556 55 # https://github.com/google/benchmark/issues/556 56 ) for test_src in glob(["*test.cc"], exclude = ["*_assembly_test.cc", "link_main_test.cc"]) 57 ] 58 59 cc_test( 60 name = "link_main_test", 61 size = "small", 62 srcs = ["link_main_test.cc"], 63 copts = TEST_COPTS, 64 deps = ["//:benchmark_main"], 65 ) 66