Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
309de598
Commit
309de598
authored
Oct 08, 2019
by
Paul Wankadia
Committed by
Dominic Hamon
Oct 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to Starlark for C++ rules. (#887)
While I'm here, format all of the files that I touched.
parent
f4f5dba4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
23 deletions
+39
-23
BUILD.bazel
BUILD.bazel
+2
-0
WORKSPACE
WORKSPACE
+9
-3
BUILD
test/BUILD
+28
-20
No files found.
BUILD.bazel
View file @
309de598
...
@@ -8,6 +8,8 @@ config_setting(
...
@@ -8,6 +8,8 @@ config_setting(
visibility = [":__subpackages__"],
visibility = [":__subpackages__"],
)
)
load("@rules_cc//cc:defs.bzl", "cc_library")
cc_library(
cc_library(
name = "benchmark",
name = "benchmark",
srcs = glob(
srcs = glob(
...
...
WORKSPACE
View file @
309de598
...
@@ -3,7 +3,13 @@ workspace(name = "com_github_google_benchmark")
...
@@ -3,7 +3,13 @@ workspace(name = "com_github_google_benchmark")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
http_archive(
name = "com_google_googletest",
name = "rules_cc",
urls = ["https://github.com/google/googletest/archive/3f0cf6b62ad1eb50d8736538363d3580dd640c3e.zip"],
strip_prefix = "rules_cc-a508235df92e71d537fcbae0c7c952ea6957a912",
strip_prefix = "googletest-3f0cf6b62ad1eb50d8736538363d3580dd640c3e",
urls = ["https://github.com/bazelbuild/rules_cc/archive/a508235df92e71d537fcbae0c7c952ea6957a912.zip"],
)
http_archive(
name = "com_google_googletest",
strip_prefix = "googletest-3f0cf6b62ad1eb50d8736538363d3580dd640c3e",
urls = ["https://github.com/google/googletest/archive/3f0cf6b62ad1eb50d8736538363d3580dd640c3e.zip"],
)
)
test/BUILD
View file @
309de598
...
@@ -5,7 +5,7 @@ TEST_COPTS = [
...
@@ -5,7 +5,7 @@ TEST_COPTS = [
"-Wall",
"-Wall",
"-Wextra",
"-Wextra",
"-Wshadow",
"-Wshadow",
# "-Wshorten-64-to-32",
# "-Wshorten-64-to-32",
"-Wfloat-equal",
"-Wfloat-equal",
"-fstrict-aliasing",
"-fstrict-aliasing",
]
]
...
@@ -16,13 +16,14 @@ PER_SRC_COPTS = ({
...
@@ -16,13 +16,14 @@ PER_SRC_COPTS = ({
"donotoptimize_test.cc": ["-O3"],
"donotoptimize_test.cc": ["-O3"],
})
})
TEST_ARGS = ["--benchmark_min_time=0.01"]
TEST_ARGS = ["--benchmark_min_time=0.01"]
PER_SRC_TEST_ARGS = ({
PER_SRC_TEST_ARGS = ({
"user_counters_tabular_test.cc": ["--benchmark_counters_tabular=true"],
"user_counters_tabular_test.cc": ["--benchmark_counters_tabular=true"],
})
})
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
cc_library(
cc_library(
name = "output_test_helper",
name = "output_test_helper",
testonly = 1,
testonly = 1,
...
@@ -36,24 +37,31 @@ cc_library(
...
@@ -36,24 +37,31 @@ cc_library(
)
)
[
[
cc_test(
cc_test(
name = test_src[:-len(".cc")],
name = test_src[:-len(".cc")],
size = "small",
size = "small",
srcs = [test_src],
srcs = [test_src],
args = TEST_ARGS + PER_SRC_TEST_ARGS.get(test_src, []),
args = TEST_ARGS + PER_SRC_TEST_ARGS.get(test_src, []),
copts = TEST_COPTS + PER_SRC_COPTS.get(test_src, []),
copts = TEST_COPTS + PER_SRC_COPTS.get(test_src, []),
deps = [
deps = [
":output_test_helper",
":output_test_helper",
"//:benchmark",
"//:benchmark",
"//:benchmark_internal_headers",
"//:benchmark_internal_headers",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest",
] + (
] + (
["@com_google_googletest//:gtest_main"] if (test_src[-len("gtest.cc"):] == "gtest.cc") else []
["@com_google_googletest//:gtest_main"] if (test_src[-len("gtest.cc"):] == "gtest.cc") else []
),
),
# FIXME: Add support for assembly tests to bazel.
# FIXME: Add support for assembly tests to bazel.
# See Issue #556
# See Issue #556
# https://github.com/google/benchmark/issues/556
# https://github.com/google/benchmark/issues/556
) for test_src in glob(["*test.cc"], exclude = ["*_assembly_test.cc", "link_main_test.cc"])
)
for test_src in glob(
["*test.cc"],
exclude = [
"*_assembly_test.cc",
"link_main_test.cc",
],
)
]
]
cc_test(
cc_test(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment