aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Ercolani <[email protected]>2021-12-16 23:19:22 -0500
committerBrian Behlendorf <[email protected]>2022-03-08 09:33:11 -0800
commit7eb179be18af2d693e087770f0d960092b83e8ab (patch)
tree18b1239ca879c9c09af648545c9bbd0b3b862254
parentdd899641eeca595de07c0ae4a8021fa1ca2a9703 (diff)
ZTS: /dev/null: accept no substitutes
Instead of writing to "devnull" and rming it later, just > /dev/null to not have to cleanup later. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Paul Dagnelie <[email protected]> Co-authored-by: Rich Ercolani <[email protected]> Signed-off-by: Ahelenia ZiemiaƄska <[email protected]> Closes #13133
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send-b.ksh10
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_003_pos.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_004_neg.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_005_pos.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted.ksh10
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted_unloaded.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_raw.ksh14
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_skip_missing.ksh5
-rwxr-xr-xtests/zfs-tests/tests/functional/deadman/deadman_ratelimit.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh8
-rwxr-xr-xtests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/removal/removal_with_send.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/rsend/rsend_016_neg.ksh11
-rwxr-xr-xtests/zfs-tests/tests/functional/rsend/send_invalid.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/rsend/send_partial_dataset.ksh2
15 files changed, 34 insertions, 42 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send-b.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send-b.ksh
index f019c2215..7e841c10c 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send-b.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send-b.ksh
@@ -58,13 +58,13 @@ log_must zfs set "org.openzfs:snapprop=val" "$SENDFS@s1"
# 2. Verify command line options interact with '-b' correctly
typeset opts=("" "p" "Rp" "cew" "nv" "D" "DLPRcenpvw")
for opt in ${opts[@]}; do
- log_must eval "zfs send -b$opt $SENDFS@s1 >$TEST_BASE_DIR/devnull"
- log_must eval "zfs send -b$opt -i $SENDFS@s1 $SENDFS@s2 >$TEST_BASE_DIR/devnull"
- log_must eval "zfs send -b$opt -I $SENDFS@s1 $SENDFS@s2 >$TEST_BASE_DIR/devnull"
+ log_must eval "zfs send -b$opt $SENDFS@s1 > /dev/null"
+ log_must eval "zfs send -b$opt -i $SENDFS@s1 $SENDFS@s2 > /dev/null"
+ log_must eval "zfs send -b$opt -I $SENDFS@s1 $SENDFS@s2 > /dev/null"
done
for opt in ${opts[@]}; do
- log_mustnot eval "zfs send -b$opt $SENDFS >$TEST_BASE_DIR/devnull"
- log_mustnot eval "zfs send -b$opt $SENDFS#bm >$TEST_BASE_DIR/devnull"
+ log_mustnot eval "zfs send -b$opt $SENDFS > /dev/null"
+ log_mustnot eval "zfs send -b$opt $SENDFS#bm > /dev/null"
done
# Do 3..6 in a loop to verify various combination of "zfs send" options
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_003_pos.ksh
index caa84886f..b04c9d3b2 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_003_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_003_pos.ksh
@@ -61,7 +61,7 @@ log_must zfs snapshot $snap2
typeset -i i=0
while (( i < ${#args[*]} )); do
- log_must eval "zfs send -i ${args[i]} >$TEST_BASE_DIR/devnull"
+ log_must eval "zfs send -i ${args[i]} > /dev/null"
(( i += 1 ))
done
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_004_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_004_neg.ksh
index af10e3a11..66a3da69f 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_004_neg.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_004_neg.ksh
@@ -95,7 +95,7 @@ log_must zfs snapshot $snap3
typeset -i i=0
while (( i < ${#badargs[*]} ))
do
- log_mustnot eval "zfs send ${badargs[i]} >$TEST_BASE_DIR/devnull"
+ log_mustnot eval "zfs send ${badargs[i]} > /dev/null"
(( i = i + 1 ))
done
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_005_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_005_pos.ksh
index c4ab7a621..de8b28534 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_005_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_005_pos.ksh
@@ -61,6 +61,6 @@ log_must zfs snapshot -r $TESTPOOL@snap
log_must zpool export $TESTPOOL
log_must zpool import -o readonly=on $TESTPOOL
-log_must eval "zfs send -R $TESTPOOL@snap >$TEST_BASE_DIR/devnull"
+log_must eval "zfs send -R $TESTPOOL@snap > /dev/null"
log_pass "'zfs send -R' can send from read-only pools"
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted.ksh
index a4c332d47..b0f10028f 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted.ksh
@@ -62,15 +62,15 @@ log_must eval "echo $passphrase1 | zfs create -o encryption=on" \
log_must zfs snapshot -r $snap
-log_must eval "zfs send $snap >$TEST_BASE_DIR/devnull"
-log_mustnot eval "zfs send -p $snap >$TEST_BASE_DIR/devnull"
-log_mustnot eval "zfs send -R $snap >$TEST_BASE_DIR/devnull"
+log_must eval "zfs send $snap > /dev/null"
+log_mustnot eval "zfs send -p $snap > /dev/null"
+log_mustnot eval "zfs send -R $snap > /dev/null"
log_must zfs unmount $TESTPOOL/$TESTFS1
log_must zfs unload-key $TESTPOOL/$TESTFS1
-log_mustnot eval "zfs send $snap >$TEST_BASE_DIR/devnull"
-log_must eval "zfs send $TESTPOOL/$TESTFS1/child@snap >$TEST_BASE_DIR/devnull"
+log_mustnot eval "zfs send $snap > /dev/null"
+log_must eval "zfs send $TESTPOOL/$TESTFS1/child@snap > /dev/null"
log_pass "ZFS performs unencrypted sends of encrypted datasets, unless the" \
"'-p' or '-R' options are specified"
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted_unloaded.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted_unloaded.ksh
index f268f7b38..bf9a2be8d 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted_unloaded.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_encrypted_unloaded.ksh
@@ -53,7 +53,7 @@ log_must eval "echo $passphrase | zfs create -o encryption=on" \
log_must zfs snapshot $snap
log_must zfs unmount $TESTPOOL/$TESTFS1
log_must zfs unload-key $TESTPOOL/$TESTFS1
-log_mustnot eval "zfs send $snap >$TEST_BASE_DIR/devnull"
+log_mustnot eval "zfs send $snap > /dev/null"
log_pass "ZFS does not perform unencrypted sends from encrypted datasets" \
"with unloaded keys."
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_raw.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_raw.ksh
index 03c2e7867..b221d8280 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_raw.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_raw.ksh
@@ -57,21 +57,21 @@ log_must eval "echo $passphrase | zfs create -o encryption=on" \
log_must zfs snapshot $snap
log_must zfs snapshot $snap1
-log_must eval "zfs send -w $snap >$TEST_BASE_DIR/devnull"
-log_must eval "zfs send -w $snap1 >$TEST_BASE_DIR/devnull"
+log_must eval "zfs send -w $snap > /dev/null"
+log_must eval "zfs send -w $snap1 > /dev/null"
log_note "Verify ZFS can perform raw sends with properties"
-log_must eval "zfs send -wp $snap >$TEST_BASE_DIR/devnull"
-log_must eval "zfs send -wp $snap1 >$TEST_BASE_DIR/devnull"
+log_must eval "zfs send -wp $snap > /dev/null"
+log_must eval "zfs send -wp $snap1 > /dev/null"
log_note "Verify ZFS can perform raw replication sends"
-log_must eval "zfs send -wR $snap >$TEST_BASE_DIR/devnull"
-log_must eval "zfs send -wR $snap1 >$TEST_BASE_DIR/devnull"
+log_must eval "zfs send -wR $snap > /dev/null"
+log_must eval "zfs send -wR $snap1 > /dev/null"
log_note "Verify ZFS can perform a raw send of an encrypted datasets with" \
"its key unloaded"
log_must zfs unmount $TESTPOOL/$TESTFS1
log_must zfs unload-key $TESTPOOL/$TESTFS1
-log_must eval "zfs send -w $snap1 >$TEST_BASE_DIR/devnull"
+log_must eval "zfs send -w $snap1 > /dev/null"
log_pass "ZFS performs raw sends of datasets"
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_skip_missing.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_skip_missing.ksh
index 2e12d2534..17b191a36 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_skip_missing.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_skip_missing.ksh
@@ -49,7 +49,6 @@ function cleanup
datasetexists $PARENT && destroy_dataset $PARENT -rf
[[ -e $WARNF ]] && log_must rm -f $WARNF
- rm -f $TEST_BASE_DIR/devnull
}
log_assert "Verify 'zfs send -Rs' works as expected."
@@ -66,12 +65,12 @@ log_note "Verify 'zfs send -R' fails to generate replication stream"\
log_must zfs create $PARENT
log_must zfs create $CHILD
log_must zfs snapshot $SNAP
-log_mustnot eval "zfs send -R $SNAP >$TEST_BASE_DIR/devnull"
+log_mustnot eval "zfs send -R $SNAP > /dev/null"
log_note "Verify 'zfs send -Rs' warns about missing snapshots, "\
"but still succeeds"
-log_must eval "zfs send -Rs $SNAP 2> $WARNF >$TEST_BASE_DIR/devnull"
+log_must eval "zfs send -Rs $SNAP 2> $WARNF > /dev/null"
log_must eval "[[ -s $WARNF ]]"
log_pass "Verify 'zfs send -Rs' works as expected."
diff --git a/tests/zfs-tests/tests/functional/deadman/deadman_ratelimit.ksh b/tests/zfs-tests/tests/functional/deadman/deadman_ratelimit.ksh
index 469117a56..7c8fb08b7 100755
--- a/tests/zfs-tests/tests/functional/deadman/deadman_ratelimit.ksh
+++ b/tests/zfs-tests/tests/functional/deadman/deadman_ratelimit.ksh
@@ -64,7 +64,7 @@ log_must file_write -b 1048576 -c 8 -o create -d 0 -f $mntpnt/file
log_must zpool export $TESTPOOL
log_must zpool import $TESTPOOL
log_must zinject -d $DISK1 -D 5:1 $TESTPOOL
-log_must dd if=$mntpnt/file of=$TEST_BASE_DIR/devnull oflag=sync
+log_must dd if=$mntpnt/file of=/dev/null oflag=sync
events=$(zpool events $TESTPOOL | grep -c ereport.fs.zfs.deadman)
log_note "events=$events"
diff --git a/tests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh b/tests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh
index e591cca0b..ea5e08c3c 100755
--- a/tests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh
+++ b/tests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh
@@ -45,11 +45,11 @@ log_must zfs snapshot $clone2@snap
# Incompatible flags
log_must zfs redact $sendfs@snap2 book $clone1@snap
-log_mustnot eval "zfs send -R --redact book $sendfs@snap2 >$TEST_BASE_DIR/devnull"
+log_mustnot eval "zfs send -R --redact book $sendfs@snap2 > /dev/null"
typeset arg
for arg in "$sendfs" "$clone1#book"; do
- log_mustnot eval "zfs send --redact book $arg >$TEST_BASE_DIR/devnull"
+ log_mustnot eval "zfs send --redact book $arg > /dev/null"
done
# Bad redaction list arguments
@@ -58,7 +58,7 @@ log_mustnot zfs redact $sendfs@snap1 book
log_mustnot zfs redact $sendfs#book1 book4 $clone1
log_mustnot zfs redact $sendfs@snap1 book snap2 snap3
log_mustnot zfs redact $sendfs@snap1 book @snap2 @snap3
-log_mustnot eval "zfs send --redact $sendfs#book $sendfs@snap >$TEST_BASE_DIR/devnull"
+log_mustnot eval "zfs send --redact $sendfs#book $sendfs@snap > /dev/null"
# Redaction snapshots not a descendant of tosnap
log_mustnot zfs redact $sendfs@snap2 book $sendfs@snap2
@@ -66,7 +66,7 @@ log_must zfs redact $sendfs@snap2 book2 $clone1@snap $clone2@snap
log_must eval "zfs send --redact book2 $sendfs@snap2 >$stream"
log_must zfs redact $sendfs@snap2 book3 $clone1@snap $clone2@snap
log_must eval "zfs send -i $sendfs@snap1 --redact book3 $sendfs@snap2 \
- >$TEST_BASE_DIR/devnull"
+ > /dev/null"
log_mustnot zfs redact $sendfs@snap3 $sendfs@snap3 $clone1@snap
# Full redacted sends of redacted datasets are not allowed.
diff --git a/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh b/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh
index 4ab04a0e5..8118ea59e 100755
--- a/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh
+++ b/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh
@@ -81,7 +81,7 @@ log_must eval "zfs send --redact book1 $sendfs@snap >$stream"
dd if=$stream bs=64k count=1 | log_mustnot zfs receive -s $recvfs
[[ "-" = $(get_prop receive_resume_token $recvfs) ]] && \
log_fail "Receive token not found."
-log_mustnot eval "zfs send --saved --redact book1 $recvfs >$TEST_BASE_DIR/devnull"
+log_mustnot eval "zfs send --saved --redact book1 $recvfs > /dev/null"
log_must zfs recv -A $recvfs
log_must datasetnonexists $recvfs
diff --git a/tests/zfs-tests/tests/functional/removal/removal_with_send.ksh b/tests/zfs-tests/tests/functional/removal/removal_with_send.ksh
index a08247838..735578104 100755
--- a/tests/zfs-tests/tests/functional/removal/removal_with_send.ksh
+++ b/tests/zfs-tests/tests/functional/removal/removal_with_send.ksh
@@ -28,7 +28,7 @@ function callback
{
create_snapshot $TESTPOOL/$TESTFS $TESTSNAP
log_must ksh -c \
- "zfs send $TESTPOOL/$TESTFS@$TESTSNAP >$TEST_BASE_DIR/devnull"
+ "zfs send $TESTPOOL/$TESTFS@$TESTSNAP > /dev/null"
return 0
}
diff --git a/tests/zfs-tests/tests/functional/rsend/rsend_016_neg.ksh b/tests/zfs-tests/tests/functional/rsend/rsend_016_neg.ksh
index 26573bfb5..2741cd20a 100755
--- a/tests/zfs-tests/tests/functional/rsend/rsend_016_neg.ksh
+++ b/tests/zfs-tests/tests/functional/rsend/rsend_016_neg.ksh
@@ -30,16 +30,9 @@
verify_runnable "both"
-function cleanup
-{
- rm -f $TEST_BASE_DIR/devnull
-}
-
-log_onexit cleanup
-
-log_mustnot eval "zfs send -i \#bla $POOl/$FS@final > $TEST_BASE_DIR/devnull"
+log_mustnot eval "zfs send -i \#bla $POOl/$FS@final > /dev/null"
log_must eval "zfs send -R -i snapA $POOL/vol@snapA 2>&1 " \
- "> $TEST_BASE_DIR/devnull | grep -q WARNING"
+ "> /dev/null | grep -q WARNING"
log_pass "Ensure that error conditions cause appropriate failures."
diff --git a/tests/zfs-tests/tests/functional/rsend/send_invalid.ksh b/tests/zfs-tests/tests/functional/rsend/send_invalid.ksh
index 2ce7ee4a0..ab3b1d73f 100755
--- a/tests/zfs-tests/tests/functional/rsend/send_invalid.ksh
+++ b/tests/zfs-tests/tests/functional/rsend/send_invalid.ksh
@@ -44,7 +44,7 @@ log_must zfs snap $testfs@snap0
log_must zfs snap $testfs@snap1
# Test bad send with the CLI
-log_mustnot eval "zfs send -i $testfs@snap1 $testfs@snap0 >$TEST_BASE_DIR/devnull"
+log_mustnot eval "zfs send -i $testfs@snap1 $testfs@snap0 > /dev/null"
# Test bad send with libzfs/libzfs_core
log_must badsend $testfs@snap0 $testfs@snap1
diff --git a/tests/zfs-tests/tests/functional/rsend/send_partial_dataset.ksh b/tests/zfs-tests/tests/functional/rsend/send_partial_dataset.ksh
index f2e54c8c1..c36b0c7c3 100755
--- a/tests/zfs-tests/tests/functional/rsend/send_partial_dataset.ksh
+++ b/tests/zfs-tests/tests/functional/rsend/send_partial_dataset.ksh
@@ -103,7 +103,7 @@ set -A badargs \
while (( i < ${#badargs[*]} ))
do
- log_mustnot eval "zfs send --saved ${badargs[i]} >$TEST_BASE_DIR/devnull"
+ log_mustnot eval "zfs send --saved ${badargs[i]} > /dev/null"
(( i = i + 1 ))
done