diff options
author | Ryan Moeller <[email protected]> | 2020-02-19 12:03:31 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-19 09:03:31 -0800 |
commit | 392556f0efa0129c51b08378b2e52b6667424a56 (patch) | |
tree | d34095a495da468f27c89f463c8b52ff057a675a /tests | |
parent | 89adffb7bcabc8f596552c92c8b3635eaa696713 (diff) |
ZTS: Avoid nonportable cmp flag
FreeBSD doesn't have the -n flag for cmp.
Read the area for the first four labels from the disk to a separate
file to compare instead of using the special flag to limit the size.
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #10024
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_valid.ksh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_valid.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_valid.ksh index 211829d51..31af9fd3f 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_valid.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_valid.ksh @@ -39,13 +39,15 @@ verify_runnable "global" function cleanup { poolexists $TESTPOOL && destroy_pool $TESTPOOL - rm -f $PATTERN_FILE $DEVICE1 $DEVICE2 $DEVICE3 $DEVICE4 + rm -f $PATTERN_FILE $DISK_PATTERN_FILE \ + $DEVICE1 $DEVICE2 $DEVICE3 $DEVICE4 } log_onexit cleanup log_assert "zpool labelclear will only clear valid labels" PATTERN_FILE=$TEST_BASE_DIR/pattern +DISK_PATTERN_FILE=$TEST_BASE_DIR/disk-pattern DEVICE1="$TEST_BASE_DIR/device-1" DEVICE2="$TEST_BASE_DIR/device-2" @@ -79,7 +81,8 @@ log_mustnot eval "zpool import -d $TEST_BASE_DIR | grep $TESTPOOL" # Verify the original pattern over the first two labels is intact for dev in $DEVICE1 $DEVICE2 $DEVICE3 $DEVICE4; do - log_must cmp -n $((4 * 1048576)) $dev $PATTERN_FILE + log_must dd if=$dev of=$DISK_PATTERN_FILE bs=1048576 count=4 + log_must cmp $DISK_PATTERN_FILE $PATTERN_FILE log_mustnot zdb -lq $dev done |