Print this page
NEX-3363 Test suites don't cleanup after themselves properly.
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
4206 history_003_pos relies on exact size of history log and entries
4207 history_008_pos depends on obsolete internal history log message
4208 Typo in zfs_main.c: "posxiuser"
4209 Populate zfstest with the remainder of the STF tests
Reviewed by: Sonu Pillai <sonu.pillai@delphix.com>
Reviewed by: Will Guyette <will.guyette@delphix.com>
Reviewed by: Eric Diven <eric.diven@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/test/zfs-tests/tests/functional/replacement/replacement_002_pos.ksh
+++ new/usr/src/test/zfs-tests/tests/functional/replacement/replacement_002_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]
19 19 #
|
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
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 29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
30 +# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
30 31 #
31 32
32 33 . $STF_SUITE/include/libtest.shlib
33 34 . $STF_SUITE/tests/functional/replacement/replacement.cfg
34 35
35 36 #
36 37 # DESCRIPTION:
37 38 # Attaching disks during I/O should pass for supported pools.
38 39 #
39 40 # STRATEGY:
40 41 # 1. Create multidisk pools (stripe/mirror/raidz) and
41 42 # start some random I/O
42 43 # 2. Attach a disk to the pool.
43 44 # 3. Verify the integrity of the file system and the resilvering.
44 45 #
45 46
46 47 verify_runnable "global"
47 48
48 49 function cleanup
49 50 {
50 51 if [[ -n "$child_pids" ]]; then
|
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
51 52 for wait_pid in $child_pids
52 53 do
53 54 kill $wait_pid
54 55 done
55 56 fi
56 57
57 58 if poolexists $TESTPOOL1; then
58 59 destroy_pool $TESTPOOL1
59 60 fi
60 61
62 + [[ -e $TESTDIR1 ]] && log_must rm -rf $TESTDIR1
61 63 [[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/*
62 64 }
63 65
64 66 log_assert "Replacing a disk during I/O completes."
65 67
66 68 options=""
67 69 options_display="default options"
68 70
69 71 log_onexit cleanup
70 72
71 73 [[ -n "$HOLES_FILESIZE" ]] && options=" $options -f $HOLES_FILESIZE "
72 74
73 75 [[ -n "$HOLES_BLKSIZE" ]] && options="$options -b $HOLES_BLKSIZE "
74 76
75 77 [[ -n "$HOLES_COUNT" ]] && options="$options -c $HOLES_COUNT "
76 78
77 79 [[ -n "$HOLES_SEED" ]] && options="$options -s $HOLES_SEED "
78 80
79 81 [[ -n "$HOLES_FILEOFFSET" ]] && options="$options -o $HOLES_FILEOFFSET "
80 82
81 83 options="$options -r "
82 84
83 85 [[ -n "$options" ]] && options_display=$options
84 86
85 87 child_pids=""
86 88
87 89 function attach_test
88 90 {
89 91 typeset -i iters=2
90 92 typeset -i index=0
91 93 typeset opt=$1
92 94 typeset disk1=$2
93 95 typeset disk2=$3
94 96
95 97 typeset i=0
96 98 while [[ $i -lt $iters ]]; do
97 99 log_note "Invoking file_trunc with: $options_display"
98 100 file_trunc $options $TESTDIR/$TESTFILE.$i &
99 101 typeset pid=$!
100 102
101 103 sleep 1
102 104 if ! ps -p $pid > /dev/null 2>&1; then
103 105 log_fail "file_trunc $options $TESTDIR/$TESTFILE.$i"
104 106 fi
105 107
106 108 child_pids="$child_pids $pid"
107 109 ((i = i + 1))
108 110 done
109 111
110 112 log_must zpool attach $opt $TESTPOOL1 $disk1 $disk2
111 113
112 114 sleep 10
113 115
114 116 for wait_pid in $child_pids
115 117 do
116 118 kill $wait_pid
117 119 done
118 120 child_pids=""
119 121
120 122 log_must zpool export $TESTPOOL1
121 123 log_must zpool import -d $TESTDIR $TESTPOOL1
122 124 log_must zfs umount $TESTPOOL1/$TESTFS1
123 125 log_must zdb -cdui $TESTPOOL1/$TESTFS1
124 126 log_must zfs mount $TESTPOOL1/$TESTFS1
125 127
126 128 }
127 129
128 130 specials_list=""
129 131 i=0
130 132 while [[ $i != 2 ]]; do
131 133 mkfile $MINVDEVSIZE $TESTDIR/$TESTFILE1.$i
132 134 specials_list="$specials_list $TESTDIR/$TESTFILE1.$i"
133 135
134 136 ((i = i + 1))
135 137 done
136 138
137 139 #
138 140 # Create a replacement disk special file.
139 141 #
140 142 mkfile $MINVDEVSIZE $TESTDIR/$REPLACEFILE
141 143
142 144 for op in "" "-f"; do
143 145 create_pool $TESTPOOL1 mirror $specials_list
144 146 log_must zfs create $TESTPOOL1/$TESTFS1
145 147 log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
146 148
147 149 attach_test "$opt" $TESTDIR/$TESTFILE1.1 $TESTDIR/$REPLACEFILE
148 150
149 151 zpool iostat -v $TESTPOOL1 | grep "$TESTDIR/$REPLACEFILE"
150 152 if [[ $? -ne 0 ]]; then
151 153 log_fail "$REPLACEFILE is not present."
152 154 fi
153 155
154 156 destroy_pool $TESTPOOL1
155 157 done
156 158
157 159 log_note "Verify 'zpool attach' fails with non-mirrors."
158 160
159 161 for type in "" "raidz" "raidz1"; do
160 162 for op in "" "-f"; do
161 163 create_pool $TESTPOOL1 $type $specials_list
162 164 log_must zfs create $TESTPOOL1/$TESTFS1
163 165 log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
164 166
165 167 log_mustnot zpool attach "$opt" $TESTDIR/$TESTFILE1.1 \
166 168 $TESTDIR/$REPLACEFILE
167 169
168 170 zpool iostat -v $TESTPOOL1 | grep "$TESTDIR/$REPLACEFILE"
169 171 if [[ $? -eq 0 ]]; then
170 172 log_fail "$REPLACEFILE should not be present."
171 173 fi
172 174
173 175 destroy_pool $TESTPOOL1
174 176 done
175 177 done
176 178
177 179 log_pass
|
↓ open down ↓ |
107 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX