]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_015_pos.ksh
5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright 2016, loli10K. All rights reserved.
21 .
$STF_SUITE/include
/libtest.shlib
22 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_set
/zfs_set_common.kshlib
26 # Verify ZFS can receive custom properties on both filesystems and
27 # snapshots from full and incremental streams.
30 # 1. Create a filesystem.
31 # 2. Snapshot the filesystem.
32 # 3. Set custom properties on both the fs and snapshots.
33 # 4. Create different send streams with the properties.
34 # 5. Receive the send streams and verify the properties.
37 verify_runnable
"both"
39 typeset streamfile_full
=/var
/tmp
/streamfile_full.$$
40 typeset streamfile_incr
=/var
/tmp
/streamfile_incr.$$
41 orig
=$TESTPOOL/$TESTFS1
42 dest
=$TESTPOOL/$TESTFS2
43 typeset user_prop
=$
(valid_user_property
8)
44 typeset value
=$
(user_property_value
8)
48 log_must
rm $streamfile_full
49 log_must
rm $streamfile_incr
50 log_must zfs destroy
-rf $TESTPOOL/$TESTFS1
51 log_must zfs destroy
-rf $TESTPOOL/$TESTFS2
54 log_assert
"ZFS can receive custom properties."
57 # 1. Create a filesystem.
58 log_must zfs create
$orig
60 # 2. Snapshot the filesystem.
61 log_must zfs snapshot
$orig@snap1
62 log_must zfs snapshot
$orig@snap2
63 log_must zfs snapshot
$orig@snap3
65 # 3. Set custom properties on both the fs and snapshots.
66 log_must
eval "zfs set '$user_prop'='$value' $orig"
67 log_must
eval "zfs set '$user_prop:snap1'='$value:snap1' $orig@snap1"
68 log_must
eval "zfs set '$user_prop:snap2'='$value:snap2' $orig@snap2"
69 log_must
eval "zfs set '$user_prop:snap3'='$value:snap3' $orig@snap3"
71 # 4. Create different send streams with the properties.
72 log_must
eval "zfs send -p $orig@snap1 > $streamfile_full"
73 log_must
eval "zfs send -p -I $orig@snap1 $orig@snap3 > $streamfile_incr"
75 # 5. Receive the send streams and verify the properties.
76 log_must
eval "zfs recv $dest < $streamfile_full"
77 log_must
eval "check_user_prop $dest $user_prop '$value'"
78 log_must
eval "check_user_prop $dest@snap1 '$user_prop:snap1' '$value:snap1'"
79 log_must
eval "zfs recv $dest < $streamfile_incr"
80 log_must
eval "check_user_prop $dest@snap2 '$user_prop:snap2' '$value:snap2'"
81 log_must
eval "check_user_prop $dest@snap3 '$user_prop:snap3' '$value:snap3'"
83 log_pass
"ZFS can receive custom properties passed."