Use rules_erlang 3.13.1

This version of rules_erlang adds coverage support

Bazel has sort of standardized on lcov for coverage, so that is what
we use.

Example:
1. `bazel coverage //deps/rabbit:eunit -t-`
2. `genhtml --output genhtml "$(bazel info
output_path)/_coverage/_coverage_report.dat"`
3. `open genhtml/index.html`

Multiple tests can be run with results aggregated, i.e. `bazel
coverage //deps/rabbit:all -t-`

Running coverage with RBE has a lot of caveats,
https://bazel.build/configure/coverage#remote-execution, so the above
commands won't work as is with RBE.
This commit is contained in:
Rin Kuryloski 2023-10-16 15:14:56 +02:00 committed by Michael Klishin
parent f4e64235a8
commit 231465f35e
5 changed files with 11 additions and 1 deletions

View File

@ -13,6 +13,8 @@ build --flag_alias=test_build=//:enable_test_build
build --test_timeout=7200 build --test_timeout=7200
build --combined_report=lcov
build:buildbuddy --bes_results_url=https://app.buildbuddy.io/invocation/ build:buildbuddy --bes_results_url=https://app.buildbuddy.io/invocation/
build:buildbuddy --bes_backend=grpcs://remote.buildbuddy.io build:buildbuddy --bes_backend=grpcs://remote.buildbuddy.io
build:buildbuddy --remote_cache=grpcs://remote.buildbuddy.io build:buildbuddy --remote_cache=grpcs://remote.buildbuddy.io

1
.gitignore vendored
View File

@ -72,6 +72,7 @@ rebar3.crashdump
*.lock *.lock
/logs/ /logs/
/genhtml/
/topic-branch-scratch/ /topic-branch-scratch/

View File

@ -31,7 +31,7 @@ bazel_dep(
bazel_dep( bazel_dep(
name = "rules_erlang", name = "rules_erlang",
version = "3.12.0", version = "3.13.1",
) )
bazel_dep( bazel_dep(

View File

@ -1324,4 +1324,7 @@ eunit(
], ],
erl_extra_args = [ENABLE_FEATURE_MAYBE_EXPR], erl_extra_args = [ENABLE_FEATURE_MAYBE_EXPR],
target = ":test_erlang_app", target = ":test_erlang_app",
test_env = {
"COVERDATA_TO_LCOV_APPS_DIRS": "deps:deps/rabbit/apps",
},
) )

View File

@ -175,12 +175,14 @@ def rabbitmq_suite(
deps = [], deps = [],
runtime_deps = [], runtime_deps = [],
**kwargs): **kwargs):
app_name = native.package_name().rpartition("/")[-1]
# suite_name exists in the underying ct_test macro, but we don't # suite_name exists in the underying ct_test macro, but we don't
# want to use the arg in rabbitmq-server, for the sake of clarity # want to use the arg in rabbitmq-server, for the sake of clarity
if suite_name != None: if suite_name != None:
fail("rabbitmq_suite cannot be called with a suite_name attr") fail("rabbitmq_suite cannot be called with a suite_name attr")
ct_test( ct_test(
name = name, name = name,
app_name = app_name,
compiled_suites = [":{}_beam_files".format(name)] + additional_beam, compiled_suites = [":{}_beam_files".format(name)] + additional_beam,
ct_run_extra_args = [ENABLE_FEATURE_MAYBE_EXPR], ct_run_extra_args = [ENABLE_FEATURE_MAYBE_EXPR],
data = native.glob(["test/{}_data/**/*".format(name)]) + data, data = native.glob(["test/{}_data/**/*".format(name)]) + data,
@ -221,6 +223,7 @@ def rabbitmq_integration_suite(
deps = [], deps = [],
runtime_deps = [], runtime_deps = [],
**kwargs): **kwargs):
app_name = native.package_name().rpartition("/")[-1]
# suite_name exists in the underying ct_test macro, but we don't # suite_name exists in the underying ct_test macro, but we don't
# want to use the arg in rabbitmq-server, for the sake of clarity # want to use the arg in rabbitmq-server, for the sake of clarity
if suite_name != None: if suite_name != None:
@ -239,6 +242,7 @@ def rabbitmq_integration_suite(
ct_test( ct_test(
name = name, name = name,
app_name = app_name,
suite_name = name, suite_name = name,
compiled_suites = [":{}_beam_files".format(name)] + additional_beam, compiled_suites = [":{}_beam_files".format(name)] + additional_beam,
tags = tags + [STARTS_BACKGROUND_BROKER_TAG], tags = tags + [STARTS_BACKGROUND_BROKER_TAG],