diff options
author | Brian Behlendorf <[email protected]> | 2021-08-29 08:56:58 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-29 09:56:58 -0600 |
commit | 70bf547a98ab17262c5b9908b2c8b814d518ac18 (patch) | |
tree | ad63fdbe2c9c3e8941736f9f6d069f30330590a9 /tests/zfs-tests | |
parent | 5bee265908fb0fccd8ff16f05a470c6b66ed1bd4 (diff) |
ZTS: Waiting for zvols to be available
The ZTS block_device_wait helper function should use -e when waiting
for a file to appear since it will be either a block special device
or a symlink. This didn't cause any failures but when a device path
was specified the function would wait longer than needed.
Additionally update the most flakey test cases to pass the file path
to block_device_wait to try and improve the test reliability. The
udev behavior on Fedora in particular can result in frequent false
positives.
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: John Kennedy <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #12515
Diffstat (limited to 'tests/zfs-tests')
6 files changed, 9 insertions, 9 deletions
diff --git a/tests/zfs-tests/include/blkdev.shlib b/tests/zfs-tests/include/blkdev.shlib index 3f29d4f59..bcba8ee75 100644 --- a/tests/zfs-tests/include/blkdev.shlib +++ b/tests/zfs-tests/include/blkdev.shlib @@ -93,7 +93,7 @@ function block_device_wait typeset missing=false typeset dev for dev in "${@}"; do - if ! [[ -f $dev ]]; then + if ! [[ -e $dev ]]; then missing=true break fi diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib b/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib index e886de432..c2ccb2438 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib @@ -87,7 +87,7 @@ function do_vol_test log_must zfs create -V $VOLSIZE -o copies=$copies $vol log_must zfs set refreservation=none $vol - block_device_wait + block_device_wait $vol_r_path case "$type" in "ext2") diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_007_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_007_pos.ksh index 3623d2bca..0cacb7a98 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_007_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_007_pos.ksh @@ -117,26 +117,26 @@ log_must diff $SRC_FILE $obj if is_global_zone; then vol=$TESTPOOL/$TESTFS/vol.$$ ; volclone=$TESTPOOL/$TESTFS/volclone.$$ log_must zfs create -V 100M $vol - block_device_wait obj=$(target_obj $vol) + block_device_wait $obj log_must dd if=$SRC_FILE of=$obj bs=$BS count=$CNT snap=${vol}@snap.$$ log_must zfs snapshot $snap log_must zfs clone $snap $volclone - block_device_wait # Rename dataset & clone log_must zfs rename $vol ${vol}-new log_must zfs rename $volclone ${volclone}-new - block_device_wait # Compare source file and target file obj=$(target_obj ${vol}-new) + block_device_wait $obj log_must dd if=$obj of=$DST_FILE bs=$BS count=$CNT log_must diff $SRC_FILE $DST_FILE obj=$(target_obj ${volclone}-new) + block_device_wait $obj log_must dd if=$obj of=$DST_FILE bs=$BS count=$CNT log_must diff $SRC_FILE $DST_FILE @@ -144,10 +144,10 @@ if is_global_zone; then log_must zfs rename ${vol}-new $vol log_must zfs rename $snap ${snap}-new log_must zfs clone ${snap}-new $volclone - block_device_wait # Compare source file and target file obj=$(target_obj $volclone) + block_device_wait $obj log_must dd if=$obj of=$DST_FILE bs=$BS count=$CNT log_must diff $SRC_FILE $DST_FILE fi diff --git a/tests/zfs-tests/tests/functional/rsend/recv_dedup_encrypted_zvol.ksh b/tests/zfs-tests/tests/functional/rsend/recv_dedup_encrypted_zvol.ksh index 569fcd893..daf559d26 100755 --- a/tests/zfs-tests/tests/functional/rsend/recv_dedup_encrypted_zvol.ksh +++ b/tests/zfs-tests/tests/functional/rsend/recv_dedup_encrypted_zvol.ksh @@ -52,7 +52,7 @@ log_must eval "bzcat <$sendfile_compressed >$sendfile" log_must eval "zstream redup $sendfile | zfs recv $TESTPOOL/recv" log_must zfs load-key $TESTPOOL/recv -block_device_wait +block_device_wait $volfile log_must eval "bzcat <$volfile_compressed >$volfile" log_must diff $volfile $recvdev diff --git a/tests/zfs-tests/tests/functional/rsend/send-c_stream_size_estimate.ksh b/tests/zfs-tests/tests/functional/rsend/send-c_stream_size_estimate.ksh index 840b5f085..b3edb1c45 100755 --- a/tests/zfs-tests/tests/functional/rsend/send-c_stream_size_estimate.ksh +++ b/tests/zfs-tests/tests/functional/rsend/send-c_stream_size_estimate.ksh @@ -65,7 +65,7 @@ for compress in "${compress_prop_vals[@]}"; do datasetexists $send_vol && log_must_busy zfs destroy -r $send_vol log_must zfs create -o compress=$compress $send_ds log_must zfs create -V 1g -o compress=$compress $send_vol - block_device_wait + block_device_wait $send_voldev typeset dir=$(get_prop mountpoint $send_ds) log_must cp $file $dir diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos.ksh b/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos.ksh index be7257670..cf1e6359b 100755 --- a/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos.ksh +++ b/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos.ksh @@ -62,7 +62,7 @@ for vbs in 8192 16384 32768 65536 131072; do # Create a sparse volume to test larger sizes log_must zfs create -s -b $vbs -V $volsize $vol - block_device_wait + block_device_wait $swapname log_must swap_setup $swapname new_volsize=$(get_prop volsize $vol) |