stage("Coverage Tests") {
parallel {
+ stage("Address Sanitizer") {
+ agent {
+ docker {
+ image "debian:trixie"
+
+ // Run as root inside the containers to install dependencies
+ args "--privileged -u root"
+
+ customWorkspace "${JOB_NAME}/${BUILD_ID}/asan"
+ }
+ }
+
+ stages {
+ stage("Install Dependencies") {
+ steps {
+ script {
+ installBuildDepsDebian("trixie", "gcc", "amd64")
+ }
+ }
+ }
+
+ stage("Configure") {
+ steps {
+ sh "./autogen.sh"
+ sh """
+ ./configure \
+ --prefix=/usr \
+ --enable-asan \
+ --enable-debug
+ """
+ }
+ }
+
+ stage("Build") {
+ steps {
+ sh "make -j\$(nproc)"
+ }
+ }
+
+ stage("Check") {
+ steps {
+ script {
+ try {
+ sh "make check"
+ } catch (Exception e) {
+ unstable("Address Sanitizer checks failed")
+ }
+ }
+ }
+
+ post {
+ failure {
+ // Copy test logs into a special directory
+ sh """
+ mkdir -pv tests/asan
+ find tests -name "*.log" | xargs --no-run-if-empty \
+ cp --verbose --parents --target-directory=tests/asan/
+ """
+
+ // Archive the logs only if the stage fails
+ archiveArtifacts artifacts: "tests/asan/**/*"
+
+ echo "The test logs have been archived"
+ }
+ }
+ }
+ }
+
+ // Cleanup the workspace afterwards
+ post {
+ always {
+ cleanWs()
+ }
+ }
+ }
+
/*
Run Pakfire through Clang's Static Analyzer...
*/