]> granicus.if.org Git - zfs/commitdiff
Use compatible arg order in tests
authorRyan Moeller <ryan@freqlabs.com>
Thu, 29 Aug 2019 18:03:09 +0000 (14:03 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 29 Aug 2019 18:03:09 +0000 (11:03 -0700)
BSD getopt() and getopt_long() want options before arguments.
Reorder arguments to zfs/zpool in tests to put all the options first.

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9228

tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh
tests/zfs-tests/tests/functional/alloc_class/alloc_class_005_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_program/zfs_program_json.ksh

index dcc6f7607c9b1adc596a01b1bf4d6ceb9c61a111..79ac9364c257811f486d6c1f6a2433b1da0e00a5 100755 (executable)
@@ -52,7 +52,7 @@ do
        log_must zpool create $TESTPOOL $type $ZPOOL_DISKS \
            special $stype $sdisks
 
-       ac_value="$(zpool get all -H -o property,value | \
+       ac_value="$(zpool get -H -o property,value all | \
            egrep allocation_classes | nawk '{print $2}')"
        if [ "$ac_value" = "active" ]; then
                log_note "feature@allocation_classes is active"
index 417c68aa739be56c68c2381487a0eeae9afee81a..337114cdb59e720087f25413f47d487ab778b598 100755 (executable)
@@ -41,7 +41,7 @@ do
        else
                log_must zpool create $TESTPOOL $type $ZPOOL_DISKS
        fi
-       ac_value="$(zpool get all -H -o property,value | \
+       ac_value="$(zpool get -H -o property,value all | \
            egrep allocation_classes  | awk '{print $2}')"
        if [ "$ac_value" = "enabled" ]; then
                log_note "feature@allocation_classes is enabled"
@@ -56,7 +56,7 @@ do
                log_must zpool add $TESTPOOL special mirror \
                    $CLASS_DISK0 $CLASS_DISK1
        fi
-       ac_value="$(zpool get all -H -o property,value | \
+       ac_value="$(zpool get -H -o property,value all | \
            egrep allocation_classes | awk '{print $2}')"
        if [ "$ac_value" = "active" ]; then
                log_note "feature@allocation_classes is active"
index 1d769096b4fb8ffc2d458a1b0dac4b22d5ac4128..3d59f784a4886d5d7ab4ff955f205e203d74e667 100755 (executable)
@@ -95,10 +95,10 @@ typeset -i cnt=0
 typeset cmd
 for cmd in ${pos_cmds[@]}; do
        log_must zfs program $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
-       log_must zfs program $TESTPOOL -j $TESTZCP $TESTDS $cmd 2>&1
+       log_must zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
        # json.tool is needed to guarantee consistent ordering of fields
        # sed is needed to trim trailing space in CentOS 6's json.tool output
-       OUTPUT=$(zfs program $TESTPOOL -j $TESTZCP $TESTDS $cmd 2>&1 | python -m json.tool | sed 's/[[:space:]]*$//')
+       OUTPUT=$(zfs program -j $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1 | python -m json.tool | sed 's/[[:space:]]*$//')
        if [ "$OUTPUT" != "${pos_cmds_out[$cnt]}" ]; then
                log_note "Got     :$OUTPUT"
                log_note "Expected:${pos_cmds_out[$cnt]}"
@@ -120,9 +120,9 @@ For the property list, run: zfs set|get
 For the delegated permission list, run: zfs allow|unallow")
 cnt=0
 for cmd in ${neg_cmds[@]}; do
-       log_mustnot zfs program $TESTPOOL $TESTZCP $TESTDS $cmd 2>&1
-       log_mustnot zfs program $TESTPOOL -j $TESTZCP $TESTDS $cmd 2>&1
-       OUTPUT=$(zfs program $TESTPOOL -j $TESTZCP $TESTDS $cmd 2>&1)
+       log_mustnot zfs program $cmd $TESTPOOL $TESTZCP $TESTDS 2>&1
+       log_mustnot zfs program -j $cmd $TESTPOOL $TESTZCP $TESTDS 2>&1
+       OUTPUT=$(zfs program -j $cmd $TESTPOOL $TESTZCP $TESTDS 2>&1)
        if [ "$OUTPUT" != "${neg_cmds_out[$cnt]}" ]; then
                log_note "Got     :$OUTPUT"
                log_note "Expected:${neg_cmds_out[$cnt]}"