From d611c4560778591e5c4f3f147fe9ba8334691e6e Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Fri, 20 Jul 2018 11:08:08 +1000 Subject: * 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] --- ChangeLog | 4 ++++ contrib/sum2junit.sh | 12 ++++++------ 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 + + * contrib/sum2junit.sh: Eliminate some Shellcheck warnings. + 2018-07-19 Ben Elliston * 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 < ${outfile} +cat < "$outfile" @@ -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 ':') -- cgit v1.1