From 10695f1ed36bdaf6f813b261698e6a02b99d1f1c Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 19 Aug 2021 23:03:10 +0200 Subject: Use kcov from official Ubuntu 20.04 repository (#25385) * Ubuntu 20.04 provides kcov, so don't build from source * Use two undocumented options for kcov v3.8 --- share/spack/qa/bashcov | 5 ++++- share/spack/qa/run-shell-tests | 4 ++-- share/spack/qa/setup.sh | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'share') diff --git a/share/spack/qa/bashcov b/share/spack/qa/bashcov index 58fa4fe0d0..4ca684f42b 100755 --- a/share/spack/qa/bashcov +++ b/share/spack/qa/bashcov @@ -9,4 +9,7 @@ if [ -z "$SPACK_ROOT" ]; then exit 1 fi -kcov "$SPACK_ROOT/coverage" "$@" +# Using a -- to separate the script to be tested from kcov is not documented +# as of v38, but seems to work. The same is true for the "--debug-force-bash-stderr" +# option, see https://github.com/SimonKagstrom/kcov/issues/61 +kcov --debug-force-bash-stderr "$SPACK_ROOT/coverage" -- "$@" diff --git a/share/spack/qa/run-shell-tests b/share/spack/qa/run-shell-tests index 22bf4b8aba..ea67b4c820 100755 --- a/share/spack/qa/run-shell-tests +++ b/share/spack/qa/run-shell-tests @@ -38,8 +38,8 @@ cd "$SPACK_ROOT" # Run bash tests with coverage enabled, but pipe output to /dev/null # because it seems that kcov seems to undo the script's redirection if [ "$COVERAGE" = true ]; then - "$QA_DIR/bashcov" "$QA_DIR/setup-env-test.sh" &> /dev/null - "$QA_DIR/bashcov" "$QA_DIR/completion-test.sh" &> /dev/null + kcov "$SPACK_ROOT/coverage" "$QA_DIR/setup-env-test.sh" &> /dev/null + kcov "$SPACK_ROOT/coverage" "$QA_DIR/completion-test.sh" &> /dev/null else bash "$QA_DIR/setup-env-test.sh" bash "$QA_DIR/completion-test.sh" diff --git a/share/spack/qa/setup.sh b/share/spack/qa/setup.sh index b15d3a4021..9559f9b793 100755 --- a/share/spack/qa/setup.sh +++ b/share/spack/qa/setup.sh @@ -31,10 +31,10 @@ if [[ "$COVERAGE" == "true" ]]; then bashcov=$(realpath ${QA_DIR}/bashcov) # instrument scripts requiring shell coverage - sed -i~ "s@#\!/bin/bash@#\!${bashcov}@" "$SPACK_ROOT/lib/spack/env/cc" + sed -i "s@#\!/bin/bash@#\!${bashcov}@" "$SPACK_ROOT/lib/spack/env/cc" if [ "$(uname -o)" != "Darwin" ]; then # On darwin, #! interpreters must be binaries, so no sbang for bashcov - sed -i~ "s@#\!/bin/sh@#\!${bashcov}@" "$SPACK_ROOT/bin/sbang" + sed -i "s@#\!/bin/sh@#\!${bashcov}@" "$SPACK_ROOT/bin/sbang" fi fi -- cgit v1.2.3-70-g09d2