]> granicus.if.org Git - zfs/commitdiff
zfs-tests: verify zfs(8) and zpool(8) help message is under 80 columns
authorloli10K <loli10K@users.noreply.github.com>
Fri, 24 May 2019 21:04:08 +0000 (23:04 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 24 May 2019 21:04:08 +0000 (14:04 -0700)
This commit updates the ZFS Test Suite to detect incorrect wrapping of
both zfs(8) and zpool(8) help message

Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #8785

tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh
tests/zfs-tests/tests/functional/cli_user/misc/zpool_001_neg.ksh

index 1073a40308b51805530d3b0c058d5b58bd2beda0..46171caf9fbcf7c594ebb1299925930a720bf443 100755 (executable)
 
 function cleanup
 {
-       if [ -e $TEST_BASE_DIR/zfs_001_neg.$$.txt ]
+       if [ -e "$TEMPFILE" ]
        then
-               rm $TEST_BASE_DIR/zfs_001_neg.$$.txt
+               rm -f "$TEMPFILE"
        fi
 }
 
 log_onexit cleanup
 log_assert "zfs shows a usage message when run as a user"
 
-eval "zfs > $TEST_BASE_DIR/zfs_001_neg.$$.txt 2>&1"
-log_must grep "usage: zfs command args" $TEST_BASE_DIR/zfs_001_neg.$$.txt
+TEMPFILE="$TEST_BASE_DIR/zfs_001_neg.$$.txt"
+
+eval "zfs > $TEMPFILE 2>&1"
+log_must grep "usage: zfs command args" "$TEMPFILE"
+
+log_must eval "awk '{if (length(\$0) > 80) exit 1}' < $TEMPFILE"
 
 log_pass "zfs shows a usage message when run as a user"
index af924837ad8aa96f17f1ef441d945f5611c60f9f..0fddc08b25dbbccc797eeee5880681d697fa8158 100755 (executable)
 
 function cleanup
 {
-       if [ -e $TEST_BASE_DIR/zpool_001_neg.$$.txt ]
+       if [ -e "$TEMPFILE" ]
        then
-               rm $TEST_BASE_DIR/zpool_001_neg.$$.txt
+               rm -f "$TEMPFILE"
        fi
 }
 
+TEMPFILE="$TEST_BASE_DIR/zpool_001_neg.$$.txt"
+
 log_onexit cleanup
 log_assert "zpool shows a usage message when run as a user"
 
-eval "zpool > $TEST_BASE_DIR/zpool_001_neg.$$.txt 2>&1"
-log_must grep "usage: zpool command args" $TEST_BASE_DIR/zpool_001_neg.$$.txt
+eval "zpool > $TEMPFILE 2>&1"
+log_must grep "usage: zpool command args" "$TEMPFILE"
+
+log_must eval "awk '{if (length(\$0) > 80) exit 1}' < $TEMPFILE"
 
 log_pass "zpool shows a usage message when run as a user"