File tree Expand file tree Collapse file tree 9 files changed +114
-0
lines changed
Expand file tree Collapse file tree 9 files changed +114
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ build.ninja
4141install_manifest.txt
4242rules.ninja
4343
44+ # bazel output symlinks.
45+ bazel- *
46+
4447# out-of-source build top-level folders.
4548build /
4649_build /
Original file line number Diff line number Diff line change @@ -159,11 +159,22 @@ install:
159159 brew update;
160160 brew install gcc@7;
161161 fi
162+ - if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
163+ sudo apt-get update -qq;
164+ sudo apt-get install -qq unzip;
165+ wget https://github.com/bazelbuild/bazel/releases/download/0.10.1/bazel-0.10.1-installer-linux-x86_64.sh --output-document bazel-installer.sh;
166+ sudo bash bazel-installer.sh;
167+ fi
168+ - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
169+ curl -L -o bazel-installer.sh https://github.com/bazelbuild/bazel/releases/download/0.10.1/bazel-0.10.1-installer-darwin-x86_64.sh;
170+ sudo bash bazel-installer.sh;
171+ fi
162172
163173script :
164174 - cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="${EXTRA_FLAGS}" -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON -DBENCHMARK_BUILD_32_BITS=${BUILD_32_BITS} ..
165175 - make
166176 - ctest -C ${BUILD_TYPE} --output-on-failure
177+ - bazel test -c dbg --define google_benchmark.have_regex=posix --announce_rc --verbose_failures --test_output=errors --keep_going //test/...
167178
168179after_success :
169180 - if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ Radoslav Yovchev <radoslav.tm@gmail.com>
3838Roman Lebedev <lebedev.ri@gmail.com>
3939Shuo Chen <chenshuo@chenshuo.com>
4040Steinar H. Gunderson <sgunderson@bigfoot.com>
41+ Stripe, Inc.
4142Yixuan Qiu <yixuanq@gmail.com>
4243Yusuke Suzuki <utatane.tea@gmail.com>
4344Zbigniew Skowron <zbychs@gmail.com>
Original file line number Diff line number Diff line change 1+ licenses (["notice" ])
2+
3+ load ("//bazel:have_regex.bzl" , "have_regex_copts" )
4+
5+ cc_library (
6+ name = "benchmark" ,
7+ srcs = glob ([
8+ "src/*.cc" ,
9+ "src/*.h" ,
10+ ]),
11+ hdrs = ["include/benchmark/benchmark.h" ],
12+ copts = have_regex_copts (),
13+ strip_include_prefix = "include" ,
14+ visibility = ["//visibility:public" ],
15+ )
16+
17+ cc_library (
18+ name = "benchmark_internal_headers" ,
19+ hdrs = glob (["src/*.h" ]),
20+ visibility = ["//test:__pkg__" ],
21+ )
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
3838Jern-Kuan Leong <jernkuan@gmail.com>
3939JianXiong Zhou <zhoujianxiong2@gmail.com>
4040Joao Paulo Magalhaes <joaoppmagalhaes@gmail.com>
41+ John Millikin <jmillikin@stripe.com>
4142Jussi Knuuttila <jussi.knuuttila@gmail.com>
4243Kai Wolf <kai.wolf@gmail.com>
4344Kishan Kumar <kumar.kishan@outlook.com>
Original file line number Diff line number Diff line change 1+ load ("@bazel_tools//tools/build_defs/repo:git.bzl" , "git_repository" )
2+
3+ git_repository (
4+ name = "com_google_googletest" ,
5+ commit = "3f0cf6b62ad1eb50d8736538363d3580dd640c3e" , # HEAD
6+ remote = "https://github.com/google/googletest" ,
7+ )
Original file line number Diff line number Diff line change 1+ package (default_visibility = ["//:__subpackages__" ])
2+
3+ config_setting (
4+ name = "have_std_regex" ,
5+ values = {"define" : "google_benchmark.have_regex=std" },
6+ )
7+
8+ config_setting (
9+ name = "have_posix_regex" ,
10+ values = {"define" : "google_benchmark.have_regex=posix" },
11+ )
12+
13+ config_setting (
14+ name = "have_gnu_posix_regex" ,
15+ values = {"define" : "google_benchmark.have_regex=gnu_posix" },
16+ )
Original file line number Diff line number Diff line change 1+ def have_regex_copts ():
2+ return select ({
3+ "//bazel:have_std_regex" : ["-DHAVE_STD_REGEX" ],
4+ "//bazel:have_posix_regex" : ["-DHAVE_POSIX_REGEX" ],
5+ "//bazel:have_gnu_posix_regex" : ["-DHAVE_GNU_POSIX_REGEX" ],
6+ "//conditions:default" : ["-DHAVE_STD_REGEX" ],
7+ })
Original file line number Diff line number Diff line change 1+ load ("//bazel:have_regex.bzl" , "have_regex_copts" )
2+
3+ NEEDS_GTEST_MAIN = [
4+ "statistics_test.cc" ,
5+ ]
6+
7+ TEST_COPTS = [
8+ "-pedantic" ,
9+ "-pedantic-errors" ,
10+ "-std=c++11" ,
11+ ] + have_regex_copts ()
12+
13+ TEST_ARGS = ["--benchmark_min_time=0.01" ]
14+
15+ cc_library (
16+ name = "output_test_helper" ,
17+ testonly = 1 ,
18+ srcs = ["output_test_helper.cc" ],
19+ hdrs = ["output_test.h" ],
20+ copts = TEST_COPTS ,
21+ deps = [
22+ "//:benchmark" ,
23+ "//:benchmark_internal_headers" ,
24+ ],
25+ )
26+
27+ [cc_test (
28+ name = test_src [:- len (".cc" )],
29+ size = "small" ,
30+ srcs = [test_src ],
31+ args = TEST_ARGS + ({
32+ "user_counters_tabular_test.cc" : ["--benchmark_counters_tabular=true" ],
33+ }).get (test_src , []),
34+ copts = TEST_COPTS + ({
35+ "cxx03_test.cc" : ["-std=c++03" ],
36+ # Some of the issues with DoNotOptimize only occur when optimization is enabled
37+ "donotoptimize_test.cc" : ["-O3" ],
38+ }).get (test_src , []),
39+ deps = [
40+ ":output_test_helper" ,
41+ "//:benchmark" ,
42+ "//:benchmark_internal_headers" ,
43+ "@com_google_googletest//:gtest" ,
44+ ] + (
45+ ["@com_google_googletest//:gtest_main" ] if (test_src in NEEDS_GTEST_MAIN ) else []
46+ ),
47+ ) for test_src in glob (["*_test.cc" ])]
You can’t perform that action at this time.
0 commit comments