Skip to content

Commit

Permalink
ci: set -u in cirrus.sh to treat unset variables as an error
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasnick committed Nov 16, 2022
1 parent 44916ae commit 1c820cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
env:
### compiler options
HOST:
WRAPPER_CMD:
# 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.
WERROR_CFLAGS: -Werror -pedantic-errors
Expand Down
18 changes: 14 additions & 4 deletions ci/cirrus.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh

set -e
set -x
set -eux

export LC_ALL=C

Expand All @@ -16,10 +15,21 @@ print_environment() {
EXPERIMENTAL ECDH RECOVERY SCHNORRSIG \
SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETEST\
EXAMPLES \
WRAPPER_CMD CC AR NM HOST
HOST WRAPPER_CMD
do
eval 'printf "%s %s " "$i=\"${'"$i"'}\""'
done
# In contrast to the previous variables, CC, AR and NM may be unset. Print
# them if they are set (even if set to the empty string).
if [ -n "${CC+x}" ]; then
echo -n "CC=\"${CC}\" "
fi
if [ -n "${AR+x}" ]; then
echo -n "AR=\"${AR}\" "
fi
if [ -n "${NM+x}" ]; then
echo -n "NM=\"${NM}\" "
fi
echo "$0"
set -x
}
Expand All @@ -36,7 +46,7 @@ esac

env >> test_env.log

if [ -n "$CC" ]; then
if [ -n "${CC+x}" ]; then
# The MSVC compiler "cl" doesn't understand "-v"
$CC -v || true
fi
Expand Down

0 comments on commit 1c820cd

Please sign in to comment.