tests: cc-compat.sh: fixed bug when all tested compilers aren’t present

This commit is contained in:
Emma Tebibyte 2023-12-24 17:31:17 -07:00
parent ef1416cd42
commit 68b296e963
Signed by untrusted user: emma
GPG Key ID: 06FA419A1698C270
1 changed files with 6 additions and 2 deletions

View File

@ -12,18 +12,22 @@ set -e
if ! ls GNUmakefile >/dev/null 2>&1
then
printf '%s: Run this script in the root of the project.\n' "$0" 1>&2
exit 1
exit 64 # sysexits.h(3) EX_USAGE
fi
make clean
for CC in cc\
for CC in cc \
clang \
gcc \
tcc \
'zig cc'
do
export CC
command -v "$(printf '%s\n' "$CC" | cut -d ' ' -f1)" >/dev/null 2>&1 \
|| continue
printf '%s: %s: Testing build.\n' "$0" "$CC"
make CC="$CC" && printf '%s: Build successful.\n' "$0"