summaryrefslogtreecommitdiffstats
path: root/tests/build
diff options
context:
space:
mode:
authorArturo Borrero Gonzalez <arturo@netfilter.org>2023-07-17 12:13:24 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2023-07-17 13:18:16 +0200
commit58f5f4f4dbde0eeab2705dfe453610d850a632c0 (patch)
treede5089594a599ba8616486692bb4a82eacd15e66 /tests/build
parent6493bf4abe6e6f05565db507d2124b1aebc70ec9 (diff)
tests/build/run-tests.sh: fix issues reported by shellcheck
Improve a bit the script as reported by shellcheck, also including information about the log file. The log file, by the way, is added to the gitignore to reduce noise in the git tree. Signed-off-by: Arturo Borrero Gonzalez <arturo@netfilter.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/build')
-rwxr-xr-xtests/build/run-tests.sh34
1 files changed, 19 insertions, 15 deletions
diff --git a/tests/build/run-tests.sh b/tests/build/run-tests.sh
index f78cc901..4616387f 100755
--- a/tests/build/run-tests.sh
+++ b/tests/build/run-tests.sh
@@ -1,32 +1,36 @@
#!/bin/bash
-log_file="`pwd`/tests.log"
+log_file="$(pwd)/tests.log"
dir=../..
argument=( --without-cli --with-cli=linenoise --with-cli=editline --enable-debug --with-mini-gmp
--enable-man-doc --with-xtables --with-json)
ok=0
failed=0
-[ -f $log_file ] && rm -rf $log_file
+[ -f "$log_file" ] && rm -rf "$log_file"
tmpdir=$(mktemp -d)
-if [ ! -w $tmpdir ] ; then
+if [ ! -w "$tmpdir" ] ; then
echo "Failed to create tmp file" >&2
exit 0
fi
-git clone $dir $tmpdir >/dev/null 2>>$log_file
-cd $tmpdir
+git clone "$dir" "$tmpdir" >/dev/null 2>>"$log_file"
+cd "$tmpdir" || exit
-autoreconf -fi >/dev/null 2>>$log_file
-./configure >/dev/null 2>>$log_file
+if ! autoreconf -fi >"$log_file" 2>>"$log_file" ; then
+ echo "Something went wrong. Check the log '${log_file}' for details."
+ exit 1
+fi
-echo "Testing build with distcheck"
-make distcheck >/dev/null 2>>$log_file
-rt=$?
+if ! ./configure >"$log_file" 2>>"$log_file" ; then
+ echo "Something went wrong. Check the log '${log_file}' for details."
+ exit 1
+fi
-if [ $rt != 0 ] ; then
- echo "Something went wrong. Check the log for details."
+echo "Testing build with distcheck"
+if ! make distcheck >/dev/null 2>>"$log_file" ; then
+ echo "Something went wrong. Check the log '${log_file}' for details."
exit 1
fi
@@ -35,8 +39,8 @@ echo "Build works. Now, testing compile options"
for var in "${argument[@]}" ; do
echo "[EXECUTING] Testing compile option $var"
- ./configure $var >/dev/null 2>>$log_file
- make -j 8 >/dev/null 2>>$log_file
+ ./configure "$var" >/dev/null 2>>"$log_file"
+ make -j 8 >/dev/null 2>>"$log_file"
rt=$?
echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line
@@ -49,7 +53,7 @@ for var in "${argument[@]}" ; do
fi
done
-rm -rf $tmpdir
+rm -rf "$tmpdir"
echo "results: [OK] $ok [FAILED] $failed [TOTAL] $((ok+failed))"
[ "$failed" -eq 0 ]