From: Michael Tremer Date: Sat, 22 Feb 2025 17:09:18 +0000 (+0000) Subject: jenkins: Run the testsuite with address sanitization X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9788adf3c2d8ab36c725d4a977a34b508c31603c;p=pakfire.git jenkins: Run the testsuite with address sanitization There are still some things that are broken (Python), so for now, we won't care if this fails. Signed-off-by: Michael Tremer --- diff --git a/Jenkinsfile b/Jenkinsfile index e1603231..612907c2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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... */