From de1663d7a93e3878dfd82b902a84f1f32b989f6e Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 14 Nov 2024 09:38:58 -0300 Subject: [PATCH] Remove temporary files Ensure s390x-asm-unsupported-pc-relative-addr and shlibs-cet-support remove temporary files after a successful execution. --- tests/s390x-asm-unsupported-pc-relative-addr/test.sh | 6 +++++- tests/shlibs-cet-support/test.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/s390x-asm-unsupported-pc-relative-addr/test.sh b/tests/s390x-asm-unsupported-pc-relative-addr/test.sh index 7ee5791..d081313 100755 --- a/tests/s390x-asm-unsupported-pc-relative-addr/test.sh +++ b/tests/s390x-asm-unsupported-pc-relative-addr/test.sh @@ -1,8 +1,12 @@ #!/bin/bash -eux -cd "$(mktemp -d)" +tmp=$(mktemp -d) +pushd "$tmp" # This asm has an invalid PC relative address. echo "start: la %r2,_end-start(%r2)" > test.S # clang should fail to build and inform properly about the issue. clang -c -o test.o test.S |& tee clang.output ||: grep -q "Unsupported PC-relative address" clang.output +popd +# On failure, the script will abort and tmp won't be removed. +rm -rf "$tmp" diff --git a/tests/shlibs-cet-support/test.sh b/tests/shlibs-cet-support/test.sh index b86e85a..55684e4 100755 --- a/tests/shlibs-cet-support/test.sh +++ b/tests/shlibs-cet-support/test.sh @@ -1,9 +1,13 @@ #!/bin/bash -eux -cd "$(mktemp -d)" +tmp=$(mktemp -d) +pushd "$tmp" for lib in $(rpm -ql llvm-libs | grep -E '\.so(\..+)?$'); do [[ -L $lib ]] && continue # Skip symlinks readelf -n "$lib" > notes.log grep -q "SHSTK" notes.log grep -q "IBT" notes.log done +popd +# On failure, the script will abort and tmp won't be removed. +rm -rf "$tmp"