mirror of
https://github.com/google/benchmark.git
synced 2024-11-28 05:44:40 +00:00
add multiple OSes to bazel workflow (#1412)
* add multiple OSes to bazel workflow * correct indent * only set copts when they're supported by the OS * os check should work * pull out cxx03_test for per-platform stuff * attempt to fix windows test output
This commit is contained in:
parent
920fa14898
commit
2365c4a603
13
.github/workflows/bazel.yml
vendored
13
.github/workflows/bazel.yml
vendored
|
@ -5,8 +5,13 @@ on:
|
|||
pull_request: {}
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
job:
|
||||
name: bazel.${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-2022]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
@ -17,9 +22,9 @@ jobs:
|
|||
cache-name: bazel-cache
|
||||
with:
|
||||
path: "~/.cache/bazel"
|
||||
key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.ref }}
|
||||
key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.ref }}
|
||||
restore-keys: |
|
||||
${{ env.cache-name }}-${{ runner.os }}-main
|
||||
${{ env.cache-name }}-${{ matrix.os }}-main
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
|
|
52
test/BUILD
52
test/BUILD
|
@ -1,3 +1,12 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
|
||||
|
||||
platform(
|
||||
name = "windows",
|
||||
constraint_values = [
|
||||
"@platforms//os:windows",
|
||||
],
|
||||
)
|
||||
|
||||
TEST_COPTS = [
|
||||
"-pedantic",
|
||||
"-pedantic-errors",
|
||||
|
@ -11,11 +20,10 @@ TEST_COPTS = [
|
|||
"-fstrict-aliasing",
|
||||
]
|
||||
|
||||
PER_SRC_COPTS = ({
|
||||
"cxx03_test.cc": ["-std=c++03"],
|
||||
# Some of the issues with DoNotOptimize only occur when optimization is enabled
|
||||
# Some of the issues with DoNotOptimize only occur when optimization is enabled
|
||||
PER_SRC_COPTS = {
|
||||
"donotoptimize_test.cc": ["-O3"],
|
||||
})
|
||||
}
|
||||
|
||||
TEST_ARGS = ["--benchmark_min_time=0.01"]
|
||||
|
||||
|
@ -26,14 +34,15 @@ PER_SRC_TEST_ARGS = ({
|
|||
"spec_arg_verbosity_test.cc" : ["--v=42"],
|
||||
})
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
|
||||
|
||||
cc_library(
|
||||
name = "output_test_helper",
|
||||
testonly = 1,
|
||||
srcs = ["output_test_helper.cc"],
|
||||
hdrs = ["output_test.h"],
|
||||
copts = TEST_COPTS,
|
||||
copts = select({
|
||||
"//:windows": [],
|
||||
"//conditions:default": TEST_COPTS,
|
||||
}),
|
||||
deps = [
|
||||
"//:benchmark",
|
||||
"//:benchmark_internal_headers",
|
||||
|
@ -46,7 +55,10 @@ cc_library(
|
|||
size = "small",
|
||||
srcs = [test_src],
|
||||
args = TEST_ARGS + PER_SRC_TEST_ARGS.get(test_src, []),
|
||||
copts = TEST_COPTS + PER_SRC_COPTS.get(test_src, []),
|
||||
copts = select({
|
||||
"//:windows": [],
|
||||
"//conditions:default": TEST_COPTS,
|
||||
}) + PER_SRC_COPTS.get(test_src, []) ,
|
||||
deps = [
|
||||
":output_test_helper",
|
||||
"//:benchmark",
|
||||
|
@ -62,15 +74,37 @@ cc_library(
|
|||
["*test.cc"],
|
||||
exclude = [
|
||||
"*_assembly_test.cc",
|
||||
"cxx03_test.cc",
|
||||
"link_main_test.cc",
|
||||
],
|
||||
)
|
||||
]
|
||||
|
||||
cc_test(
|
||||
name = "cxx03_test",
|
||||
size = "small",
|
||||
srcs = ["cxx03_test.cc"],
|
||||
copts = TEST_COPTS + ["-std=c++03"],
|
||||
deps = [
|
||||
":output_test_helper",
|
||||
"//:benchmark",
|
||||
"//:benchmark_internal_headers",
|
||||
"@com_google_googletest//:gtest",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
target_compatible_with = select({
|
||||
"//:windows": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
})
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "link_main_test",
|
||||
size = "small",
|
||||
srcs = ["link_main_test.cc"],
|
||||
copts = TEST_COPTS,
|
||||
copts = select({
|
||||
"//:windows": [],
|
||||
"//conditions:default": TEST_COPTS,
|
||||
}),
|
||||
deps = ["//:benchmark_main"],
|
||||
)
|
||||
|
|
|
@ -17,7 +17,7 @@ static int AddContextCases() {
|
|||
AddCases(TC_ConsoleErr,
|
||||
{
|
||||
{"^%int-%int-%intT%int:%int:%int[-+]%int:%int$", MR_Default},
|
||||
{"Running .*/reporter_output_test(\\.exe)?$", MR_Next},
|
||||
{"Running .*(/|\\\\)reporter_output_test(\\.exe)?$", MR_Next},
|
||||
{"Run on \\(%int X %float MHz CPU s?\\)", MR_Next},
|
||||
});
|
||||
AddCases(TC_JSONOut,
|
||||
|
|
Loading…
Reference in a new issue