-
-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
6339: Add coverage testing on Jenkins r=hkaiser a=Pansysk75 Runs coverage tests on Jenkins, and uploads results to Codacy. Relies on fetching `grcov` utility. Co-authored-by: Panos Syskakis <[email protected]>
- Loading branch information
Showing
6 changed files
with
210 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!groovy | ||
|
||
// Copyright (c) 2020 ETH Zurich | ||
// Copyright (c) 2022 Hartmut Kaiser | ||
// Copyright (c) 2023 Panos Syskakis | ||
// | ||
// SPDX-License-Identifier: BSL-1.0 | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
pipeline { | ||
agent any | ||
options { | ||
buildDiscarder( | ||
logRotator( | ||
daysToKeepStr: "14", | ||
numToKeepStr: "50", | ||
artifactDaysToKeepStr: "14", | ||
artifactNumToKeepStr: "50" | ||
) | ||
) | ||
} | ||
environment { | ||
CODACY_TOKEN = credentials('CODACY_TOKEN_HPX') | ||
|
||
} | ||
stages { | ||
stage('checkout') { | ||
steps { | ||
dir('hpx') { | ||
sh ''' | ||
#!/bin/bash -l | ||
rm -rf * | ||
''' | ||
checkout scm | ||
echo "Running ${env.BUILD_ID} on ${env.JENKINS_URL}" | ||
} | ||
} | ||
} | ||
stage('test-coverage') { | ||
environment{ | ||
configuration_name = "test-coverage" | ||
} | ||
steps { | ||
dir('hpx') { | ||
sh ''' | ||
#!/bin/bash -l | ||
.jenkins/lsu-test-coverage/entry.sh | ||
''' | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
always { | ||
archiveArtifacts artifacts: 'hpx/jenkins-hpx-*', fingerprint: true | ||
archiveArtifacts artifacts: 'hpx/grcov-log.txt', fingerprint: true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash -l | ||
|
||
# Copyright (c) 2023 Panos Syskakis | ||
# | ||
# SPDX-License-Identifier: BSL-1.0 | ||
# Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
set -eux | ||
|
||
src_dir="$(pwd)" | ||
build_dir="${src_dir}/build/" | ||
|
||
rm -rf "${build_dir}" | ||
|
||
source ${src_dir}/.jenkins/lsu-test-coverage/env-${configuration_name}.sh | ||
|
||
ulimit -l unlimited | ||
|
||
set +e | ||
|
||
# Configure | ||
cmake \ | ||
-S ${src_dir} \ | ||
-B ${build_dir} \ | ||
-G "Ninja" \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DHPX_WITH_CXX_STANDARD=20 \ | ||
-DHPX_WITH_MALLOC=system \ | ||
-DHPX_WITH_FETCH_ASIO=ON \ | ||
-DHPX_WITH_PARCELPORT_MPI=ON \ | ||
-DHPX_WITH_PARCELPORT_LCI=ON \ | ||
-DHPX_WITH_FETCH_LCI=ON \ | ||
-DCMAKE_CXX_FLAGS="-O0 --coverage" \ | ||
-DCMAKE_EXE_LINKER_FLAGS=--coverage | ||
|
||
|
||
# Build | ||
cmake --build ${build_dir} --target tests examples | ||
|
||
# Run tests | ||
ctest --test-dir ${build_dir} --output-on-failure | ||
ctest_status=$? | ||
|
||
|
||
# Tests are finished; Collect coverage data | ||
./grcov . -s ${src_dir} -o lcov.info -t lcov --log "grcov-log.txt" --ignore-not-existing --ignore "/*" | ||
|
||
# Upload to Codacy | ||
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r lcov.info --language CPP -t ${CODACY_TOKEN} --commit-uuid ${ghprbActualCommit} | ||
|
||
echo "${ctest_status}" > "jenkins-hpx-${configuration_name}-ctest-status.txt" | ||
exit $ctest_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash -l | ||
|
||
# Copyright (c) 2020 ETH Zurich | ||
# Copyright (c) 2022 Hartmut Kaiser | ||
# Copyright (c) 2023 Panos Syskakis | ||
# | ||
# SPDX-License-Identifier: BSL-1.0 | ||
# Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
# Make undefined variables errors, print each command | ||
set -eux | ||
|
||
# Clean up old artifacts | ||
rm -f ./jenkins-hpx* ./grcov-log.txt | ||
|
||
source .jenkins/lsu-test-coverage/slurm-constraint-${configuration_name}.sh | ||
|
||
if [[ -z "${ghprbPullId:-}" ]]; then | ||
# Set name of branch if not building a pull request | ||
export git_local_branch=$(echo ${GIT_BRANCH} | cut -f2 -d'/') | ||
job_name="jenkins-hpx-${git_local_branch}-${configuration_name}" | ||
else | ||
job_name="jenkins-hpx-${ghprbPullId}-${configuration_name}" | ||
|
||
# Cancel currently running builds on the same branch, but only for pull | ||
# requests | ||
scancel --verbose --verbose --verbose --verbose --jobname="${job_name}" | ||
fi | ||
|
||
# delay things for a random amount of time | ||
sleep $[(RANDOM % 10) + 1].$[(RANDOM % 10)]s | ||
|
||
# Fetch grcov | ||
wget https://github.com/mozilla/grcov/releases/download/v0.8.2/grcov-linux-x86_64.tar.bz2 -O grcov.tar.bz2 \ | ||
&& echo "32e40a984cb7ed3a60760e26071618370f10fdce2186916e7321f1dd01a6d0fd grcov.tar.bz2" | sha256sum --check --status \ | ||
&& tar -jxf grcov.tar.bz2 \ | ||
&& rm grcov.tar.bz2 | ||
|
||
if [ ! -e "grcov" ]; then | ||
echo "Error: Failed to fetch grcov." | ||
exit 1 | ||
fi | ||
|
||
# Start the actual build | ||
set +e | ||
sbatch \ | ||
--verbose --verbose --verbose --verbose \ | ||
--job-name="${job_name}" \ | ||
--nodes="1" \ | ||
--partition="${configuration_slurm_partition}" \ | ||
--time="05:00:00" \ | ||
--output="jenkins-hpx-${configuration_name}.out" \ | ||
--error="jenkins-hpx-${configuration_name}.err" \ | ||
--wait .jenkins/lsu-test-coverage/batch.sh | ||
|
||
|
||
# Print slurm logs | ||
echo "= stdout ==================================================" | ||
cat jenkins-hpx-${configuration_name}.out | ||
|
||
echo "= stderr ==================================================" | ||
cat jenkins-hpx-${configuration_name}.err | ||
|
||
# Get build status | ||
status_file="jenkins-hpx-${configuration_name}-ctest-status.txt" | ||
|
||
set -e | ||
exit $(cat ${status_file}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) 2023 Panos Syskakis | ||
# | ||
# SPDX-License-Identifier: BSL-1.0 | ||
# Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
set -eu | ||
|
||
module avail | ||
module purge | ||
module load cmake | ||
module load gcc/12 | ||
module load boost/1.79.0-debug | ||
module load hwloc | ||
module load openmpi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright (c) 2023 Panos Syskakis | ||
# | ||
# SPDX-License-Identifier: BSL-1.0 | ||
# Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
configuration_slurm_partition="jenkins-compute" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters