aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Elliston <bje@gnu.org>2018-07-20 11:08:08 +1000
committerBen Elliston <bje@gnu.org>2018-07-20 11:08:08 +1000
commitd611c4560778591e5c4f3f147fe9ba8334691e6e (patch)
treebf8bd90c721a54be33b8b019c8d53d5e503d4ded
parent366485ce630d46b726f97b6e1d6a42b750fb52cb (diff)
* contrib/sum2junit.sh: Eliminate some Shellcheck warnings:
Double quote to prevent globbing and word splitting. [SC2086] egrep is non-standard and deprecated. Use grep -E instead. [SC2196] read without -r will mangle backslashes. [SC2162]
-rw-r--r--ChangeLog4
-rwxr-xr-xcontrib/sum2junit.sh12
2 files changed, 10 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 2eb6d78..f945125 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-07-20 Ben Elliston <bje@gnu.org>
+
+ * contrib/sum2junit.sh: Eliminate some Shellcheck warnings.
+
2018-07-19 Ben Elliston <bje@gnu.org>
* runtest: Use POSIX 'command', not 'type', to look for the Expect
diff --git a/contrib/sum2junit.sh b/contrib/sum2junit.sh
index 8ef6347..7d3b0a4 100755
--- a/contrib/sum2junit.sh
+++ b/contrib/sum2junit.sh
@@ -34,19 +34,19 @@ fi
tool=$(grep "tests ===" "$infile" | tr -s ' ' | cut -d ' ' -f 2)
# Get the counts for tests that didn't work properly
-skipped=$(egrep -c '^UNRESOLVED|^UNTESTED|^UNSUPPORTED' "$infile")
+skipped=$(grep -E -c '^UNRESOLVED|^UNTESTED|^UNSUPPORTED' "$infile")
if test x"${skipped}" = x; then
skipped=0
fi
# The total of successful results are PASS and XFAIL
-passes=$(egrep -c '^PASS|XFAIL' "$infile")
+passes=$(grep -E -c '^PASS|XFAIL' "$infile")
if test x"${passes}" = x; then
passes=0
fi
# The total of failed results are FAIL and XPASS
-failures=$(egrep -c '^XFAIL|XPASS' "$infile")
+failures=$(grep -E -c '^XFAIL|XPASS' "$infile")
if test x"${failures}" = x; then
failures=0
fi
@@ -55,7 +55,7 @@ fi
total=$((passes + failures))
total=$((total + skipped))
-cat <<EOF > ${outfile}
+cat <<EOF > "$outfile"
<?xml version="1.0"?>
<testsuites>
@@ -68,9 +68,9 @@ EOF
# case problem results.
tmpfile="${infile}.tmp"
rm -f "$tmpfile"
-egrep 'XPASS|FAIL|UNTESTED|UNSUPPORTED|UNRESOLVED' "$infile" > "$tmpfile"
+grep -E 'XPASS|FAIL|UNTESTED|UNSUPPORTED|UNRESOLVED' "$infile" > "$tmpfile"
-while read line
+while read -r line
do
echo -n "."
result=$(echo "$line" | cut -d ' ' -f 1 | tr -d ':')