diff options
author | Martin Nowack <m.nowack@imperial.ac.uk> | 2018-07-10 13:59:27 +0100 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2018-07-12 15:28:01 +0100 |
commit | 3eece12c6c5832dce7148a4c8a9c0d4e5ac37f38 (patch) | |
tree | 4d21ba7f7a0fba87120f6ecbd80dd2c240c876fa | |
parent | 1b07577005478f26a106d8636e5b3c4aabf7e8d6 (diff) | |
download | klee-3eece12c6c5832dce7148a4c8a9c0d4e5ac37f38.tar.gz |
Fix uploading of coverage information from inside of docker
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | scripts/build/Dockerfile_klee | 4 | ||||
-rwxr-xr-x | scripts/build/build-docker.sh | 2 | ||||
-rwxr-xr-x | scripts/build/klee.sh | 8 | ||||
-rwxr-xr-x | scripts/build/run-coverage.sh | 24 |
5 files changed, 32 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index c8de1292..d6b9c348 100644 --- a/.travis.yml +++ b/.travis.yml @@ -108,3 +108,4 @@ script: # Build KLEE and run tests - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; ${KLEE_SRC_TRAVIS}/scripts/build/klee.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ${KLEE_SRC_TRAVIS}/scripts/build/build-docker.sh; fi + - if [[ "$COVERAGE" == "1" ]]; then ${KLEE_SRC_TRAVIS}/scripts/build/run-coverage.sh; fi diff --git a/scripts/build/Dockerfile_klee b/scripts/build/Dockerfile_klee index 79ad3838..1872fca6 100644 --- a/scripts/build/Dockerfile_klee +++ b/scripts/build/Dockerfile_klee @@ -37,7 +37,7 @@ ENV DOCKER_BUILD=1 ADD / ${BASE}/klee_src # TODO Remove when STP is fixed -RUN export LD_LIBRARY_PATH=${BASE}/metaSMT/deps/stp-git-basic/lib/ && export KLEE_SRC=${BASE}/klee_src && ${BASE}/klee_src/scripts/build/klee.sh && rm -rf ${BASE}/klee_src/.git +RUN export LD_LIBRARY_PATH=${BASE}/metaSMT/deps/stp-git-basic/lib/ && export KLEE_SRC=${BASE}/klee_src && ${BASE}/klee_src/scripts/build/klee.sh && rm -rf ${BASE}/klee_src/.git && ln -s ${BASE}/klee_build* ${BASE}/klee_build # Create ``klee`` user for container with password ``klee``. # and give it password-less sudo access (temporarily so we can use the TravisCI scripts) @@ -53,6 +53,6 @@ USER klee WORKDIR /home/klee # Add KLEE binary directory to PATH -RUN /bin/bash -c 'DIR="${BASE}/klee_src/scripts/build" source ${BASE}/klee_src/scripts/build/common-defaults.sh && ln -s ${BASE}/klee_build* ${BASE}/klee_build && echo "export PATH=\"$PATH:${LLVM_BIN}:${BASE}/klee_build/bin\"" >> /home/klee/.bashrc' +RUN /bin/bash -c 'DIR="${BASE}/klee_src/scripts/build" source ${BASE}/klee_src/scripts/build/common-defaults.sh && ln -s ${BASE}/klee_src /home/klee/ && ln -s ${BASE}/klee_build /home/klee/ && echo "export PATH=\"$PATH:${LLVM_BIN}:/home/klee/klee_build/bin\"" >> /home/klee/.bashrc' # TODO Remove when STP is fixed RUN /bin/bash -c 'echo "export LD_LIBRARY_PATH=${BASE}/metaSMT/deps/stp-git-basic/lib/" >> /home/klee/.bashrc' diff --git a/scripts/build/build-docker.sh b/scripts/build/build-docker.sh index a409fb0a..3a031d22 100755 --- a/scripts/build/build-docker.sh +++ b/scripts/build/build-docker.sh @@ -96,5 +96,5 @@ if [[ -z ${DOCKER_BUILD_DEPS_ONLY} || "${DOCKER_BUILD_DEPS_ONLY}x" == "1x" ]]; t fi if [[ -z ${DOCKER_BUILD_DEPS_ONLY} || "${DOCKER_BUILD_DEPS_ONLY}x" != "1x" ]]; then - docker build -f "${DIR}/Dockerfile_klee" "${DOCKER_OPTS[@]}" --build-arg SOLVERS="$SOLVERS" -t ${REPOSITORY}/klee:${LLVM_VERSION_SHORT}${LLVM_SUFFIX}${SANITIZER_SUFFIX}${SOLVER_SUFFIX}${DEPS_SUFFIX} "${KLEEDIR}" + docker build -f "${DIR}/Dockerfile_klee" "${DOCKER_OPTS[@]}" -t ${REPOSITORY}/klee:${LLVM_VERSION_SHORT}${LLVM_SUFFIX}${SOLVER_SUFFIX}${DEPS_SUFFIX} "${KLEEDIR}" fi diff --git a/scripts/build/klee.sh b/scripts/build/klee.sh index 2b68dd7e..517318f8 100755 --- a/scripts/build/klee.sh +++ b/scripts/build/klee.sh @@ -160,6 +160,8 @@ coverage_setup() coverageup() { + tags=$1 + codecov_suffix=(${tags// /}) # Create report # (NOTE: "--rc lcov_branch_coverage=1" needs to be added in all calls, otherwise branch coverage gets dropped) lcov --rc lcov_branch_coverage=1 --directory . --base-directory="${KLEE_SRC}" --no-external --capture --output-file coverage.info @@ -167,11 +169,9 @@ coverageup() lcov --rc lcov_branch_coverage=1 --remove coverage.info 'test/*' --output-file coverage.info lcov --rc lcov_branch_coverage=1 --remove coverage.info 'unittests/*' --output-file coverage.info # Combine baseline and measured coverage - lcov --rc lcov_branch_coverage=1 -a coverage_base.info -a coverage.info -o coverage_all.info + lcov --rc lcov_branch_coverage=1 -a coverage_base.info -a coverage.info -o coverage_all.info.${codecov_suffix} # Debug info - lcov --rc lcov_branch_coverage=1 --list coverage_all.info - # Uploading report to CodeCov - bash <(curl -s https://codecov.io/bash) -R "${KLEE_SRC}" -X gcov -y "${KLEE_SRC}/.codecov.yml" -f coverage_all.info -F $1 + lcov --rc lcov_branch_coverage=1 --list coverage_all.info.${codecov_suffix} } COVERAGE=${COVERAGE:=0} diff --git a/scripts/build/run-coverage.sh b/scripts/build/run-coverage.sh new file mode 100755 index 00000000..816b1467 --- /dev/null +++ b/scripts/build/run-coverage.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +# We are going to build docker containers +export DOCKER_BUILD=1 + +# All scripts are located relative to this one +DIR="$(cd "$(dirname "$0")" && pwd)" +source "${DIR}/common-defaults.sh" + +if [[ "a$COVERAGE" != "a1" ]]; then + exit 0 +fi + +function upload_coverage() { + tags=$1 + codecov_suffix=(${tags// /}) + ci_env=$(bash <(curl -s https://codecov.io/env)) + docker run ${ci_env} -ti ${REPOSITORY}/klee:${LLVM_VERSION_SHORT}${LLVM_SUFFIX}${SOLVER_SUFFIX}${DEPS_SUFFIX} /bin/bash -c "cd /home/klee/klee_src && bash <(curl -s https://codecov.io/bash) -X gcov -y /home/klee/klee_src/.codecov.yml -f /home/klee/klee_build/coverage_all.info.${codecov_suffix} -F $tags" +} + +upload_coverage systemtests +upload_coverage unittests |