]> git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_005_pos.ksh
13f1288e4e8cb149ef2a59dc6384ee6ccac8bc1d
[mirror_zfs.git] / tests / zfs-tests / tests / functional / features / large_dnode / large_dnode_005_pos.ksh
1 #!/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 . $STF_SUITE/include/libtest.shlib
24
25 verify_runnable "both"
26
27 TEST_SEND_FS=$TESTPOOL/send_large_dnode
28 TEST_RECV_FS=$TESTPOOL/recv_large_dnode
29 TEST_SNAP=$TEST_SEND_FS@ldnsnap
30 TEST_SNAPINCR=$TEST_SEND_FS@ldnsnap_incr
31 TEST_STREAM=$TESTDIR/ldnsnap
32 TEST_STREAMINCR=$TESTDIR/ldnsnap_incr
33 TEST_FILE=foo
34 TEST_FILEINCR=bar
35
36 function cleanup
37 {
38 if datasetexists $TEST_SEND_FS ; then
39 log_must zfs destroy -r $TEST_SEND_FS
40 fi
41
42 if datasetexists $TEST_RECV_FS ; then
43 log_must zfs destroy -r $TEST_RECV_FS
44 fi
45
46 rm -f $TEST_STREAM
47 rm -f $TEST_STREAMINCR
48 }
49
50 log_onexit cleanup
51
52 log_assert "zfs send stream with large dnodes accepted by new pool"
53
54 log_must zfs create -o dnodesize=1k $TEST_SEND_FS
55 log_must touch /$TEST_SEND_FS/$TEST_FILE
56 log_must zfs snap $TEST_SNAP
57 log_must zfs send $TEST_SNAP > $TEST_STREAM
58 log_must rm -f /$TEST_SEND_FS/$TEST_FILE
59 log_must touch /$TEST_SEND_FS/$TEST_FILEINCR
60 log_must zfs snap $TEST_SNAPINCR
61 log_must zfs send -i $TEST_SNAP $TEST_SNAPINCR > $TEST_STREAMINCR
62
63 log_must eval "zfs recv $TEST_RECV_FS < $TEST_STREAM"
64 inode=$(ls -li /$TEST_RECV_FS/$TEST_FILE | awk '{print $1}')
65 dnsize=$(zdb -dddd $TEST_RECV_FS $inode | awk '/ZFS plain file/ {print $6}')
66 if [[ "$dnsize" != "1K" ]]; then
67 log_fail "dnode size is $dnsize (expected 1K)"
68 fi
69
70 log_must eval "zfs recv -F $TEST_RECV_FS < $TEST_STREAMINCR"
71 log_must diff -r /$TEST_SEND_FS /$TEST_RECV_FS
72 log_must zfs umount $TEST_SEND_FS
73 log_must zfs umount $TEST_RECV_FS
74
75 log_pass