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/replacement/replacement_003_pos.ksh
+++ new/usr/src/test/zfs-tests/tests/functional/replacement/replacement_003_pos.ksh
1 1 #!/usr/bin/ksh -p
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
|
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 24 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 25 # Use is subject to license terms.
26 26 #
27 27
28 28 #
29 -# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
29 +# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
30 30 #
31 31
32 32 . $STF_SUITE/include/libtest.shlib
33 33 . $STF_SUITE/tests/functional/replacement/replacement.cfg
34 34
35 35 #
36 36 # DESCRIPTION:
37 37 # Detaching disks during I/O should pass for supported pools.
38 38 #
39 39 # STRATEGY:
40 40 # 1. Create multidisk pools (stripe/mirror/raidz) and
41 41 # start some random I/O
42 42 # 2. Detach a disk from the pool.
|
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
43 43 # 3. Verify the integrity of the file system and the resilvering.
44 44 #
45 45
46 46 verify_runnable "global"
47 47
48 48 function cleanup
49 49 {
50 50 if [[ -n "$child_pids" ]]; then
51 51 for wait_pid in $child_pids
52 52 do
53 - $KILL $wait_pid
53 + kill $wait_pid
54 54 done
55 55 fi
56 56
57 57 if poolexists $TESTPOOL1; then
58 58 destroy_pool $TESTPOOL1
59 59 fi
60 60
61 - [[ -e $TESTDIR ]] && log_must $RM -rf $TESTDIR/*
61 + [[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/*
62 62 }
63 63
64 64 log_assert "Replacing a disk during I/O completes."
65 65
66 66 options=""
67 67 options_display="default options"
68 68
69 69 log_onexit cleanup
70 70
71 71 [[ -n "$HOLES_FILESIZE" ]] && options=" $options -f $HOLES_FILESIZE "
72 72
73 73 [[ -n "$HOLES_BLKSIZE" ]] && options="$options -b $HOLES_BLKSIZE "
74 74
75 75 [[ -n "$HOLES_COUNT" ]] && options="$options -c $HOLES_COUNT "
76 76
77 77 [[ -n "$HOLES_SEED" ]] && options="$options -s $HOLES_SEED "
78 78
79 79 [[ -n "$HOLES_FILEOFFSET" ]] && options="$options -o $HOLES_FILEOFFSET "
80 80
81 81 ptions="$options -r "
82 82
83 83 [[ -n "$options" ]] && options_display=$options
84 84
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
85 85 child_pids=""
86 86
87 87 function detach_test
88 88 {
89 89 typeset -i iters=2
90 90 typeset -i index=0
91 91 typeset disk1=$1
92 92
93 93 typeset i=0
94 94 while [[ $i -lt $iters ]]; do
95 - log_note "Invoking $FILE_TRUNC with: $options_display"
96 - $FILE_TRUNC $options $TESTDIR/$TESTFILE.$i &
95 + log_note "Invoking file_trunc with: $options_display"
96 + file_trunc $options $TESTDIR/$TESTFILE.$i &
97 97 typeset pid=$!
98 98
99 - $SLEEP 1
100 - if ! $PS -p $pid > /dev/null 2>&1; then
101 - log_fail "$FILE_TRUNC $options $TESTDIR/$TESTFILE.$i"
99 + sleep 1
100 + if ! ps -p $pid > /dev/null 2>&1; then
101 + log_fail "file_trunc $options $TESTDIR/$TESTFILE.$i"
102 102 fi
103 103
104 104 child_pids="$child_pids $pid"
105 105 ((i = i + 1))
106 106 done
107 107
108 - log_must $ZPOOL detach $TESTPOOL1 $disk1
108 + log_must zpool detach $TESTPOOL1 $disk1
109 109
110 - $SLEEP 10
110 + sleep 10
111 111
112 112 for wait_pid in $child_pids
113 113 do
114 - $KILL $wait_pid
114 + kill $wait_pid
115 115 done
116 116 child_pids=""
117 117
118 - log_must $ZPOOL export $TESTPOOL1
119 - log_must $ZPOOL import -d $TESTDIR $TESTPOOL1
120 - log_must $ZFS umount $TESTPOOL1/$TESTFS1
121 - log_must $ZDB -cdui $TESTPOOL1/$TESTFS1
122 - log_must $ZFS mount $TESTPOOL1/$TESTFS1
118 + log_must zpool export $TESTPOOL1
119 + log_must zpool import -d $TESTDIR $TESTPOOL1
120 + log_must zfs umount $TESTPOOL1/$TESTFS1
121 + log_must zdb -cdui $TESTPOOL1/$TESTFS1
122 + log_must zfs mount $TESTPOOL1/$TESTFS1
123 123 }
124 124
125 125 specials_list=""
126 126 i=0
127 127 while [[ $i != 2 ]]; do
128 - $MKFILE $MINVDEVSIZE $TESTDIR/$TESTFILE1.$i
128 + mkfile $MINVDEVSIZE $TESTDIR/$TESTFILE1.$i
129 129 specials_list="$specials_list $TESTDIR/$TESTFILE1.$i"
130 130
131 131 ((i = i + 1))
132 132 done
133 133
134 134 create_pool $TESTPOOL1 mirror $specials_list
135 -log_must $ZFS create $TESTPOOL1/$TESTFS1
136 -log_must $ZFS set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
135 +log_must zfs create $TESTPOOL1/$TESTFS1
136 +log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
137 137
138 138 detach_test $TESTDIR/$TESTFILE1.1
139 139
140 -$ZPOOL iostat -v $TESTPOOL1 | grep "$TESTDIR/$TESTFILE1.1"
140 +zpool iostat -v $TESTPOOL1 | grep "$TESTDIR/$TESTFILE1.1"
141 141 if [[ $? -eq 0 ]]; then
142 142 log_fail "$TESTFILE1.1 should no longer be present."
143 143 fi
144 144
145 145 destroy_pool $TESTPOOL1
146 146
147 147 log_note "Verify 'zpool detach' fails with non-mirrors."
148 148
149 149 for type in "" "raidz" "raidz1" ; do
150 150 create_pool $TESTPOOL1 $type $specials_list
151 - log_must $ZFS create $TESTPOOL1/$TESTFS1
152 - log_must $ZFS set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
151 + log_must zfs create $TESTPOOL1/$TESTFS1
152 + log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
153 153
154 - log_mustnot $ZPOOL detach $TESTDIR/$TESTFILE1.1
154 + log_mustnot zpool detach $TESTDIR/$TESTFILE1.1
155 155
156 - $ZPOOL iostat -v $TESTPOOL1 | grep "$TESTDIR/$TESTFILE1.1"
156 + zpool iostat -v $TESTPOOL1 | grep "$TESTDIR/$TESTFILE1.1"
157 157 if [[ $? -ne 0 ]]; then
158 158 log_fail "$TESTFILE1.1 is not present."
159 159 fi
160 160
161 161 destroy_pool $TESTPOOL1
162 162 done
163 163
164 164 log_pass
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX