ci: set -u in cirrus.sh to treat unset variables as an error

This commit is contained in:
Jonas Nick 2022-11-08 09:47:31 +00:00
parent 44916ae915
commit c2e0fdadeb
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
2 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,7 @@
env: env:
### compiler options ### compiler options
HOST: HOST:
WRAPPER_CMD:
# Specific warnings can be disabled with -Wno-error=foo. # Specific warnings can be disabled with -Wno-error=foo.
# -pedantic-errors is not equivalent to -Werror=pedantic and thus not implied by -Werror according to the GCC manual. # -pedantic-errors is not equivalent to -Werror=pedantic and thus not implied by -Werror according to the GCC manual.
WERROR_CFLAGS: -Werror -pedantic-errors WERROR_CFLAGS: -Werror -pedantic-errors

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
set -e set -eux
set -x
export LC_ALL=C export LC_ALL=C
@ -11,14 +10,20 @@ print_environment() {
set +x set +x
# There are many ways to print variable names and their content. This one # There are many ways to print variable names and their content. This one
# does not rely on bash. # does not rely on bash.
for i in WERROR_CFLAGS MAKEFLAGS BUILD \ for var in WERROR_CFLAGS MAKEFLAGS BUILD \
ECMULTWINDOW ECMULTGENPRECISION ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \ ECMULTWINDOW ECMULTGENPRECISION ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \
EXPERIMENTAL ECDH RECOVERY SCHNORRSIG \ EXPERIMENTAL ECDH RECOVERY SCHNORRSIG \
SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETEST\ SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETEST\
EXAMPLES \ EXAMPLES \
WRAPPER_CMD CC AR NM HOST HOST WRAPPER_CMD \
CC AR NM
do do
eval 'printf "%s %s " "$i=\"${'"$i"'}\""' eval "isset=\${$var+x}"
if [ -n "$isset" ]; then
eval "val=\${$var}"
# shellcheck disable=SC2154
printf '%s="%s" ' "$var" "$val"
fi
done done
echo "$0" echo "$0"
set -x set -x
@ -36,7 +41,7 @@ esac
env >> test_env.log env >> test_env.log
if [ -n "$CC" ]; then if [ -n "${CC+x}" ]; then
# The MSVC compiler "cl" doesn't understand "-v" # The MSVC compiler "cl" doesn't understand "-v"
$CC -v || true $CC -v || true
fi fi