diff options
author | Brian Behlendorf <[email protected]> | 2017-04-12 08:47:42 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2017-04-12 08:47:42 -0700 |
commit | dd49132a1d727c7363bbad82f390c06c40d140c6 (patch) | |
tree | e31adbe51a3e81738a75a9d8bb31c72ece175c2c /tests | |
parent | 17b43f96f9cfeb0deef7350cc016a8e28c500867 (diff) |
OpenZFS 7535 - need test for resumed send of top most filesystem
Authored by: John Kennedy <[email protected]>
Reviewed by: George Wilson <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Approved by: Richard Lowe <[email protected]>
Ported-by: Brian Behlendorf <[email protected]>
Porting Notes:
- zfs_share_001_pos.ksh - Older versions of exportfs will match
multiple exports that share a common prefix. Reorder the 'fs'
list so unshares occur from most to least unique.
- zfs_share_005_pos.ksh - Enabled and updated for Linux.
OpenZFS-issue: https://www.illumos.org/issues/7535
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ac89d1e
Closes #5979
Diffstat (limited to 'tests')
15 files changed, 107 insertions, 87 deletions
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index a358b5578..9415edbe0 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -184,11 +184,9 @@ tests = ['cache_001_pos', 'cache_002_neg', 'canmount_001_pos', 'zfs_set_002_neg', 'zfs_set_003_neg', 'property_alias_001_pos', 'mountpoint_003_pos', 'ro_props_001_pos'] -# DISABLED: -# zfs_share_005_pos - needs investigation, probably unsupported NFS share format [tests/functional/cli_root/zfs_share] tests = ['zfs_share_001_pos', 'zfs_share_002_pos', 'zfs_share_003_pos', - 'zfs_share_004_pos', 'zfs_share_006_pos', + 'zfs_share_004_pos', 'zfs_share_005_pos', 'zfs_share_006_pos', 'zfs_share_007_neg', 'zfs_share_008_neg', 'zfs_share_009_neg', 'zfs_share_010_neg', 'zfs_share_011_pos'] diff --git a/tests/zfs-tests/include/default.cfg b/tests/zfs-tests/include/default.cfg index 63104a8b7..83c3ec47c 100644 --- a/tests/zfs-tests/include/default.cfg +++ b/tests/zfs-tests/include/default.cfg @@ -70,23 +70,28 @@ export FIO_SCRIPTS=$STF_SUITE/tests/perf/fio export PERF_SCRIPTS=$STF_SUITE/tests/perf/scripts # some test pool names -export TESTPOOL=testpool.$$ -export TESTPOOL1=testpool1.$$ -export TESTPOOL2=testpool2.$$ -export TESTPOOL3=testpool3.$$ +export TESTPOOL=testpool +export TESTPOOL1=testpool1 +export TESTPOOL2=testpool2 +export TESTPOOL3=testpool3 export PERFPOOL=perfpool # some test file system names -export TESTFS=testfs.$$ -export TESTFS1=testfs1.$$ -export TESTFS2=testfs2.$$ -export TESTFS3=testfs3.$$ +export TESTFS=testfs +export TESTFS1=testfs1 +export TESTFS2=testfs2 +export TESTFS3=testfs3 # some test directory names -export TESTDIR=${TEST_BASE_DIR%%/}/testdir$$ -export TESTDIR0=${TEST_BASE_DIR%%/}/testdir0$$ -export TESTDIR1=${TEST_BASE_DIR%%/}/testdir1$$ -export TESTDIR2=${TEST_BASE_DIR%%/}/testdir2$$ +export TESTDIR=${TEST_BASE_DIR%%/}/testdir +export TESTDIR0=${TEST_BASE_DIR%%/}/testdir0 +export TESTDIR1=${TEST_BASE_DIR%%/}/testdir1 +export TESTDIR2=${TEST_BASE_DIR%%/}/testdir2 + +# some test sub file system names +export TESTSUBFS=subfs +export TESTSUBFS1=subfs1 +export TESTSUBFS2=subfs2 # some temp files export TEMPFILE=${TEST_BASE_DIR%%/}/tempfile$$ @@ -96,23 +101,23 @@ export TEMPFILE2=${TEST_BASE_DIR%%/}/tempfile2$$ export ZFSROOT= -export TESTSNAP=testsnap$$ -export TESTSNAP1=testsnap1$$ -export TESTSNAP2=testsnap2$$ -export TESTCLONE=testclone$$ -export TESTCLONE1=testclone1$$ -export TESTCLONE2=testclone2$$ -export TESTCLCT=testclct$$ -export TESTCTR=testctr$$ -export TESTCTR1=testctr1$$ -export TESTCTR2=testctr2$$ -export TESTVOL=testvol$$ -export TESTVOL1=testvol1$$ -export TESTVOL2=testvol2$$ -export TESTFILE0=testfile0.$$ -export TESTFILE1=testfile1.$$ -export TESTFILE2=testfile2.$$ -export TESTBKMARK=testbkmark$$ +export TESTSNAP=testsnap +export TESTSNAP1=testsnap1 +export TESTSNAP2=testsnap2 +export TESTCLONE=testclone +export TESTCLONE1=testclone1 +export TESTCLONE2=testclone2 +export TESTCLCT=testclct +export TESTCTR=testctr +export TESTCTR1=testctr1 +export TESTCTR2=testctr2 +export TESTVOL=testvol +export TESTVOL1=testvol1 +export TESTVOL2=testvol2 +export TESTFILE0=testfile0 +export TESTFILE1=testfile1 +export TESTFILE2=testfile2 +export TESTBKMARK=testbkmark export LONGPNAME="poolname50charslong_012345678901234567890123456789" export LONGFSNAME="fsysname50charslong_012345678901234567890123456789" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_007_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_007_pos.ksh index 3147a7a14..8d2061b31 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_007_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_007_pos.ksh @@ -42,7 +42,7 @@ function cleanup zfs destroy -rf $TESTPOOL/recvfs rm $streamfile rm $vdev - zpool destroy testpool + zpool destroy tmp_pool } @@ -88,12 +88,11 @@ test_pool () test_pool $TESTPOOL log_must truncate --size=1G $vdev -log_must zpool create -o version=1 testpool $vdev -test_pool testpool -log_must zpool destroy testpool -log_must zpool create -d testpool $vdev -test_pool testpool -log_must zpool destroy testpool - +log_must zpool create -o version=1 tmp_pool $vdev +test_pool tmp_pool +log_must zpool destroy tmp_pool +log_must zpool create -d tmp_pool $vdev +test_pool tmp_pool +log_must zpool destroy tmp_pool log_pass "'zfs send' drills appropriate holes" diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_001_pos.ksh index 7638660e3..a2c06e0b3 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_001_pos.ksh @@ -47,9 +47,9 @@ verify_runnable "global" set -A fs \ - "$TESTDIR" "$TESTPOOL/$TESTFS" \ "$TESTDIR1" "$TESTPOOL/$TESTCTR/$TESTFS1" \ - "$TESTDIR2" "$TESTPOOL/$TESTFS-clone" + "$TESTDIR2" "$TESTPOOL/$TESTFS-clone" \ + "$TESTDIR" "$TESTPOOL/$TESTFS" function cleanup { diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_005_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_005_pos.ksh index 006517d01..013e04ba3 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_005_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_005_pos.ksh @@ -50,12 +50,17 @@ function cleanup log_must unshare_fs $TESTPOOL/$TESTFS } -set -A shareopts \ - "ro" "ro=machine1" "ro=machine1:machine2" \ - "rw" "rw=machine1" "rw=machine1:machine2" \ - "ro=machine1:machine2,rw" "anon=0" "anon=0,sec=sys,rw" \ - "nosuid" "root=machine1:machine2" "rw=.mydomain.mycompany.com" \ - "rw=-terra:engineering" "log" "public" +if is_linux; then + set -A shareopts \ + "ro" "rw" "rw,insecure" "rw,async" "ro,crossmnt" +else + set -A shareopts \ + "ro" "ro=machine1" "ro=machine1:machine2" \ + "rw" "rw=machine1" "rw=machine1:machine2" \ + "ro=machine1:machine2,rw" "anon=0" "anon=0,sec=sys,rw" \ + "nosuid" "root=machine1:machine2" "rw=.mydomain.mycompany.com" \ + "rw=-terra:engineering" "log" "public" +fi log_assert "Verify that NFS share options are propagated correctly." log_onexit cleanup @@ -72,6 +77,11 @@ do log_fail "get sharenfs failed. ($option != ${shareopts[i]})" fi + # Verify the single option after the leading 'ro' or 'rw'. + if is_linux; then + option=`echo "$option" | cut -f2 -d','` + fi + showshares_nfs | grep $option > /dev/null 2>&1 if (( $? != 0 )); then log_fail "The '$option' option was not found in share output." diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh index ea4ea0caf..6d8db3b67 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh @@ -164,10 +164,11 @@ done VDEV_FILE=$(mktemp /tmp/tmp.XXXXXX) log_must mkfile -n 128M $VDEV_FILE -log_must zpool create testpool $VDEV_FILE -log_must zfs create testpool/testfs -ID=$(zpool get -Ho value guid testpool) -log_must zpool export testpool -log_mustnot zpool import $(echo id) $(printf "%*s\n" 250 "" | tr ' ' 'c') +log_must zpool create overflow $VDEV_FILE +log_must zfs create overflow/testfs +ID=$(zpool get -Ho value guid overflow) +log_must zpool export overflow +log_mustnot zpool import -d /tmp $(echo id) \ + $(printf "%*s\n" 250 "" | tr ' ' 'c') log_pass "Successfully imported and renamed a ZPOOL" diff --git a/tests/zfs-tests/tests/functional/rsend/cleanup.ksh b/tests/zfs-tests/tests/functional/rsend/cleanup.ksh index 17a3e09a7..063fe9dd1 100755 --- a/tests/zfs-tests/tests/functional/rsend/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/rsend/cleanup.ksh @@ -36,9 +36,11 @@ verify_runnable "both" if is_global_zone ; then destroy_pool $POOL destroy_pool $POOL2 + poolexists $POOL3 && destroy_pool $POOL3 else cleanup_pool $POOL cleanup_pool $POOL2 + poolexists $POOL3 && cleanup_pool $POOL3 fi log_must rm -rf $BACKDIR $TESTDIR diff --git a/tests/zfs-tests/tests/functional/rsend/rsend.cfg b/tests/zfs-tests/tests/functional/rsend/rsend.cfg index 064a6e7ca..8984ee2a7 100644 --- a/tests/zfs-tests/tests/functional/rsend/rsend.cfg +++ b/tests/zfs-tests/tests/functional/rsend/rsend.cfg @@ -31,7 +31,9 @@ export BACKDIR=${TEST_BASE_DIR%%/}/backdir-rsend export DISK1=${DISKS%% *} export DISK2=$(echo $DISKS | awk '{print $2}') +export DISK3=$(echo $DISKS | awk '{print $3}') export POOL=$TESTPOOL export POOL2=$TESTPOOL1 +export POOL3=$TESTPOOL2 export FS=$TESTFS diff --git a/tests/zfs-tests/tests/functional/rsend/rsend.kshlib b/tests/zfs-tests/tests/functional/rsend/rsend.kshlib index 784d0f75a..ac07dcf90 100644 --- a/tests/zfs-tests/tests/functional/rsend/rsend.kshlib +++ b/tests/zfs-tests/tests/functional/rsend/rsend.kshlib @@ -120,7 +120,7 @@ function cleanup_pool if is_global_zone ; then log_must zfs destroy -Rf $pool else - typeset list=$(zfs list -H -r -t filesystem,snapshot,volume -o name $pool) + typeset list=$(zfs list -H -r -t all -o name $pool) for ds in $list ; do if [[ $ds != $pool ]] ; then if datasetexists $ds ; then @@ -140,12 +140,18 @@ function cleanup_pool log_must zfs mount $pool fi if [[ -d $mntpnt ]]; then - log_must rm -rf $mntpnt/* + rm -rf $mntpnt/* fi return 0 } +function cleanup_pools +{ + cleanup_pool $POOL2 + destroy_pool $POOL3 +} + # # Detect if the given two filesystems have same sub-datasets # @@ -157,8 +163,8 @@ function cmp_ds_subs typeset src_fs=$1 typeset dst_fs=$2 - zfs list -r -H -t filesystem,snapshot,volume -o name $src_fs > $BACKDIR/src1 - zfs list -r -H -t filesystem,snapshot,volume -o name $dst_fs > $BACKDIR/dst1 + zfs list -r -H -t all -o name $src_fs > $BACKDIR/src1 + zfs list -r -H -t all -o name $dst_fs > $BACKDIR/dst1 eval sed -e 's:^$src_fs:PREFIX:g' < $BACKDIR/src1 > $BACKDIR/src eval sed -e 's:^$dst_fs:PREFIX:g' < $BACKDIR/dst1 > $BACKDIR/dst @@ -324,8 +330,7 @@ function getds_with_suffix typeset ds=$1 typeset suffix=$2 - typeset list=$(zfs list -r -H -t filesystem,snapshot,volume -o name $ds \ - | grep "$suffix$") + typeset list=$(zfs list -r -H -t all -o name $ds | grep "$suffix$") echo $list } @@ -487,7 +492,7 @@ function resume_test for ((i=0; i<2; i=i+1)); do mess_file /$streamfs/$stream_num - log_mustnot zfs recv -sv $recvfs </$streamfs/$stream_num + log_mustnot zfs recv -suv $recvfs </$streamfs/$stream_num stream_num=$((stream_num+1)) token=$(zfs get -Hp -o value receive_resume_token $recvfs) @@ -495,31 +500,26 @@ function resume_test [[ -f /$streamfs/$stream_num ]] || \ log_fail "NO FILE /$streamfs/$stream_num" done - log_must zfs recv -sv $recvfs </$streamfs/$stream_num + log_must zfs recv -suv $recvfs </$streamfs/$stream_num } # # Setup filesystems for the resumable send/receive tests # -# $1 The pool to set up with the "send" filesystems -# $2 The pool for receive +# $1 The "send" filesystem +# $2 The "recv" filesystem # function test_fs_setup { - sendpool=$1 - recvpool=$2 + typeset sendfs=$1 + typeset recvfs=$2 + typeset sendpool=${sendfs%%/*} + typeset recvpool=${recvfs%%/*} - sendfs=$sendpool/sendfs - recvfs=$recvpool/recvfs - streamfs=$sendpool/stream + datasetexists $sendfs && log_must zfs destroy -r $sendpool + datasetexists $recvfs && log_must zfs destroy -r $recvpool - if datasetexists $recvfs; then - log_must zfs destroy -r $recvfs - fi - if datasetexists $sendfs; then - log_must zfs destroy -r $sendfs - fi - if $(zfs create -o compress=lz4 $sendfs); then + if $(datasetexists $sendfs || zfs create -o compress=lz4 $sendfs); then mk_files 1000 256 0 $sendfs & mk_files 1000 131072 0 $sendfs & mk_files 100 1048576 0 $sendfs & diff --git a/tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh b/tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh index e9f6df3d3..5858bd2f2 100755 --- a/tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh +++ b/tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh @@ -30,22 +30,24 @@ # 4. ZFS send to the stream state file again using the receive_resume_token # 5. ZFS receive and verify the receive completes successfully # 6. Repeat steps on an incremental ZFS send +# 7. Repeat the entire procedure for a dataset at the pool root # verify_runnable "both" log_assert "Verify resumability of a full and incremental ZFS send/receive " \ "in the presence of a corrupted stream" -log_onexit cleanup_pool $POOL2 +log_onexit cleanup_pools $POOL2 $POOL3 -sendfs=$POOL/sendfs -recvfs=$POOL2/recvfs -streamfs=$POOL/stream +recvfs=$POOL3/recvfs +streamfs=$POOL2/stream -test_fs_setup $POOL $POOL2 -resume_test "zfs send -v $sendfs@a" $streamfs $recvfs -resume_test "zfs send -v -i @a $sendfs@b" $streamfs $recvfs -file_check $sendfs $recvfs +for sendfs in $POOL2/sendfs $POOL2; do + test_fs_setup $sendfs $recvfs + resume_test "zfs send -v $sendfs@a" $streamfs $recvfs + resume_test "zfs send -v -i @a $sendfs@b" $streamfs $recvfs + file_check $sendfs $recvfs +done log_pass "Verify resumability of a full and incremental ZFS send/receive " \ "in the presence of a corrupted stream" diff --git a/tests/zfs-tests/tests/functional/rsend/rsend_020_pos.ksh b/tests/zfs-tests/tests/functional/rsend/rsend_020_pos.ksh index 46050720c..25e125b4f 100755 --- a/tests/zfs-tests/tests/functional/rsend/rsend_020_pos.ksh +++ b/tests/zfs-tests/tests/functional/rsend/rsend_020_pos.ksh @@ -41,7 +41,7 @@ sendfs=$POOL/sendfs recvfs=$POOL2/recvfs streamfs=$POOL/stream -test_fs_setup $POOL $POOL2 +test_fs_setup $sendfs $recvfs resume_test "zfs send -D -v $sendfs@a" $streamfs $recvfs file_check $sendfs $recvfs diff --git a/tests/zfs-tests/tests/functional/rsend/rsend_021_pos.ksh b/tests/zfs-tests/tests/functional/rsend/rsend_021_pos.ksh index 8f3a47a5f..30af5ba43 100755 --- a/tests/zfs-tests/tests/functional/rsend/rsend_021_pos.ksh +++ b/tests/zfs-tests/tests/functional/rsend/rsend_021_pos.ksh @@ -43,7 +43,7 @@ sendfs=$POOL/sendfs recvfs=$POOL2/recvfs streamfs=$POOL/stream -test_fs_setup $POOL $POOL2 +test_fs_setup $sendfs $recvfs resume_test "zfs send -v -e $sendfs@a" $streamfs $recvfs resume_test "zfs send -v -e -i @a $sendfs@b" $streamfs $recvfs file_check $sendfs $recvfs diff --git a/tests/zfs-tests/tests/functional/rsend/rsend_022_pos.ksh b/tests/zfs-tests/tests/functional/rsend/rsend_022_pos.ksh index 7670b8eb4..278f1535f 100755 --- a/tests/zfs-tests/tests/functional/rsend/rsend_022_pos.ksh +++ b/tests/zfs-tests/tests/functional/rsend/rsend_022_pos.ksh @@ -51,7 +51,7 @@ sendfs=$POOL/sendfs recvfs=$POOL2/recvfs streamfs=$POOL/stream -test_fs_setup $POOL $POOL2 +test_fs_setup $sendfs $recvfs log_must zfs bookmark $sendfs@a $sendfs#bm_a log_must zfs destroy $sendfs@a log_must zfs receive -v $recvfs </$POOL/initial.zsend diff --git a/tests/zfs-tests/tests/functional/rsend/rsend_024_pos.ksh b/tests/zfs-tests/tests/functional/rsend/rsend_024_pos.ksh index 0b0a1e0d0..f61be9442 100755 --- a/tests/zfs-tests/tests/functional/rsend/rsend_024_pos.ksh +++ b/tests/zfs-tests/tests/functional/rsend/rsend_024_pos.ksh @@ -48,7 +48,7 @@ sendfs=$POOL/sendfs recvfs=$POOL2/recvfs streamfs=$POOL/stream -test_fs_setup $POOL $POOL2 +test_fs_setup $sendfs $recvfs log_must zfs unmount $sendfs resume_test "zfs send $sendfs" $streamfs $recvfs file_check $sendfs $recvfs diff --git a/tests/zfs-tests/tests/functional/rsend/setup.ksh b/tests/zfs-tests/tests/functional/rsend/setup.ksh index f0417e85a..dbf4eeced 100755 --- a/tests/zfs-tests/tests/functional/rsend/setup.ksh +++ b/tests/zfs-tests/tests/functional/rsend/setup.ksh @@ -37,6 +37,7 @@ verify_disk_count "$DISKS" 2 if is_global_zone ; then log_must zpool create $POOL $DISK1 log_must zpool create $POOL2 $DISK2 + log_must zpool create $POOL3 $DISK3 fi log_must mkdir $BACKDIR $TESTDIR |