zfs-tests: verify zfs(8) and zpool(8) help message is under 80 columns

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
This commit is contained in:
loli10K 2019-05-24 23:04:08 +02:00 committed by Brian Behlendorf
parent ad0157ec91
commit 8cfa6d4a1c
2 changed files with 16 additions and 8 deletions

View File

@ -44,16 +44,20 @@
function cleanup function cleanup
{ {
if [ -e $TEST_BASE_DIR/zfs_001_neg.$$.txt ] if [ -e "$TEMPFILE" ]
then then
rm $TEST_BASE_DIR/zfs_001_neg.$$.txt rm -f "$TEMPFILE"
fi fi
} }
log_onexit cleanup log_onexit cleanup
log_assert "zfs shows a usage message when run as a user" log_assert "zfs shows a usage message when run as a user"
eval "zfs > $TEST_BASE_DIR/zfs_001_neg.$$.txt 2>&1" TEMPFILE="$TEST_BASE_DIR/zfs_001_neg.$$.txt"
log_must grep "usage: zfs command args" $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" log_pass "zfs shows a usage message when run as a user"

View File

@ -45,16 +45,20 @@
function cleanup function cleanup
{ {
if [ -e $TEST_BASE_DIR/zpool_001_neg.$$.txt ] if [ -e "$TEMPFILE" ]
then then
rm $TEST_BASE_DIR/zpool_001_neg.$$.txt rm -f "$TEMPFILE"
fi fi
} }
TEMPFILE="$TEST_BASE_DIR/zpool_001_neg.$$.txt"
log_onexit cleanup log_onexit cleanup
log_assert "zpool shows a usage message when run as a user" log_assert "zpool shows a usage message when run as a user"
eval "zpool > $TEST_BASE_DIR/zpool_001_neg.$$.txt 2>&1" eval "zpool > $TEMPFILE 2>&1"
log_must grep "usage: zpool command args" $TEST_BASE_DIR/zpool_001_neg.$$.txt 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" log_pass "zpool shows a usage message when run as a user"