diff options
-rwxr-xr-x | src/test/shell/bazel/bazel_coverage_test.sh | 6 | ||||
-rwxr-xr-x | tools/test/collect_coverage.sh | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/test/shell/bazel/bazel_coverage_test.sh b/src/test/shell/bazel/bazel_coverage_test.sh index d221a749fa..ae2b1483ba 100755 --- a/src/test/shell/bazel/bazel_coverage_test.sh +++ b/src/test/shell/bazel/bazel_coverage_test.sh @@ -22,7 +22,8 @@ source "${CURRENT_DIR}/../integration_test_setup.sh" \ || { echo "integration_test_setup.sh not found!" >&2; exit 1; } function test_cc_test_coverage() { - if [[ ! -x /usr/bin/lcov ]]; then + local -r LCOV=$(which lcov) + if [[ ! -x ${LCOV:-/usr/bin/lcov} ]]; then echo "lcov not installed. Skipping test." return fi @@ -93,7 +94,8 @@ EOF } function test_failed_coverage() { - if [[ ! -x /usr/bin/lcov ]]; then + local -r LCOV=$(which lcov) + if [[ ! -x ${LCOV:-/usr/bin/lcov} ]]; then echo "lcov not installed. Skipping test." return fi diff --git a/tools/test/collect_coverage.sh b/tools/test/collect_coverage.sh index 58afc82ae4..36e17bb33f 100755 --- a/tools/test/collect_coverage.sh +++ b/tools/test/collect_coverage.sh @@ -140,7 +140,11 @@ elif [[ "$COVERAGE_LEGACY_MODE" ]]; then # the current directory # -d "${COVERAGE_DIR}" - Directory to search for .gcda files # -o "${COVERAGE_OUTPUT_FILE}" - Output file - /usr/bin/lcov -c --no-external --ignore-errors graph -q \ + LCOV=$(which lcov) + if [[ ! -x $LCOV ]]; then + LCOV=/usr/bin/lcov + fi + $LCOV -c --no-external --ignore-errors graph -q \ --gcov-tool "${GCOV}" -b /proc/self/cwd \ -d "${COVERAGE_DIR}" -o "${COVERAGE_OUTPUT_FILE}" |