diff options
author | Ben Elliston <bje@gnu.org> | 2018-07-20 11:08:08 +1000 |
---|---|---|
committer | Ben Elliston <bje@gnu.org> | 2018-07-20 11:08:08 +1000 |
commit | d611c4560778591e5c4f3f147fe9ba8334691e6e (patch) | |
tree | bf8bd90c721a54be33b8b019c8d53d5e503d4ded | |
parent | 366485ce630d46b726f97b6e1d6a42b750fb52cb (diff) | |
download | dejagnu-d611c4560778591e5c4f3f147fe9ba8334691e6e.zip dejagnu-d611c4560778591e5c4f3f147fe9ba8334691e6e.tar.gz dejagnu-d611c4560778591e5c4f3f147fe9ba8334691e6e.tar.bz2 |
* 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-- | ChangeLog | 4 | ||||
-rwxr-xr-x | contrib/sum2junit.sh | 12 |
2 files changed, 10 insertions, 6 deletions
@@ -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 ':') |