summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-08-19 23:03:10 +0200
committerGitHub <noreply@github.com>2021-08-19 14:03:10 -0700
commit10695f1ed36bdaf6f813b261698e6a02b99d1f1c (patch)
tree32f6d8dff6ce9495dacce73680207545888a4b0a
parent350372e3bf9c1ac5de2e7e74a3ccd8a46f7e1d5d (diff)
downloadspack-10695f1ed36bdaf6f813b261698e6a02b99d1f1c.tar.gz
spack-10695f1ed36bdaf6f813b261698e6a02b99d1f1c.tar.bz2
spack-10695f1ed36bdaf6f813b261698e6a02b99d1f1c.tar.xz
spack-10695f1ed36bdaf6f813b261698e6a02b99d1f1c.zip
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
-rw-r--r--.github/workflows/unit_tests.yaml48
-rwxr-xr-xshare/spack/qa/bashcov5
-rwxr-xr-xshare/spack/qa/run-shell-tests4
-rwxr-xr-xshare/spack/qa/setup.sh4
4 files changed, 11 insertions, 50 deletions
diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml
index b45249f371..6436b6f6ad 100644
--- a/.github/workflows/unit_tests.yaml
+++ b/.github/workflows/unit_tests.yaml
@@ -131,10 +131,7 @@ jobs:
# Needed for unit tests
sudo apt-get -y install \
coreutils cvs gfortran graphviz gnupg2 mercurial ninja-build \
- patchelf
- # Needed for kcov
- sudo apt-get -y install cmake binutils-dev libcurl4-openssl-dev
- sudo apt-get -y install zlib1g-dev libdw-dev libiberty-dev
+ patchelf cmake bison libbison-dev kcov
- name: Install Python packages
run: |
pip install --upgrade pip six setuptools codecov coverage[toml]
@@ -148,17 +145,6 @@ jobs:
# Need this for the git tests to succeed.
git --version
. .github/workflows/setup_git.sh
- - name: Install kcov for bash script coverage
- if: ${{ needs.changes.outputs.with_coverage == 'true' }}
- env:
- KCOV_VERSION: 34
- run: |
- KCOV_ROOT=$(mktemp -d)
- wget --output-document=${KCOV_ROOT}/${KCOV_VERSION}.tar.gz https://github.com/SimonKagstrom/kcov/archive/v${KCOV_VERSION}.tar.gz
- tar -C ${KCOV_ROOT} -xzvf ${KCOV_ROOT}/${KCOV_VERSION}.tar.gz
- mkdir -p ${KCOV_ROOT}/build
- cd ${KCOV_ROOT}/build && cmake -Wno-dev ${KCOV_ROOT}/kcov-${KCOV_VERSION} && cd -
- make -C ${KCOV_ROOT}/build && sudo make -C ${KCOV_ROOT}/build install
- name: Bootstrap clingo
if: ${{ matrix.concretizer == 'clingo' }}
env:
@@ -204,10 +190,7 @@ jobs:
run: |
sudo apt-get -y update
# Needed for shell tests
- sudo apt-get install -y coreutils csh zsh tcsh fish dash bash
- # Needed for kcov
- sudo apt-get -y install cmake binutils-dev libcurl4-openssl-dev
- sudo apt-get -y install zlib1g-dev libdw-dev libiberty-dev
+ sudo apt-get install -y coreutils kcov csh zsh tcsh fish dash bash
- name: Install Python packages
run: |
pip install --upgrade pip six setuptools codecov coverage[toml]
@@ -216,17 +199,6 @@ jobs:
# Need this for the git tests to succeed.
git --version
. .github/workflows/setup_git.sh
- - name: Install kcov for bash script coverage
- if: ${{ needs.changes.outputs.with_coverage == 'true' }}
- env:
- KCOV_VERSION: 38
- run: |
- KCOV_ROOT=$(mktemp -d)
- wget --output-document=${KCOV_ROOT}/${KCOV_VERSION}.tar.gz https://github.com/SimonKagstrom/kcov/archive/v${KCOV_VERSION}.tar.gz
- tar -C ${KCOV_ROOT} -xzvf ${KCOV_ROOT}/${KCOV_VERSION}.tar.gz
- mkdir -p ${KCOV_ROOT}/build
- cd ${KCOV_ROOT}/build && cmake -Wno-dev ${KCOV_ROOT}/kcov-${KCOV_VERSION} && cd -
- make -C ${KCOV_ROOT}/build && sudo make -C ${KCOV_ROOT}/build install
- name: Run shell tests (without coverage)
if: ${{ needs.changes.outputs.with_coverage == 'false' }}
run: |
@@ -314,21 +286,7 @@ jobs:
# Needed for unit tests
sudo apt-get -y install \
coreutils cvs gfortran graphviz gnupg2 mercurial ninja-build \
- patchelf
- # Needed for kcov
- sudo apt-get -y install cmake binutils-dev libcurl4-openssl-dev
- sudo apt-get -y install zlib1g-dev libdw-dev libiberty-dev
- - name: Install kcov for bash script coverage
- if: ${{ needs.changes.outputs.with_coverage == 'true' }}
- env:
- KCOV_VERSION: 34
- run: |
- KCOV_ROOT=$(mktemp -d)
- wget --output-document=${KCOV_ROOT}/${KCOV_VERSION}.tar.gz https://github.com/SimonKagstrom/kcov/archive/v${KCOV_VERSION}.tar.gz
- tar -C ${KCOV_ROOT} -xzvf ${KCOV_ROOT}/${KCOV_VERSION}.tar.gz
- mkdir -p ${KCOV_ROOT}/build
- cd ${KCOV_ROOT}/build && cmake -Wno-dev ${KCOV_ROOT}/kcov-${KCOV_VERSION} && cd -
- make -C ${KCOV_ROOT}/build && sudo make -C ${KCOV_ROOT}/build install
+ patchelf kcov
- name: Install Python packages
run: |
pip install --upgrade pip six setuptools codecov coverage[toml] clingo
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