From 0d085612b37a0e23285bd426bd458089523d1705 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 8 Jul 2020 14:05:27 +0200 Subject: [PATCH] And make sure that the test is only executed when installed correctly --- debian/changelog | 1 + debian/qualify-clang.sh | 29 +++++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0b417fc1..1ab34aa6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ llvm-toolchain-10 (1:10.0.1~+rc4-1) unstable; urgency=medium * Update the binfmt-support postinstall to match what is done elsewhere in Debian * Add binfmt-support to one of the autopkgtest tests + And make sure that the test is only executed when installed correctly Otherwise, fails with "./foo.bc: cannot execute binary file: Exec format error" diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index ef310fbc..0b55a8d3 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -290,21 +290,26 @@ if ! lli-$VERSION opt.ll|grep -q "lli foo"; then lli-$VERSION opt.ll exit 1 fi -clang-$VERSION -O3 -emit-llvm foo.c -c -o foo.bc -chmod +x foo.bc -if ! ./foo.bc|grep -q "lli foo"; then - echo "executing ./foo.bc failed" - ./foo.bc - exit 1 -fi clang-$VERSION -O3 -emit-llvm foo.c -c -o foo.bc chmod +x foo.bc -if ! ./foo.bc|grep -q "lli foo"; then - echo "executing ./foo.bc failed" - ./foo.bc - exit 1 -fi +# only run if the binfmt is installed correctly +if /usr/sbin/update-binfmts --display llvm-$VERSION-runtime.binfmt &> /dev/null; then + if ! ./foo.bc|grep -q "lli foo"; then + echo "executing ./foo.bc failed" + ./foo.bc + exit 1 + fi + + clang-$VERSION -O3 -emit-llvm foo.c -c -o foo.bc + chmod +x foo.bc + if ! ./foo.bc|grep -q "lli foo"; then + echo "executing ./foo.bc failed" + ./foo.bc + exit 1 + fi +fi # binfmt test + if ! llvm-dis-$VERSION < foo.bc|grep -q "lli foo"; then echo "llvm assembly code failed" llvm-dis-$VERSION < foo.bc