]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Correct shellcheck make recipe
authorGiuseppe Di Natale <dinatale2@users.noreply.github.com>
Fri, 7 Apr 2017 00:16:41 +0000 (17:16 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 7 Apr 2017 00:16:41 +0000 (17:16 -0700)
Consolidated the shellcheck call in the
make recipe down to a single call of
shellcheck. Corrected script errors that
have been skipped. Corrected script errors
that have been introduced because make
wasn't reporting any errors from shellcheck.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Closes #5976

Makefile.am
scripts/zfs-tests.sh

index 5545cd67328e6736ceb7c817195470b8355f14f6..8bff905f5795f378b0580f77b4da424c897b4b95 100644 (file)
@@ -52,17 +52,13 @@ cstyle:
 
 shellcheck:
        @if type shellcheck > /dev/null 2>&1; then \
-               shellcheck --exclude=SC1090 --format gcc scripts/paxcheck.sh \
+               shellcheck --exclude=SC1090 --format=gcc scripts/paxcheck.sh \
                        scripts/zloop.sh \
                        scripts/zfs-tests.sh \
                        scripts/zfs.sh \
-                       scripts/commitcheck.sh; \
-               (find cmd/zed/zed.d/*.sh -type f) | \
-                grep -v 'zfs-script-config' | \
-                while read file; do \
-                       shellcheck --exclude=SC1090 --format gcc "$$file"; \
-                done; \
-        fi
+                       scripts/commitcheck.sh \
+                       $$(find cmd/zed/zed.d/*.sh -type f); \
+       fi
 
 lint: cppcheck paxcheck
 
index fe8f15f3fd9f32e6973392bb14ae2e5b2a7a19c0..54c2b3909d690f96cc0db1b2ee0d337c7cd58653 100755 (executable)
@@ -75,7 +75,7 @@ cleanup() {
        done
 
        # Preserve in-tree symlinks to aid debugging.
-       if [ -z "${INTREE}" -a -d "$STF_PATH" ]; then
+       if [ -z "${INTREE}" ] && [ -d "$STF_PATH" ]; then
                rm -Rf "$STF_PATH"
        fi
 }
@@ -89,7 +89,7 @@ trap cleanup EXIT
 #
 cleanup_all() {
        local TEST_POOLS
-       TEST_POOLS=$(sudo $ZPOOL list -H -o name | grep testpool)
+       TEST_POOLS=$(sudo "$ZPOOL" list -H -o name | grep testpool)
        local TEST_LOOPBACKS
        TEST_LOOPBACKS=$(sudo "${LOSETUP}" -a|grep file-vdev|cut -f1 -d:)
        local TEST_FILES
@@ -99,7 +99,7 @@ cleanup_all() {
        msg "--- Cleanup ---"
        msg "Removing pool(s):     $(echo "${TEST_POOLS}" | tr '\n' ' ')"
        for TEST_POOL in $TEST_POOLS; do
-               sudo $ZPOOL destroy "${TEST_POOL}"
+               sudo "$ZPOOL" destroy "${TEST_POOL}"
        done
 
        msg "Removing dm(s):       $(sudo "${DMSETUP}" ls |
@@ -159,20 +159,20 @@ create_links() {
        local dir_list="$1"
        local file_list="$2"
 
-       [ -n $STF_PATH ] || fail "STF_PATH wasn't correctly set"
+       [ -n "$STF_PATH" ] || fail "STF_PATH wasn't correctly set"
 
        for i in $file_list; do
                for j in $dir_list; do
                        [ ! -e "$STF_PATH/$i" ] || continue
 
-                       if [ ! -d "$j/$i" -a -e "$j/$i" ]; then
-                               ln -s $j/$i $STF_PATH/$i || \
+                       if [ ! -d "$j/$i" ] && [ -e "$j/$i" ]; then
+                               ln -s "$j/$i" "$STF_PATH/$i" || \
                                    fail "Couldn't link $i"
                                break
                        fi
                done
 
-               [ ! -e $STF_PATH/$i ] && STF_MISSING_BIN="$STF_MISSING_BIN$i "
+               [ ! -e "$STF_PATH/$i" ] && STF_MISSING_BIN="$STF_MISSING_BIN$i "
        done
 }
 
@@ -182,7 +182,7 @@ create_links() {
 # convenience, otherwise a temporary directory is used.
 #
 constrain_path() {
-       . $STF_SUITE/include/commands.cfg
+       . "$STF_SUITE/include/commands.cfg"
 
        if [ -n "${INTREE}" ]; then
                STF_PATH="$BUILDDIR/bin"
@@ -195,7 +195,7 @@ constrain_path() {
        fi
 
        STF_MISSING_BIN=""
-       chmod 755 $STF_PATH || fail "Couldn't chmod $STF_PATH"
+       chmod 755 "$STF_PATH" || fail "Couldn't chmod $STF_PATH"
 
        # Standard system utilities
        create_links "/bin /usr/bin /sbin /usr/sbin" "$SYSTEM_FILES"
@@ -219,12 +219,12 @@ constrain_path() {
        fi
 
        # Exceptions
-       ln -fs $STF_PATH/awk $STF_PATH/nawk
-       ln -fs /sbin/mkfs.ext2 $STF_PATH/newfs
-       ln -fs $STF_PATH/gzip $STF_PATH/compress
-       ln -fs $STF_PATH/gunzip $STF_PATH/uncompress
-       ln -fs $STF_PATH/exportfs $STF_PATH/share
-       ln -fs $STF_PATH/exportfs $STF_PATH/unshare
+       ln -fs "$STF_PATH/awk" "$STF_PATH/nawk"
+       ln -fs /sbin/mkfs.ext2 "$STF_PATH/newfs"
+       ln -fs "$STF_PATH/gzip" "$STF_PATH/compress"
+       ln -fs "$STF_PATH/gunzip" "$STF_PATH/uncompress"
+       ln -fs "$STF_PATH/exportfs" "$STF_PATH/share"
+       ln -fs "$STF_PATH/exportfs" "$STF_PATH/unshare"
 }
 
 #
@@ -396,7 +396,7 @@ constrain_path
 #
 # Check if ksh exists
 #
-[ -e $STF_PATH/ksh ] || fail "This test suite requires ksh."
+[ -e "$STF_PATH/ksh" ] || fail "This test suite requires ksh."
 
 #
 # Verify the ZFS module stack if loaded.
@@ -414,7 +414,7 @@ fi
 # By default preserve any existing pools
 #
 if [ -z "${KEEP}" ]; then
-       KEEP=$(sudo $ZPOOL list -H -o name)
+       KEEP=$(sudo "$ZPOOL" list -H -o name)
        if [ -z "${KEEP}" ]; then
                KEEP="rpool"
        fi
@@ -422,7 +422,7 @@ fi
 
 __ZFS_POOL_EXCLUDE="$(echo $KEEP | sed ':a;N;s/\n/ /g;ba')"
 
-. $STF_SUITE/include/default.cfg
+. "$STF_SUITE/include/default.cfg"
 
 msg
 msg "--- Configuration ---"