aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests
diff options
context:
space:
mode:
authorTony Hutter <[email protected]>2016-12-16 16:10:45 -0800
committerBrian Behlendorf <[email protected]>2016-12-16 16:10:45 -0800
commit1528bfdb148b44eaa0522109fee1ab61f4f3214b (patch)
tree74da77e5a11483e4acdec247821ec54eb90974e2 /tests/zfs-tests
parent81eb8a1fbb5dae86bebdc6c518071ae3ab062e3f (diff)
Don't run 'zpool iostat -c CMD' command on all vdevs, if vdevs specified
zpool iostat allows you to specify only certain vdevs to display. Currently, if you run 'zpool iostat -c CMD vdev1 vdev2 ...' on specific vdevs, it will actually run the command on *all* vdevs, and just display the results for the vdevs you specify. This patch corrects the behavior to only run the command on the specified vdevs, and also enables the zpool_iostat_005_pos.ksh tests. Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #5443
Diffstat (limited to 'tests/zfs-tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_005_pos.ksh23
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_005_pos.ksh b/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_005_pos.ksh
index be38933c1..89a9a4975 100755
--- a/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_005_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_005_pos.ksh
@@ -54,10 +54,27 @@ fi
# a '/' when we specify the path (-P) flag. We check for "{}" to see if one
# of the VDEV variables isn't set.
#
-C1=$($ZPOOL iostat -Pv | $GREP -E '^\s+/' | $WC -l)
-C2=$($ZPOOL iostat -Pv -c 'echo vdev_test{$VDEV_PATH}{$VDEV_UPATH}' | $GREP -E '^\s+/' | $GREP -v '{}' | $WC -l)
+C1=$($ZPOOL iostat -Pv $testpool | $GREP -E '^\s+/' | $WC -l)
+C2=$($ZPOOL iostat -Pv -c 'echo vdev_test{$VDEV_PATH}{$VDEV_UPATH}' $testpool \
+ | $GREP -E '^\s+/' | $GREP -v '{}' | $WC -l)
if [ "$C1" != "$C2" ] ; then
log_fail "zpool iostat -c failed, expected $C1 vdevs, got $C2"
else
- log_pass "zpool iostat -c passed, expected $C1 vdevs, got $C2"
+ log_note "zpool iostat -c passed, expected $C1 vdevs, got $C2"
+fi
+
+# Call iostat on only a specific vdev, and verify that the command only gets
+# run on the vdev. We write the command results to a temp file to verify that
+# the command actually gets run, rather than just verifying that the results
+# are *displayed* for the specific vdev.
+TMP=$($MKTEMP)
+FIRST_VDEV=$($ZPOOL iostat -Pv $testpool | $GREP -Eo '^\s+/[^ ]+' | $HEAD -n 1)
+log_must $ZPOOL iostat -Pv -c "echo \$VDEV_PATH >> $TMP" $testpool \
+ $FIRST_VDEV > /dev/null
+C2=$($WC -w < $TMP)
+$RM $TMP
+if [ "$C2" != "1" ] ; then
+ log_fail "zpool iostat -c <VDEV> failed, expected 1 vdev, got $C2"
+else
+ log_note "zpool iostat -c <VDEV> passed, expected 1 vdev, got $C2"
fi