aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Elliston <bje@gnu.org>2018-07-20 13:48:33 +1000
committerBen Elliston <bje@gnu.org>2018-07-20 13:48:33 +1000
commitde9a1cae6716032501e87fc6d80a527f21c786ca (patch)
treeccaa0b8c833ec289ed388491c42f7b88d939c207
parent4fe160b03cf9023360ec88b764d0fd8596bf0969 (diff)
downloaddejagnu-de9a1cae6716032501e87fc6d80a527f21c786ca.zip
dejagnu-de9a1cae6716032501e87fc6d80a527f21c786ca.tar.gz
dejagnu-de9a1cae6716032501e87fc6d80a527f21c786ca.tar.bz2
* contrib/compare_tests: Eliminate Shellcheck warnings.
* contrib/mysql/sum2xml.sh: Likewise. Warnings fixed: Use single quotes, otherwise this expands now rather than when signalled. [SC2064] Trapping signals by number is not well defined. Prefer signal names. [SC2172] SIGKILL/SIGSTOP can not be trapped. [SC2173] Trapping signals by number is not well defined. Prefer signal names. [SC2172] Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. [SC2181] read without -r will mangle backslashes. [SC2162] egrep is non-standard and deprecated. Use grep -E instead. [SC2196]
-rw-r--r--ChangeLog5
-rwxr-xr-xcontrib/compare_tests26
-rw-r--r--contrib/mysql/sum2xml.sh4
3 files changed, 20 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 110323f..d41f162 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2018-07-20 Ben Elliston <bje@gnu.org>
+ * contrib/compare_tests: Eliminate Shellcheck warnings.
+ * contrib/mysql/sum2xml.sh: Likewise.
+
+2018-07-20 Ben Elliston <bje@gnu.org>
+
* compile, depcomp, install-sh: Latest upstream versions.
2018-07-20 Ben Elliston <bje@gnu.org>
diff --git a/contrib/compare_tests b/contrib/compare_tests
index bcf678c..7c9e86b 100755
--- a/contrib/compare_tests
+++ b/contrib/compare_tests
@@ -29,7 +29,7 @@ before=$tmp1
now=$tmp2
exit_status=0
-trap "rm -f $tmp1 $tmp2 $now_s $before_s" 0 1 2 3 5 9 13 15
+trap 'rm -f $tmp1 $tmp2 $now_s $before_s' EXIT HUP INT QUIT TRAP PIPE TERM
sort -t ':' +1 "$now" > "$now_s"
sort -t ':' +1 "$before" > "$before_s"
@@ -37,8 +37,8 @@ sort -t ':' +1 "$before" > "$before_s"
grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
grep '^PASS' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -12 $tmp1 - >$tmp2
-grep -s . $tmp2 >/dev/null
-if [ $? = 0 ]; then
+
+if grep -s . $tmp2 >/dev/null ; then
echo "Tests that now fail, but worked before:"
echo
cat $tmp2
@@ -49,8 +49,8 @@ fi
grep '^PASS' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -12 $tmp1 - >$tmp2
-grep -s . $tmp2 >/dev/null
-if [ $? = 0 ]; then
+
+if grep -s . $tmp2 >/dev/null ; then
echo "Tests that now work, but didn't before:"
echo
cat $tmp2
@@ -60,8 +60,8 @@ fi
grep '^FAIL' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -23 $tmp1 - >$tmp2
-grep -s . $tmp2 >/dev/null
-if [ $? = 0 ]; then
+
+if grep -s . $tmp2 >/dev/null ; then
echo "New tests that FAIL:"
echo
cat $tmp2
@@ -72,8 +72,8 @@ fi
grep '^PASS' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -23 $tmp1 - >$tmp2
-grep -s . $tmp2 >/dev/null
-if [ $? = 0 ]; then
+
+if grep -s . $tmp2 >/dev/null ; then
echo "New tests that PASS:"
echo
cat $tmp2
@@ -83,8 +83,8 @@ fi
grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
grep '^PASS' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -13 $tmp1 - >$tmp2
-grep -s . $tmp2 >/dev/null
-if [ $? = 0 ]; then
+
+if grep -s . $tmp2 >/dev/null ; then
echo "Old tests that passed, that have disappeared: (Eeek!)"
echo
cat $tmp2
@@ -94,8 +94,8 @@ fi
grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -13 $tmp1 - >$tmp2
-grep -s . $tmp2 >/dev/null
-if [ $? = 0 ]; then
+
+if grep -s . $tmp2 >/dev/null ; then
echo "Old tests that failed, that have disappeared: (Eeek!)"
echo
cat $tmp2
diff --git a/contrib/mysql/sum2xml.sh b/contrib/mysql/sum2xml.sh
index f642a48..e8f49ee 100644
--- a/contrib/mysql/sum2xml.sh
+++ b/contrib/mysql/sum2xml.sh
@@ -70,7 +70,7 @@ echo "<testsuite>" >> "$outfile"
${decomp} "$infile"
infile=$(echo "$infile" | sed -e 's:\.xz::' -e 's:\.gz::')
-while read line
+while read -r line
do
# ignore blank lines
if test x"${line}" = x; then
@@ -84,7 +84,7 @@ do
if test "$(echo "$line" | grep -c Summary)" -gt 0; then
break
fi
- valid=$(echo "$line" | egrep -c 'PASS|FAIL|UNTESTED|UNSUPPORTED|UNRESOLVED')
+ valid=$(echo "$line" | grep -E -c 'PASS|FAIL|UNTESTED|UNSUPPORTED|UNRESOLVED')
if test "$valid" -eq 0; then
continue
fi