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 f019c2215ecd..7e841c10ceac 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 @@ -1,102 +1,102 @@ #!/bin/ksh -p # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright 2018, loli10K . All rights reserved. # . $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib # # DESCRIPTION: # 'zfs send -b' should works as expected. # # STRATEGY: # 1. Create a source dataset and set some properties # 2. Verify command line options interact with '-b' correctly # 3. Send the dataset and its properties to a new "backup" destination # 4. Set some properties on the new "backup" dataset # 5. Restore the "backup" dataset to a new destination # 6. Verify only original (received) properties are sent from "backup" # verify_runnable "both" function cleanup { for ds in "$SENDFS" "$BACKUP" "$RESTORE"; do datasetexists $ds && destroy_dataset $ds -r done } log_assert "'zfs send -b' should work as expected." log_onexit cleanup SENDFS="$TESTPOOL/sendfs" BACKUP="$TESTPOOL/backup" RESTORE="$TESTPOOL/restore" # 1. Create a source dataset and set some properties log_must zfs create $SENDFS log_must zfs snapshot "$SENDFS@s1" log_must zfs bookmark "$SENDFS@s1" "$SENDFS#bm" log_must zfs snapshot "$SENDFS@s2" log_must zfs set "compression=gzip" $SENDFS log_must zfs set "org.openzfs:prop=val" $SENDFS 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 typeset opts=("" "p" "R" "pR" "cew") for opt in ${opts[@]}; do # 3. Send the dataset and its properties to a new "backup" destination # NOTE: only need to send properties (-p) here log_must eval "zfs send -p $SENDFS@s1 | zfs recv $BACKUP" # 4. Set some properties on the new "backup" dataset # NOTE: override "received" values and set some new properties as well log_must zfs set "compression=lz4" $BACKUP log_must zfs set "exec=off" $BACKUP log_must zfs set "org.openzfs:prop=newval" $BACKUP log_must zfs set "org.openzfs:newprop=newval" $BACKUP log_must zfs set "org.openzfs:snapprop=newval" "$BACKUP@s1" log_must zfs set "org.openzfs:newsnapprop=newval" "$BACKUP@s1" # 5. Restore the "backup" dataset to a new destination log_must eval "zfs send -b$opt $BACKUP@s1 | zfs recv $RESTORE" # 6. Verify only original (received) properties are sent from "backup" log_must eval "check_prop_source $RESTORE compression gzip received" log_must eval "check_prop_source $RESTORE org.openzfs:prop val received" log_must eval "check_prop_source $RESTORE@s1 org.openzfs:snapprop val received" log_must eval "check_prop_source $RESTORE exec on default" log_must eval "check_prop_missing $RESTORE org.openzfs:newprop" log_must eval "check_prop_missing $RESTORE@s1 org.openzfs:newsnapprop" # cleanup log_must zfs destroy -r $BACKUP log_must zfs destroy -r $RESTORE done log_pass "'zfs send -b' works as expected." 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 caa84886fa12..b04c9d3b240c 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 @@ -1,69 +1,69 @@ #!/bin/ksh -p # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # Copyright (c) 2016 by Delphix. All rights reserved. # . $STF_SUITE/include/libtest.shlib # # DESCRIPTION: # 'zfs send -i' can deal with abbreviated snapshot name. # # STRATEGY: # 1. Create pool, fs and two snapshots. # 2. Make sure 'zfs send -i' support abbreviated snapshot name. # verify_runnable "both" function cleanup { datasetexists $snap1 && destroy_dataset $snap1 datasetexists $snap2 && destroy_dataset $snap2 } log_assert "'zfs send -i' can deal with abbreviated snapshot name." log_onexit cleanup snap1=$TESTPOOL/$TESTFS@snap1; snap2=$TESTPOOL/$TESTFS@snap2 set -A args "$snap1 $snap2" \ "${snap1##*@} $snap2" "@${snap1##*@} $snap2" log_must zfs snapshot $snap1 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 log_pass "'zfs send -i' deal with abbreviated snapshot name passed." 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 af10e3a11faf..66a3da69f74b 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 @@ -1,108 +1,108 @@ #!/bin/ksh -p # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # Copyright (c) 2016 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/cli_root/cli_common.kshlib # # DESCRIPTION: # Verify 'zfs send' fails with malformed parameters. # # STRATEGY: # 1. Define malformed parameters in array # 2. Feed the parameters to 'zfs send' # 3. Verify the result # verify_runnable "both" function cleanup { typeset snap f for snap in $snap1 $snap2 $snap3; do snapexists $snap && destroy_dataset $snap -f done for f in $tmpfile1 $tmpfile2; do if [[ -e $f ]]; then rm -f $f fi done } fs=$TESTPOOL/$TESTFS snap1=$fs@snap1 snap2=$fs@snap2 snap3=$fs@snap3 set -A badargs \ "" "$TESTPOOL" "$TESTFS" "$fs" "$fs@nonexistent_snap" "?" \ "$snap1/blah" "$snap1@blah" "-i" "-x" "-i $fs" \ "-x $snap1 $snap2" "-i $snap1" \ "-i $snap2 $snap1" "$snap1 $snap2" "-i $snap1 $snap2 $snap3" \ "-ii $snap1 $snap2" "-iii $snap1 $snap2" " -i $snap2 $snap1/blah" \ "-i $snap2/blah $snap1" \ "-i $snap2/blah $snap1/blah" \ "-i $snap1 blah@blah" \ "-i blah@blah $snap1" \ "-i $snap1 ${snap2##*@}" "-i $snap1 @${snap2##*@}" \ "-i ${snap1##*@} ${snap2##*@}" "-i @${snap1##*@} @${snap2##*@}" \ "-i ${snap1##*@} $snap2/blah" "-i @${snap1##*@} $snap2/blah" \ "-i @@${snap1##*@} $snap2" "-i $snap1 -i $snap1 $snap2" \ "-i snap1 snap2" "-i $snap1 snap2" \ "-i $snap1 $snap2 -i $snap1 $snap2" \ "-i snap1 $snap2 -i snap1 $snap2" log_assert "Verify that invalid parameters to 'zfs send' are caught." log_onexit cleanup log_must zfs snapshot $snap1 tmpfile1=$TESTDIR/testfile1.$$ log_must touch $tmpfile1 log_must zfs snapshot $snap2 tmpfile2=$TESTDIR/testfile2.$$ log_must touch $tmpfile2 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 #Testing zfs send fails by send backup stream to terminal for arg in "$snap1" "-i $snap1 $snap2"; do log_mustnot eval "zfs send $arg >/dev/console" done log_pass "Invalid parameters to 'zfs send' are caught as expected." 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 c4ab7a6212bc..de8b28534fe1 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 @@ -1,66 +1,66 @@ #!/bin/ksh -p # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # Copyright (c) 2012, 2016 by Delphix. All rights reserved. # . $STF_SUITE/include/libtest.shlib # # DESCRIPTION: # 'zfs send -R' can send from read-only imported pool. It needs to # detect that the pool is read-only and not try to place holds on # datasets being sent. # # STRATEGY: # 1. Create a recursive snapshot on the whole pool. # 2. 'zfs send -R' the recursive snapshots. # verify_runnable "both" function cleanup { poolexists $TESTPOOL && log_must_busy zpool export $TESTPOOL log_must zpool import $TESTPOOL datasetexists $TESTPOOL@snap && \ destroy_dataset $TESTPOOL@snap -r } log_assert "'zfs send -R' can send from read-only pools" log_onexit cleanup 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 a4c332d47dfc..b0f10028f472 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 @@ -1,76 +1,76 @@ #!/bin/ksh -p # # CDDL HEADER START # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # CDDL HEADER END # # # Copyright (c) 2017, Datto, Inc. All rights reserved. # . $STF_SUITE/include/libtest.shlib # # DESCRIPTION: # ZFS should perform unencrypted sends of encrypted datasets, unless the '-p' # or '-R' options are specified. # # STRATEGY: # 1. Create an encrypted dataset # 6. Create a child encryption root # 2. Snapshot the dataset # 3. Attempt a send # 4. Attempt a send with properties # 5. Attempt a replication send # 7. Unmount the parent and unload its key # 8. Attempt a send of the parent dataset # 9. Attempt a send of the child encryption root # verify_runnable "both" function cleanup { datasetexists $TESTPOOL/$TESTFS1 && \ destroy_dataset $TESTPOOL/$TESTFS1 -r } log_onexit cleanup log_assert "ZFS should perform unencrypted sends of encrypted datasets, " \ "unless the '-p' or '-R' options are specified" typeset passphrase="password" typeset passphrase1="password1" typeset snap="$TESTPOOL/$TESTFS1@snap" log_must eval "echo $passphrase | zfs create -o encryption=on" \ "-o keyformat=passphrase $TESTPOOL/$TESTFS1" log_must eval "echo $passphrase1 | zfs create -o encryption=on" \ "-o keyformat=passphrase $TESTPOOL/$TESTFS1/child" 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 f268f7b38d4d..bf9a2be8db53 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 @@ -1,59 +1,59 @@ #!/bin/ksh -p # # CDDL HEADER START # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # CDDL HEADER END # # # Copyright (c) 2017, Datto, Inc. All rights reserved. # . $STF_SUITE/include/libtest.shlib # # DESCRIPTION: # ZFS should not perform unencrypted sends from encrypted datasets # with unloaded keys. # # STRATEGY: # 1. Create an encrypted dataset # 2. Snapshot the dataset # 3. Unload the dataset key # 4. Verify sending the stream fails # verify_runnable "both" function cleanup { datasetexists $TESTPOOL/$TESTFS1 && \ destroy_dataset $TESTPOOL/$TESTFS1 -r } log_onexit cleanup log_assert "ZFS should not perform unencrypted sends from encrypted datasets" \ "with unloaded keys." typeset passphrase="password" typeset snap="$TESTPOOL/$TESTFS1@snap" log_must eval "echo $passphrase | zfs create -o encryption=on" \ "-o keyformat=passphrase $TESTPOOL/$TESTFS1" 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 03c2e78673d8..b221d8280df2 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 @@ -1,77 +1,77 @@ #!/bin/ksh -p # # CDDL HEADER START # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # CDDL HEADER END # # # Copyright (c) 2017, Datto, Inc. All rights reserved. # . $STF_SUITE/include/libtest.shlib # # DESCRIPTION: # ZFS should perform raw sends of datasets. # # STRATEGY: # 1. Create an encrypted dataset # 2. Snapshot the default dataset and the encrypted dataset # 3. Attempt a raw send of both datasets # 4. Attempt a raw send with properties of both datasets # 5. Attempt a raw replication send of both datasets # 6. Unmount and unload the encrypted dataset key # 7. Attempt a raw send of the encrypted dataset # verify_runnable "both" function cleanup { snapexists $snap && destroy_dataset $snap datasetexists $TESTPOOL/$TESTFS1 && \ destroy_dataset $TESTPOOL/$TESTFS1 -r } log_onexit cleanup log_assert "ZFS should perform raw sends of datasets" typeset passphrase="password" typeset snap="$TESTPOOL/$TESTFS@snap" typeset snap1="$TESTPOOL/$TESTFS1@snap" log_must eval "echo $passphrase | zfs create -o encryption=on" \ "-o keyformat=passphrase $TESTPOOL/$TESTFS1" 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 2e12d2534412..17b191a36173 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 @@ -1,77 +1,76 @@ #!/bin/ksh -p # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2016, loli10K. All rights reserved. # Copyright (c) 2021, Pablo Correa Gómez. All rights reserved. # . $STF_SUITE/tests/functional/cli_root/cli_common.kshlib . $STF_SUITE/tests/functional/cli_root/zfs_send/zfs_send.cfg # # DESCRIPTION: # Verify 'zfs send' will avoid sending replication send # streams when we're missing snapshots in the dataset # hierarchy, unless -s|--skip-missing provided # # STRATEGY: # 1. Create a parent and child fs and then only snapshot the parent # 2. Verify sending with replication will fail # 3. Verify sending with skip-missing will print a warning but succeed # verify_runnable "both" function cleanup { snapexists $SNAP && destroy_dataset $SNAP -f 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." log_onexit cleanup PARENT=$TESTPOOL/parent CHILD=$PARENT/child SNAP=$PARENT@snap WARNF=$TEST_BASE_DIR/warn.2 log_note "Verify 'zfs send -R' fails to generate replication stream"\ " for datasets created before" 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 469117a56cc0..7c8fb08b7e01 100755 --- a/tests/zfs-tests/tests/functional/deadman/deadman_ratelimit.ksh +++ b/tests/zfs-tests/tests/functional/deadman/deadman_ratelimit.ksh @@ -1,78 +1,78 @@ #!/bin/ksh -p # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Portions Copyright 2021 iXsystems, Inc. # # DESCRIPTION: # Verify spa deadman events are rate limited # # STRATEGY: # 1. Reduce the zfs_slow_io_events_per_second to 1. # 2. Reduce the zfs_deadman_ziotime_ms to 1ms. # 3. Write data to a pool and read it back. # 4. Verify deadman events have been produced at a reasonable rate. # . $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/deadman/deadman.cfg verify_runnable "both" function cleanup { zinject -c all default_cleanup_noexit set_tunable64 SLOW_IO_EVENTS_PER_SECOND $OLD_SLOW_IO_EVENTS set_tunable64 DEADMAN_ZIOTIME_MS $ZIOTIME_DEFAULT } log_assert "Verify spa deadman events are rate limited" log_onexit cleanup OLD_SLOW_IO_EVENTS=$(get_tunable SLOW_IO_EVENTS_PER_SECOND) log_must set_tunable64 SLOW_IO_EVENTS_PER_SECOND 1 log_must set_tunable64 DEADMAN_ZIOTIME_MS 1 # Create a new pool in order to use the updated deadman settings. default_setup_noexit $DISK1 log_must zpool events -c mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS) 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" if [ "$events" -lt 1 ]; then log_fail "Expect >= 1 deadman events, $events found" fi if [ "$events" -gt 10 ]; then log_fail "Expect <= 10 deadman events, $events found" fi log_pass "Verify spa deadman events are rate limited" 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 e591cca0bbde..ea5e08c3cb86 100755 --- a/tests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh +++ b/tests/zfs-tests/tests/functional/redacted_send/redacted_negative.ksh @@ -1,94 +1,94 @@ #!/bin/ksh # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright (c) 2018 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/redacted_send/redacted.kshlib # # Description: # Test that redacted send correctly detects invalid arguments. # typeset sendfs="$POOL2/sendfs" typeset recvfs="$POOL2/recvfs" typeset clone1="$POOL2/clone1" typeset clone2="$POOL2/clone2" typeset clone3="$POOL2/clone3" typeset clone3="$POOL2/clone4" typeset tmpdir="$(get_prop mountpoint $POOL)/tmp" typeset stream=$(mktemp $tmpdir/stream.XXXX) log_onexit redacted_cleanup $sendfs $recvfs $clone3 log_must zfs create $sendfs log_must zfs snapshot $sendfs@snap1 log_must zfs snapshot $sendfs@snap2 log_must zfs snapshot $sendfs@snap3 log_must zfs clone $sendfs@snap2 $clone1 log_must zfs snapshot $clone1@snap log_must zfs bookmark $clone1@snap $clone1#book log_must zfs clone $sendfs@snap2 $clone2 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 log_mustnot zfs redact $sendfs@snap1 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 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. log_must eval "zfs recv $recvfs <$stream" log_must zfs snapshot $recvfs@snap log_must zfs clone $recvfs@snap $clone3 log_must zfs snapshot $clone3@snap log_mustnot zfs redact $recvfs@snap book5 $clone3@snap # Nor may a redacted dataset appear in the redaction list. log_mustnot zfs redact testpool2/recvfs@snap2 book7 testpool2/recvfs@snap # Non-redaction bookmark cannot be sent and produces invalid argument error log_must zfs bookmark "$sendfs@snap1" "$sendfs#book8" log_must eval "zfs send --redact book8 -i $sendfs@snap1 $sendfs@snap2 2>&1 | head -n 100 | grep 'not a redaction bookmark'" # Error messages for common usage errors log_mustnot_expect "not contain '#'" zfs redact $sendfs@snap1 \#book $sendfs@snap2 log_mustnot_expect "not contain '#'" zfs redact $sendfs@snap1 $sendfs#book $sendfs@snap2 log_mustnot_expect "full dataset names" zfs redact $sendfs@snap1 book @snap2 log_mustnot_expect "full dataset names" zfs redact $sendfs@snap1 book @snap2 log_mustnot_expect "full dataset names" zfs redact $sendfs@snap1 \#book @snap2 log_mustnot_expect "descendent of snapshot" zfs redact $sendfs@snap2 book $sendfs@snap1 log_pass "Verify that redacted send correctly detects invalid arguments." 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 4ab04a0e5730..8118ea59ec8b 100755 --- a/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh +++ b/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh @@ -1,88 +1,88 @@ #!/bin/ksh # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright (c) 2018 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/redacted_send/redacted.kshlib # # Description: # Verify that resumable send works correctly with redacted streams. # # Strategy: # 1. Do a full redacted resumable send. # 2. Verify the received contents are correct. # 3. Do an incremental redacted resumable send. # 4. Verify the received contents are correct. # 5. Verify that recv -A removes a partially received dataset. # typeset ds_name="resume" typeset sendfs="$POOL/$ds_name" typeset recvfs="$POOL2/$ds_name" typeset clone="$POOL/${ds_name}_clone" typeset clone1="$POOL/${ds_name}_clone1" typeset tmpdir="$(get_prop mountpoint $POOL)/tmp" typeset stream=$(mktemp $tmpdir/stream.XXXX) setup_dataset $ds_name '' typeset clone_mnt="$(get_prop mountpoint $clone)" typeset send_mnt="$(get_prop mountpoint $sendfs)" typeset recv_mnt="/$POOL2/$ds_name" log_onexit redacted_cleanup $sendfs $recvfs log_must stride_dd -i /dev/urandom -o $clone_mnt/f2 -b 512 -c 64 -s 512 log_must zfs snapshot $clone@snap1 # Do the full resumable send log_must zfs redact $sendfs@snap book1 $clone@snap1 resume_test "zfs send --redact book1 $sendfs@snap" $tmpdir $recvfs log_must mount_redacted -f $recvfs log_must set_tunable32 ALLOW_REDACTED_DATASET_MOUNT 1 log_must diff $send_mnt/f1 $recv_mnt/f1 log_must eval "get_diff $send_mnt/f2 $recv_mnt/f2 >$tmpdir/get_diff.out" typeset range=$(cat $tmpdir/get_diff.out) [[ "$RANGE9" = "$range" ]] || log_fail "Unexpected range: $range" log_must dd if=/dev/urandom of=$send_mnt/f3 bs=1024k count=3 log_must zfs snapshot $sendfs@snap2 log_must zfs clone $sendfs@snap2 $clone1 typeset clone1_mnt="$(get_prop mountpoint $clone1)" log_must dd if=/dev/urandom of=$clone1_mnt/f3 bs=128k count=3 conv=notrunc log_must zfs snapshot $clone1@snap # Do the incremental resumable send log_must zfs redact $sendfs@snap2 book2 $clone1@snap resume_test "zfs send --redact book2 -i $sendfs#book1 $sendfs@snap2" \ $tmpdir $recvfs log_must diff $send_mnt/f1 $recv_mnt/f1 log_must diff $send_mnt/f2 $recv_mnt/f2 log_must eval "get_diff $send_mnt/f3 $recv_mnt/f3 >$tmpdir/get_diff.out" range=$(cat $tmpdir/get_diff.out) [[ "$RANGE10" = "$range" ]] || log_fail "Unexpected range: $range" # Test recv -A works properly and verify saved sends are not allowed log_mustnot zfs recv -A $recvfs log_must zfs destroy -R $recvfs log_mustnot zfs recv -A $recvfs 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 log_pass "Resumable send works correctly with redacted streams." 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 a08247838105..735578104740 100755 --- a/tests/zfs-tests/tests/functional/removal/removal_with_send.ksh +++ b/tests/zfs-tests/tests/functional/removal/removal_with_send.ksh @@ -1,37 +1,37 @@ #! /bin/ksh -p # # CDDL HEADER START # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # CDDL HEADER END # # # Copyright (c) 2014, 2017 by Delphix. All rights reserved. # . $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/removal/removal.kshlib default_setup_noexit "$DISKS" log_onexit default_cleanup_noexit 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 } test_removal_with_operation callback log_pass "Can use send during removal" 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 26573bfb594d..2741cd20ae0a 100755 --- a/tests/zfs-tests/tests/functional/rsend/rsend_016_neg.ksh +++ b/tests/zfs-tests/tests/functional/rsend/rsend_016_neg.ksh @@ -1,45 +1,38 @@ #!/bin/ksh # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright (c) 2014, 2018 by Delphix. All rights reserved. # . $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/rsend/rsend.kshlib # # Description: # Verify that error conditions don't cause panics in zfs send # # Strategy: # 1. Perform a zfs incremental send from a bookmark that doesn't exist # 2. Perform a zfs incremental replication send with incremental source # same as target (#11121) # 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 2ce7ee4a082f..ab3b1d73f850 100755 --- a/tests/zfs-tests/tests/functional/rsend/send_invalid.ksh +++ b/tests/zfs-tests/tests/functional/rsend/send_invalid.ksh @@ -1,52 +1,52 @@ #!/bin/ksh # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version a.0. # You may only use this file in accordance with the terms of version # a.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Portions Copyright 2020 iXsystems, Inc. # . $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/rsend/rsend.kshlib # # Description: # Verify that send with invalid options will fail gracefully. # # Strategy: # 1. Perform zfs send on the cli with the order of the snapshots reversed # 2. Perform zfs send using libzfs with the order of the snapshots reversed # verify_runnable "both" log_assert "Verify that send with invalid options will fail gracefully." function cleanup { datasetexists $testfs && destroy_dataset $testfs -r } log_onexit cleanup testfs=$POOL/fs log_must zfs create $testfs 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 log_pass "Send with invalid options fails gracefully." 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 f2e54c8c19cc..c36b0c7c3ece 100755 --- a/tests/zfs-tests/tests/functional/rsend/send_partial_dataset.ksh +++ b/tests/zfs-tests/tests/functional/rsend/send_partial_dataset.ksh @@ -1,110 +1,110 @@ #!/bin/ksh # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version a.0. # You may only use this file in accordance with the terms of version # a.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright (c) 2019 Datto Inc. # Copyright (c) 2020 by Delphix. All rights reserved. # . $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/rsend/rsend.kshlib # # Description: # Verify that a partially received dataset can be sent with # 'zfs send --saved'. # # Strategy: # 1. Setup a pool with partially received filesystem # 2. Perform saved send without incremental # 3. Perform saved send with incremental # 4. Perform saved send with incremental, resuming from a token # 5. Perform negative tests for invalid command inputs # verify_runnable "both" log_assert "Verify that a partially received dataset can be sent with " \ "'zfs send --saved'." function cleanup { destroy_dataset $POOL/testfs2 "-r" destroy_dataset $POOL/stream "-r" destroy_dataset $POOL/recvfs "-r" destroy_dataset $POOL/partialfs "-r" } log_onexit cleanup log_must zfs create -o compression=off $POOL/testfs2 log_must zfs create $POOL/stream mntpnt=$(get_prop mountpoint $POOL/testfs2) # Setup a pool with partially received filesystems log_must mkfile 1m $mntpnt/filea log_must zfs snap $POOL/testfs2@a log_must mkfile 1m $mntpnt/fileb log_must zfs snap $POOL/testfs2@b log_must eval "zfs send $POOL/testfs2@a | zfs recv $POOL/recvfs" log_must eval "zfs send -i $POOL/testfs2@a $POOL/testfs2@b > " \ "/$POOL/stream/inc.send" log_must eval "zfs send $POOL/testfs2@b > /$POOL/stream/full.send" mess_send_file /$POOL/stream/full.send mess_send_file /$POOL/stream/inc.send log_mustnot zfs recv -s $POOL/recvfullfs < /$POOL/stream/full.send log_mustnot zfs recv -s $POOL/recvfs < /$POOL/stream/inc.send # Perform saved send without incremental log_mustnot eval "zfs send --saved $POOL/recvfullfs | zfs recv -s " \ "$POOL/partialfs" token=$(zfs get -Hp -o value receive_resume_token $POOL/partialfs) log_must eval "zfs send -t $token | zfs recv -s $POOL/partialfs" file_check $POOL/recvfullfs $POOL/partialfs log_must zfs destroy -r $POOL/partialfs # Perform saved send with incremental log_must eval "zfs send $POOL/recvfs@a | zfs recv $POOL/partialfs" log_mustnot eval "zfs send --saved $POOL/recvfs | " \ "zfs recv -s $POOL/partialfs" token=$(zfs get -Hp -o value receive_resume_token $POOL/partialfs) log_must eval "zfs send -t $token | zfs recv -s $POOL/partialfs" file_check $POOL/recvfs $POOL/partialfs log_must zfs destroy -r $POOL/partialfs # Perform saved send with incremental, resuming from token log_must eval "zfs send $POOL/recvfs@a | zfs recv $POOL/partialfs" log_must eval "zfs send --saved $POOL/recvfs > " \ "/$POOL/stream/partial.send" mess_send_file /$POOL/stream/partial.send log_mustnot zfs recv -s $POOL/partialfs < /$POOL/stream/partial.send token=$(zfs get -Hp -o value receive_resume_token $POOL/partialfs) log_must eval "zfs send -t $token | zfs recv -s $POOL/partialfs" file_check $POOL/recvfs $POOL/partialfs # Perform negative tests for invalid command inputs set -A badargs \ "" \ "$POOL/recvfs@a" \ "-i $POOL/recvfs@a $POOL/recvfs@b" \ "-R $POOL/recvfs" \ "-p $POOL/recvfs" \ "-I $POOL/recvfs" \ "-h $POOL/recvfs" 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 log_pass "A partially received dataset can be sent with 'zfs send --saved'."