aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-L_toggle.ksh
blob: 483efcc60548abf232bf1cbcd89c5e559c75853c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/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 (c) 2020 by Delphix. All rights reserved.
#

. $STF_SUITE/tests/functional/rsend/rsend.kshlib

#
# Description:
# Verify that send -L can be changed to on in an incremental.
# Verify that send -L can not be turned off in an incremental.
#

function cleanup
{
	log_must_busy zfs destroy -r $TESTPOOL/fs
	log_must_busy zfs destroy -r $TESTPOOL/recv
}

verify_runnable "both"

log_assert "Verify toggling send -L works as expected"
log_onexit cleanup

log_must zfs create -o compression=on -o recordsize=1m $TESTPOOL/fs

log_must dd if=/dev/urandom of=/$TESTPOOL/fs/file bs=1024 count=1500

log_must zfs snapshot $TESTPOOL/fs@snap

log_must dd if=/dev/urandom of=/$TESTPOOL/fs/file bs=1024 count=1500 conv=notrunc seek=2048

log_must zfs snapshot $TESTPOOL/fs@snap2

log_must zfs create $TESTPOOL/recv

log_must zfs send -c $TESTPOOL/fs@snap | zfs recv $TESTPOOL/recv/noL-noL
log_must zfs send -c -i @snap $TESTPOOL/fs@snap2| zfs recv $TESTPOOL/recv/noL-noL
log_must diff /$TESTPOOL/fs/file /$TESTPOOL/recv/noL-noL/file

log_must zfs send -c -L $TESTPOOL/fs@snap | zfs recv $TESTPOOL/recv/L-L
log_must zfs send -c -L -i @snap $TESTPOOL/fs@snap2 | zfs recv $TESTPOOL/recv/L-L
log_must diff /$TESTPOOL/fs/file /$TESTPOOL/recv/L-L/file

log_must zfs send -c $TESTPOOL/fs@snap | zfs recv $TESTPOOL/recv/noL-L
log_must zfs send -c -L -i @snap $TESTPOOL/fs@snap2 | zfs recv $TESTPOOL/recv/noL-L
log_must diff /$TESTPOOL/fs/file /$TESTPOOL/recv/noL-L/file

log_must zfs send -c -L $TESTPOOL/fs@snap | zfs recv $TESTPOOL/recv/L-noL
log_mustnot zfs send -c -i @snap $TESTPOOL/fs@snap2 | zfs recv $TESTPOOL/recv/L-noL
log_must diff /$TESTPOOL/fs/.zfs/snapshot/snap/file /$TESTPOOL/recv/L-noL/file

log_pass "Verify toggling send -L works as expected"