Skip to content

Commit 615e1b1

Browse files
keithcopybara-github
authored andcommitted
Change set -x in coverage to be set by var
Using `set -x` in the coverage scripts causes a lot of noise, this changes it to be off by default, but something you can enable by passing `--test_env=VERBOSE_COVERAGE=1` for debugging. Closes #13248. PiperOrigin-RevId: 369396233
1 parent d743e57 commit 615e1b1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tools/test/collect_cc_coverage.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -x
1+
#!/bin/bash
22
# Copyright 2016 The Bazel Authors. All rights reserved.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,11 +31,16 @@
3131
# - COVERAGE_GCOV_OPTIONS Additional options to pass to gcov.
3232
# - ROOT Location from where the code coverage collection
3333
# was invoked.
34+
# - VERBOSE_COVERAGE Print debug info from the coverage scripts
3435
#
3536
# The script looks in $COVERAGE_DIR for the C++ metadata coverage files (either
3637
# gcda or profraw) and uses either lcov or gcov to get the coverage data.
3738
# The coverage data is placed in $COVERAGE_OUTPUT_FILE.
3839

40+
if [[ -n "$VERBOSE_COVERAGE" ]]; then
41+
set -x
42+
fi
43+
3944
# Checks if clang llvm coverage should be used instead of lcov.
4045
function uses_llvm() {
4146
if stat "${COVERAGE_DIR}"/*.profraw >/dev/null 2>&1; then

tools/test/collect_coverage.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -x
1+
#!/bin/bash
22

33
# Copyright 2016 The Bazel Authors. All rights reserved.
44
#
@@ -21,10 +21,15 @@
2121
# LCOV_MERGER - mandatory, location of the LcovMerger
2222
# COVERAGE_DIR - optional, location of the coverage temp directory
2323
# COVERAGE_OUTPUT_FILE - optional, location of the final lcov file
24+
# VERBOSE_COVERAGE - optional, print debug info from the coverage scripts
2425
#
2526
# Script expects that it will be started in the execution root directory and
2627
# not in the test's runfiles directory.
2728

29+
if [[ -n "$VERBOSE_COVERAGE" ]]; then
30+
set -x
31+
fi
32+
2833
function resolve_links() {
2934
local name="$1"
3035

0 commit comments

Comments
 (0)