]> git.ipfire.org Git - pakfire.git/commitdiff
jenkins: Run the testsuite with address sanitization
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 22 Feb 2025 17:09:18 +0000 (17:09 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 22 Feb 2025 17:19:17 +0000 (17:19 +0000)
There are still some things that are broken (Python), so for now, we
won't care if this fails.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Jenkinsfile

index e16032311d0ee8cdb2c082391d88c85f9b7663e6..612907c24629c626f1c2caf89534d03dd643108b 100644 (file)
@@ -122,6 +122,82 @@ pipeline {
 
                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...
                                */