Print this page
7290 ZFS test suite needs to control what utilities it can run
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/test/zfs-tests/tests/functional/nopwrite/nopwrite_negative.ksh
+++ new/usr/src/test/zfs-tests/tests/functional/nopwrite/nopwrite_negative.ksh
1 1 #!/usr/bin/ksh
2 2
3 3 #
4 4 # This file and its contents are supplied under the terms of the
|
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
5 5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 6 # You may only use this file in accordance with the terms of version
7 7 # 1.0 of the CDDL.
8 8 #
9 9 # A full copy of the text of the CDDL should have accompanied this
10 10 # source. A copy of the CDDL is also available via the Internet at
11 11 # http://www.illumos.org/license/CDDL.
12 12 #
13 13
14 14 #
15 -# Copyright (c) 2012 by Delphix. All rights reserved.
15 +# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
16 16 #
17 17
18 18 . $STF_SUITE/include/libtest.shlib
19 19 . $STF_SUITE/tests/functional/nopwrite/nopwrite.shlib
20 20
21 21 #
22 22 # Description:
23 23 # Verify that duplicate writes to a clone are accounted as new data if the
24 24 # prerequisites for nopwrite are not met.
25 25 #
26 26 # Scenarios:
27 27 # 1. The file in the origin ds is written without compression or sha256.
28 28 # 2. The file in the origin ds is written before sha256 checksum is turned on.
|
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
29 29 # 3. The clone does not have compression.
30 30 # 4. The clone does not have the appropriate checksum.
31 31 #
32 32
33 33 verify_runnable "global"
34 34 origin="$TESTPOOL/$TESTFS"
35 35 log_onexit cleanup
36 36
37 37 function cleanup
38 38 {
39 - datasetexists $origin && log_must $ZFS destroy -R $origin
40 - log_must $ZFS create -o mountpoint=$TESTDIR $origin
39 + datasetexists $origin && log_must zfs destroy -R $origin
40 + log_must zfs create -o mountpoint=$TESTDIR $origin
41 41 }
42 42
43 43 log_assert "nopwrite isn't enabled without the prerequisites"
44 44
45 45 # Data written into origin fs without compression or sha256
46 -$DD if=/dev/urandom of=$TESTDIR/file bs=1024k count=$MEGS conv=notrunc \
46 +dd if=/dev/urandom of=$TESTDIR/file bs=1024k count=$MEGS conv=notrunc \
47 47 >/dev/null 2>&1 || log_fail "dd of $TESTDIR/file failed."
48 -$ZFS snapshot $origin@a || log_fail "zfs snap failed"
49 -log_must $ZFS clone -o compress=on $origin@a $origin/clone
50 -log_must $ZFS set checksum=sha256 $origin/clone
51 -$DD if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \
48 +zfs snapshot $origin@a || log_fail "zfs snap failed"
49 +log_must zfs clone -o compress=on $origin@a $origin/clone
50 +log_must zfs set checksum=sha256 $origin/clone
51 +dd if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \
52 52 conv=notrunc >/dev/null 2>&1 || log_fail "dd failed."
53 53 log_mustnot verify_nopwrite $origin $origin@a $origin/clone
54 -$ZFS destroy -R $origin@a || log_fail "zfs destroy failed"
55 -log_must $RM -f $TESTDIR/file
54 +zfs destroy -R $origin@a || log_fail "zfs destroy failed"
55 +log_must rm -f $TESTDIR/file
56 56
57 57 # Data written to origin fs before checksum enabled
58 -log_must $ZFS set compress=on $origin
59 -$DD if=/dev/urandom of=$TESTDIR/file bs=1024k count=$MEGS conv=notrunc \
58 +log_must zfs set compress=on $origin
59 +dd if=/dev/urandom of=$TESTDIR/file bs=1024k count=$MEGS conv=notrunc \
60 60 >/dev/null 2>&1 || log_fail "dd into $TESTDIR/file failed."
61 -log_must $ZFS set checksum=sha256 $origin
62 -$ZFS snapshot $origin@a || log_fail "zfs snap failed"
63 -log_must $ZFS clone $origin@a $origin/clone
64 -$DD if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \
61 +log_must zfs set checksum=sha256 $origin
62 +zfs snapshot $origin@a || log_fail "zfs snap failed"
63 +log_must zfs clone $origin@a $origin/clone
64 +dd if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \
65 65 conv=notrunc >/dev/null 2>&1 || log_fail "dd failed."
66 66 log_mustnot verify_nopwrite $origin $origin@a $origin/clone
67 -$ZFS destroy -R $origin@a || log_fail "zfs destroy failed"
68 -log_must $RM -f $TESTDIR/file
67 +zfs destroy -R $origin@a || log_fail "zfs destroy failed"
68 +log_must rm -f $TESTDIR/file
69 69
70 70 # Clone with compression=off
71 -$DD if=/dev/urandom of=$TESTDIR/file bs=1024k count=$MEGS conv=notrunc \
71 +dd if=/dev/urandom of=$TESTDIR/file bs=1024k count=$MEGS conv=notrunc \
72 72 >/dev/null 2>&1 || log_fail "dd into $TESTDIR/file failed."
73 -$ZFS snapshot $origin@a || log_fail "zfs snap failed"
74 -log_must $ZFS clone -o compress=off $origin@a $origin/clone
75 -$DD if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \
73 +zfs snapshot $origin@a || log_fail "zfs snap failed"
74 +log_must zfs clone -o compress=off $origin@a $origin/clone
75 +dd if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \
76 76 conv=notrunc >/dev/null 2>&1 || log_fail "dd failed."
77 77 log_mustnot verify_nopwrite $origin $origin@a $origin/clone
78 -$ZFS destroy -R $origin@a || log_fail "zfs destroy failed"
79 -log_must $RM -f $TESTDIR/file
78 +zfs destroy -R $origin@a || log_fail "zfs destroy failed"
79 +log_must rm -f $TESTDIR/file
80 80
81 81 # Clone with fletcher4, rather than sha256
82 -$DD if=/dev/urandom of=$TESTDIR/file bs=1024k count=$MEGS conv=notrunc \
82 +dd if=/dev/urandom of=$TESTDIR/file bs=1024k count=$MEGS conv=notrunc \
83 83 >/dev/null 2>&1 || log_fail "dd into $TESTDIR/file failed."
84 -$ZFS snapshot $origin@a || log_fail "zfs snap failed"
85 -log_must $ZFS clone -o checksum=fletcher4 $origin@a $origin/clone
86 -$DD if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \
84 +zfs snapshot $origin@a || log_fail "zfs snap failed"
85 +log_must zfs clone -o checksum=fletcher4 $origin@a $origin/clone
86 +dd if=/$TESTDIR/file of=/$TESTDIR/clone/file bs=1024k count=$MEGS \
87 87 conv=notrunc >/dev/null 2>&1 || log_fail "dd failed."
88 88 log_mustnot verify_nopwrite $origin $origin@a $origin/clone
89 89
90 90 log_pass "nopwrite isn't enabled without the prerequisites"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX