From ce1b018ab742492e96b5bdae049a13c2faaefdbf Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 11 Nov 2018 17:44:41 +0200 Subject: [PATCH 1/4] Fix shellcheck SC2006 warnings in 'coverage' script --- scripts/test/coverage | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/test/coverage b/scripts/test/coverage index 59d468ee1e..e611a4be1b 100755 --- a/scripts/test/coverage +++ b/scripts/test/coverage @@ -8,19 +8,19 @@ dst=$1 for fn in src/core/*/*.c src/feature/*/*.c src/app/*/*.c src/lib/*/*.c; do - BN=`basename $fn` - DN=`dirname $fn` - F=`echo $BN | sed -e 's/\.c$//;'` + BN=$(basename $fn) + DN=$(dirname $fn) + F=$(echo $BN | sed -e 's/\.c$//;') GC="${BN}.gcov" # Figure out the object file names - ONS=`echo ${DN}/src_*-${F}.o` + ONS=$(echo ${DN}/src_*-${F}.o) ONS_WILDCARD_LITERAL="${DN}/src_*-${F}.o" # If the wildcard didn't expand, no files if [ "$ONS" != "${ONS_WILDCARD_LITERAL}" ] then for on in $ONS; do # We should have a gcno file - GCNO=`echo $on | sed -e 's/\.o$/\.gcno/;'` + GCNO=$(echo $on | sed -e 's/\.o$/\.gcno/;') if [ -e $GCNO ] then # No need to test for gcda, since gcov assumes no execution From 7c04b00e65d67a38f119f4d3e50e8a47236e202f Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 11 Nov 2018 17:50:43 +0200 Subject: [PATCH 2/4] Fix most instances of SC2086 warning --- scripts/test/coverage | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/test/coverage b/scripts/test/coverage index e611a4be1b..180a2d6dcb 100755 --- a/scripts/test/coverage +++ b/scripts/test/coverage @@ -8,9 +8,9 @@ dst=$1 for fn in src/core/*/*.c src/feature/*/*.c src/app/*/*.c src/lib/*/*.c; do - BN=$(basename $fn) - DN=$(dirname $fn) - F=$(echo $BN | sed -e 's/\.c$//;') + BN=$(basename "$fn") + DN=$(dirname "$fn") + F=$(echo "$BN" | sed -e 's/\.c$//;') GC="${BN}.gcov" # Figure out the object file names ONS=$(echo ${DN}/src_*-${F}.o) @@ -20,18 +20,18 @@ for fn in src/core/*/*.c src/feature/*/*.c src/app/*/*.c src/lib/*/*.c; do then for on in $ONS; do # We should have a gcno file - GCNO=$(echo $on | sed -e 's/\.o$/\.gcno/;') - if [ -e $GCNO ] + GCNO=$(echo "$on" | sed -e 's/\.o$/\.gcno/;') + if [ -e "$GCNO" ] then # No need to test for gcda, since gcov assumes no execution # if it's absent - rm -f $GC - gcov -o $on $fn - if [ -e $GC ] + rm -f "$GC" + gcov -o "$on" "$fn" + if [ -e "$GC" ] then if [ -d "$dst" ] then - mv $GC $dst/$GC + mv "$GC" "$dst"/"$GC" fi else echo "gcov -o $on $fn didn't make a .gcov file" From 4fc584f20e5aae8f7b89f169690c17d5bce84d41 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 11 Nov 2018 18:04:07 +0200 Subject: [PATCH 3/4] Fix one last SC2086 --- scripts/test/coverage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test/coverage b/scripts/test/coverage index 180a2d6dcb..7a417cdc89 100755 --- a/scripts/test/coverage +++ b/scripts/test/coverage @@ -13,7 +13,7 @@ for fn in src/core/*/*.c src/feature/*/*.c src/app/*/*.c src/lib/*/*.c; do F=$(echo "$BN" | sed -e 's/\.c$//;') GC="${BN}.gcov" # Figure out the object file names - ONS=$(echo ${DN}/src_*-${F}.o) + ONS=$(echo "${DN}"/src_*-"${F}".o) ONS_WILDCARD_LITERAL="${DN}/src_*-${F}.o" # If the wildcard didn't expand, no files if [ "$ONS" != "${ONS_WILDCARD_LITERAL}" ] From 8cb817cc5e0cc36cc0218da53bc4c1f277ccd8cc Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 11 Nov 2018 18:56:20 +0200 Subject: [PATCH 4/4] Add changes file --- changes/ticket28008 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changes/ticket28008 diff --git a/changes/ticket28008 b/changes/ticket28008 new file mode 100644 index 0000000000..1f0de1a14d --- /dev/null +++ b/changes/ticket28008 @@ -0,0 +1,3 @@ + o Code simplification and refactoring: + - Fix shellcheck warnings in scripts/test/coverage. Resolves issue + 28008.