-
Notifications
You must be signed in to change notification settings - Fork 4.1k
build(test): generate per-file brpc cc_test to improve Bazel UT coverage #2985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 5 commits
7fdfc3b
84149df
c5f98f9
9e69e62
e141cd2
2352719
2aac0b4
6916993
5cc61f2
f0491a8
6fa0ce9
fdec07d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,6 +169,26 @@ jobs: | |
| - uses: actions/checkout@v2 | ||
| - run: bazel build --verbose_failures --action_env=CC=clang --define with_mesalink=false --define with_glog=true --define with_thrift=true --define with_debug_bthread_sche_safety=true --define with_debug_lock=true --define with_asan=true -- //... -//example/... | ||
|
|
||
| gcc-bazel-unittest: | ||
| runs-on: ubuntu-22.04 | ||
| env: | ||
| HTTP_PROXY: http://127.0.0.1:7890 # 假设代理端口是7890 | ||
| HTTPS_PROXY: http://127.0.0.1:7890 | ||
| NO_PROXY: localhost,127.0.0.1 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| # - uses: bazelbuild/setup-bazelisk@v2 | ||
| - name: run bazel tests | ||
| run: bazel test --test_output=errors --verbose_failures -- //test/... | ||
|
|
||
| clang-bazel-unittest: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. StackTraceTest.find_symbol seems to fail in clang14. It is recommended to use clang12 with
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And |
||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - uses: bazelbuild/setup-bazelisk@v2 | ||
| - name: run bazel tests | ||
| run: bazel test --test_output=errors --verbose_failures --action_env=CC=clang -- //test/... //... | ||
|
chenBright marked this conversation as resolved.
Outdated
|
||
|
|
||
| clang-unittest: | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| def generate_brpc_unit_tests(name, srcs, deps, copts, data = []): | ||
| tests = [] | ||
| for s in srcs: | ||
| tgt = s.replace(".cpp", "") | ||
| native.cc_test( | ||
| name = tgt, | ||
| srcs = [s], | ||
| copts = copts, | ||
| data = data, | ||
| deps = deps, | ||
| ) | ||
| tests.append(":" + tgt) | ||
|
|
||
| native.test_suite( | ||
| name = name, | ||
| tests = tests, | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| def _flat_runfiles_impl(ctx): | ||
| r = ctx.runfiles() | ||
| for f in ctx.files.srcs: | ||
| r = r.merge(ctx.runfiles(symlinks = {f.basename: f})) | ||
| return DefaultInfo(runfiles = r) | ||
|
|
||
| flat_runfiles = rule( | ||
| implementation = _flat_runfiles_impl, | ||
| attrs = { | ||
| "srcs": attr.label_list(allow_files = True), | ||
| }, | ||
| ) |
Uh oh!
There was an error while loading. Please reload this page.