Skip to content

Commit e602f99

Browse files
authored
Merge acf6319 into e4ccad7
2 parents e4ccad7 + acf6319 commit e602f99

File tree

4 files changed

+166
-1
lines changed

4 files changed

+166
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ rules.ninja
4545
build/
4646
_build/
4747

48-
# in-source dependancies
4948
/googletest/
5049

50+
# Bazel directories.
51+
bazel-*

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,18 @@ install:
155155
brew update;
156156
brew install gcc@7;
157157
fi
158+
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
159+
wget https://github.com/bazelbuild/bazel/releases/download/0.8.1/bazel-0.8.1-installer-linux-x86_64.sh --output-document bazel-installer.sh && sudo bash bazel-installer.sh;
160+
fi
161+
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
162+
brew install bazel;
163+
fi
158164

159165
script:
160166
- 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} ..
161167
- make
162168
- ctest -C ${BUILD_TYPE} --output-on-failure
169+
- bazel test //... --test_output=errors
163170

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

BUILD.bazel

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
licenses(['notice'])
2+
package(default_visibility=['//visibility:public'])
3+
4+
BENCHMARK_COPTS = [
5+
# Choose the regex backend by defining one of the macros below:
6+
# HAVE_GNU_POSIX_REGEX
7+
# HAVE_POSIX_REGEX
8+
# HAVE_STD_REGEX
9+
'-DHAVE_POSIX_REGEX',
10+
'-UNDEBUG',
11+
'-Wall',
12+
'-Wextra',
13+
'-Wfloat-equal',
14+
'-Wshadow',
15+
'-Wstrict-aliasing',
16+
'-Wzero-as-null-pointer-constant',
17+
'-fstrict-aliasing',
18+
'-pedantic',
19+
'-pedantic-errors',
20+
'-std=c++11',
21+
]
22+
23+
24+
GTEST_DEP = '@com_github_google_googletest//:gtest'
25+
26+
cc_library(
27+
name = 'benchmark',
28+
srcs = [
29+
'src/arraysize.h',
30+
'src/benchmark.cc',
31+
'src/benchmark_api_internal.h',
32+
'src/benchmark_register.cc',
33+
'src/check.h',
34+
'src/colorprint.cc',
35+
'src/colorprint.h',
36+
'src/commandlineflags.cc',
37+
'src/commandlineflags.h',
38+
'src/complexity.cc',
39+
'src/complexity.h',
40+
'src/console_reporter.cc',
41+
'src/counter.cc',
42+
'src/counter.h',
43+
'src/csv_reporter.cc',
44+
'src/cycleclock.h',
45+
'src/internal_macros.h',
46+
'src/json_reporter.cc',
47+
'src/log.h',
48+
'src/mutex.h',
49+
'src/re.h',
50+
'src/reporter.cc',
51+
'src/sleep.cc',
52+
'src/sleep.h',
53+
'src/statistics.cc',
54+
'src/statistics.h',
55+
'src/string_util.cc',
56+
'src/string_util.h',
57+
'src/sysinfo.cc',
58+
'src/timers.cc',
59+
'src/timers.h',
60+
],
61+
hdrs = [
62+
'include/benchmark/benchmark.h',
63+
],
64+
includes = [
65+
'include',
66+
],
67+
copts = BENCHMARK_COPTS,
68+
linkopts = [
69+
'-lm',
70+
'-pthread',
71+
],
72+
)
73+
74+
[cc_test(
75+
name = f,
76+
srcs = [
77+
'test/%s.cc' % f,
78+
],
79+
copts = BENCHMARK_COPTS,
80+
deps = [
81+
':benchmark',
82+
],
83+
testonly = 1,
84+
) for f in [
85+
'basic_test',
86+
'benchmark_test',
87+
'diagnostics_test',
88+
'donotoptimize_test',
89+
'filter_test',
90+
'fixture_test',
91+
'map_test',
92+
'multiple_ranges_test',
93+
'options_test',
94+
'register_benchmark_test',
95+
'skip_with_error_test',
96+
'templated_fixture_test',
97+
]
98+
]
99+
100+
[cc_test(
101+
name = f,
102+
srcs = [
103+
'test/%s.cc' % f,
104+
],
105+
copts = BENCHMARK_COPTS,
106+
deps = [
107+
':output_test_helper',
108+
GTEST_DEP,
109+
],
110+
testonly = 1,
111+
) for f in [
112+
'complexity_test',
113+
'reporter_output_test',
114+
'user_counters_tabular_test',
115+
'user_counters_test',
116+
]
117+
]
118+
119+
cc_test(
120+
name = 'cxx03_test',
121+
srcs = [
122+
'test/cxx03_test.cc',
123+
],
124+
copts = [
125+
'-std=c++03',
126+
],
127+
deps = [
128+
':benchmark',
129+
],
130+
testonly = 1,
131+
)
132+
133+
cc_library(
134+
name = 'output_test_helper',
135+
visibility = [
136+
'//visibility:__pkg__',
137+
],
138+
srcs = [
139+
'test/output_test_helper.cc',
140+
],
141+
hdrs = [
142+
'test/output_test.h',
143+
],
144+
strip_include_prefix = 'test',
145+
copts = BENCHMARK_COPTS,
146+
deps = [
147+
':benchmark',
148+
],
149+
testonly = 1,
150+
)

WORKSPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
git_repository(
2+
name = 'com_github_google_googletest',
3+
# TODO: Use googletest/googltest.git once the following PR is committed:
4+
# https://github.com/google/googletest/pull/1212
5+
remote = 'https://github.com/qzmfranklin/googletest.git',
6+
commit = 'a7bd3725f08fe38374544bbf8f03699fc0d32a0b'
7+
)

0 commit comments

Comments
 (0)