Skip to content

Commit 37eee8a

Browse files
Merge 0d7c330 into 6ecf8a8
2 parents 6ecf8a8 + 0d7c330 commit 37eee8a

File tree

7 files changed

+86
-0
lines changed

7 files changed

+86
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ build.ninja
4141
install_manifest.txt
4242
rules.ninja
4343

44+
# bazel output symlinks.
45+
bazel-*
46+
4447
# out-of-source build top-level folders.
4548
build/
4649
_build/

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,20 @@ install:
159159
brew update;
160160
brew install gcc@7;
161161
fi
162+
- if [ "{TRAVIS_OS_NAME}" == "linux" ]; then
163+
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;
164+
sudo bash bazel-installer.sh;
165+
fi
166+
- if [ "{TRAVIS_OS_NAME}" == "osx" ]; then
167+
curl -o bazel-installer.sh https://github.com/bazelbuild/bazel/releases/download/0.10.1/bazel-0.10.1-installer-darwin-x86_64.sh;
168+
sudo bash bazel-installer.sh;
169+
fi
162170

163171
script:
164172
- 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} ..
165173
- make
166174
- ctest -C ${BUILD_TYPE} --output-on-failure
175+
- bazel test -c dbg --announce_rc --verbose_failures --test_output=errors --keep_going //...
167176

168177
after_success:
169178
- if [ "${BUILD_TYPE}" == "Coverage" -a "${TRAVIS_OS_NAME}" == "linux" ]; then

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Radoslav Yovchev <radoslav.tm@gmail.com>
3838
Roman Lebedev <lebedev.ri@gmail.com>
3939
Shuo Chen <chenshuo@chenshuo.com>
4040
Steinar H. Gunderson <sgunderson@bigfoot.com>
41+
Stripe, Inc.
4142
Yixuan Qiu <yixuanq@gmail.com>
4243
Yusuke Suzuki <utatane.tea@gmail.com>
4344
Zbigniew Skowron <zbychs@gmail.com>

BUILD.bazel

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
licenses(["notice"])
2+
3+
cc_library(
4+
name = "benchmark",
5+
srcs = glob([
6+
"src/*.cc",
7+
"src/*.h",
8+
]),
9+
hdrs = ["include/benchmark/benchmark.h"],
10+
copts = ["-DHAVE_STD_REGEX"],
11+
strip_include_prefix = "include",
12+
visibility = ["//visibility:public"],
13+
)
14+
15+
cc_library(
16+
name = "benchmark_internal_headers",
17+
hdrs = glob(["src/*.h"]),
18+
visibility = ["//test:__pkg__"],
19+
)

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
3838
Jern-Kuan Leong <jernkuan@gmail.com>
3939
JianXiong Zhou <zhoujianxiong2@gmail.com>
4040
Joao Paulo Magalhaes <joaoppmagalhaes@gmail.com>
41+
John Millikin <jmillikin@stripe.com>
4142
Jussi Knuuttila <jussi.knuuttila@gmail.com>
4243
Kai Wolf <kai.wolf@gmail.com>
4344
Kishan Kumar <kumar.kishan@outlook.com>

WORKSPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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+
)

test/BUILD

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
NEEDS_GTEST_MAIN = [
2+
"statistics_test.cc",
3+
]
4+
5+
TEST_COPTS = [
6+
"-pedantic",
7+
"-pedantic-errors",
8+
"-std=c++11",
9+
"-DHAVE_STD_REGEX",
10+
]
11+
12+
TEST_ARGS = ["--benchmark_min_time=0.01"]
13+
14+
cc_library(
15+
name = "output_test_helper",
16+
testonly = 1,
17+
srcs = ["output_test_helper.cc"],
18+
hdrs = ["output_test.h"],
19+
copts = TEST_COPTS,
20+
deps = [
21+
"//:benchmark",
22+
"//:benchmark_internal_headers",
23+
],
24+
)
25+
26+
[cc_test(
27+
name = test_src[:-len(".cc")],
28+
size = "small",
29+
srcs = [test_src],
30+
args = TEST_ARGS + ({
31+
"user_counters_tabular_test.cc": ["--benchmark_counters_tabular=true"],
32+
}).get(test_src, []),
33+
copts = TEST_COPTS + ({
34+
"cxx03_test.cc": ["-std=c++03"],
35+
# Some of the issues with DoNotOptimize only occur when optimization is enabled
36+
"donotoptimize_test.cc": ["-O3"],
37+
}).get(test_src, []),
38+
deps = [
39+
":output_test_helper",
40+
"//:benchmark",
41+
"//:benchmark_internal_headers",
42+
"@com_google_googletest//:gtest",
43+
] + (
44+
["@com_google_googletest//:gtest_main"] if (test_src in NEEDS_GTEST_MAIN) else []
45+
),
46+
) for test_src in glob(["*_test.cc"])]

0 commit comments

Comments
 (0)