xref: /freebsd/tools/regression/zfs/zpool/create/files.t (revision ff0ba87247820afbdfdc1b307c803f7923d0e4d3)
1#!/bin/sh
2# $FreeBSD$
3
4dir=`dirname $0`
5. ${dir}/../../misc.sh
6
7[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194589"
8
9echo "1..59"
10
11files_create 5
12names_create 1
13
14expect_ok ${ZPOOL} create ${name0} ${file0}
15expect_ok ${ZPOOL} status -x ${name0}
16expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
17exp=`(
18  echo "  pool: ${name0}"
19  echo " state: ONLINE"
20  echo " scrub: none requested"
21  echo "config:"
22  echo "	NAME        STATE   READ WRITE CKSUM"
23  echo "	${name0}    ONLINE     0     0     0"
24  echo "	  ${file0}  ONLINE     0     0     0"
25  echo "errors: No known data errors"
26)`
27expect "${exp}" ${ZPOOL} status ${name0}
28expect_ok ${ZPOOL} destroy ${name0}
29expect_fl ${ZPOOL} status -x ${name0}
30expect_fl ${ZPOOL} destroy ${name0}
31
32expect_ok ${ZPOOL} create ${name0} ${file0} ${file1} ${file2} ${file3} ${file4}
33expect_ok ${ZPOOL} status -x ${name0}
34expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
35exp=`(
36  echo "  pool: ${name0}"
37  echo " state: ONLINE"
38  echo " scrub: none requested"
39  echo "config:"
40  echo "	NAME        STATE   READ WRITE CKSUM"
41  echo "	${name0}    ONLINE     0     0     0"
42  echo "	  ${file0}  ONLINE     0     0     0"
43  echo "	  ${file1}  ONLINE     0     0     0"
44  echo "	  ${file2}  ONLINE     0     0     0"
45  echo "	  ${file3}  ONLINE     0     0     0"
46  echo "	  ${file4}  ONLINE     0     0     0"
47  echo "errors: No known data errors"
48)`
49expect "${exp}" ${ZPOOL} status ${name0}
50expect_ok ${ZPOOL} destroy ${name0}
51expect_fl ${ZPOOL} status -x ${name0}
52expect_fl ${ZPOOL} destroy ${name0}
53
54expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
55expect_ok ${ZPOOL} status -x ${name0}
56expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
57exp=`(
58  echo "  pool: ${name0}"
59  echo " state: ONLINE"
60  echo " scrub: none requested"
61  echo "config:"
62  echo "	NAME          STATE   READ WRITE CKSUM"
63  echo "	${name0}      ONLINE     0     0     0"
64  echo "	  mirror      ONLINE     0     0     0"
65  echo "	    ${file0}  ONLINE     0     0     0"
66  echo "	    ${file1}  ONLINE     0     0     0"
67  echo "errors: No known data errors"
68)`
69expect "${exp}" ${ZPOOL} status ${name0}
70expect_ok ${ZPOOL} destroy ${name0}
71expect_fl ${ZPOOL} status -x ${name0}
72expect_fl ${ZPOOL} destroy ${name0}
73
74expect_ok ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
75expect_ok ${ZPOOL} status -x ${name0}
76expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
77exp=`(
78  echo "  pool: ${name0}"
79  echo " state: ONLINE"
80  echo " scrub: none requested"
81  echo "config:"
82  echo "	NAME          STATE   READ WRITE CKSUM"
83  echo "	${name0}      ONLINE     0     0     0"
84  echo "	  raidz1      ONLINE     0     0     0"
85  echo "	    ${file0}  ONLINE     0     0     0"
86  echo "	    ${file1}  ONLINE     0     0     0"
87  echo "	    ${file2}  ONLINE     0     0     0"
88  echo "errors: No known data errors"
89)`
90expect "${exp}" ${ZPOOL} status ${name0}
91expect_ok ${ZPOOL} destroy ${name0}
92expect_fl ${ZPOOL} status -x ${name0}
93expect_fl ${ZPOOL} destroy ${name0}
94
95expect_ok ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
96expect_ok ${ZPOOL} status -x ${name0}
97expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
98exp=`(
99  echo "  pool: ${name0}"
100  echo " state: ONLINE"
101  echo " scrub: none requested"
102  echo "config:"
103  echo "	NAME          STATE   READ WRITE CKSUM"
104  echo "	${name0}      ONLINE     0     0     0"
105  echo "	  raidz2      ONLINE     0     0     0"
106  echo "	    ${file0}  ONLINE     0     0     0"
107  echo "	    ${file1}  ONLINE     0     0     0"
108  echo "	    ${file2}  ONLINE     0     0     0"
109  echo "	    ${file3}  ONLINE     0     0     0"
110  echo "errors: No known data errors"
111)`
112expect "${exp}" ${ZPOOL} status ${name0}
113expect_ok ${ZPOOL} destroy ${name0}
114expect_fl ${ZPOOL} status -x ${name0}
115expect_fl ${ZPOOL} destroy ${name0}
116
117expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1} spare ${file2} ${file3}
118expect_ok ${ZPOOL} status -x ${name0}
119expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
120exp=`(
121  echo "  pool: ${name0}"
122  echo " state: ONLINE"
123  echo " scrub: none requested"
124  echo "config:"
125  echo "	NAME          STATE   READ WRITE CKSUM"
126  echo "	${name0}      ONLINE     0     0     0"
127  echo "	  mirror      ONLINE     0     0     0"
128  echo "	    ${file0}  ONLINE     0     0     0"
129  echo "	    ${file1}  ONLINE     0     0     0"
130  echo "	spares"
131  echo "	  ${file2}    AVAIL   "
132  echo "	  ${file3}    AVAIL   "
133  echo "errors: No known data errors"
134)`
135expect "${exp}" ${ZPOOL} status ${name0}
136expect_ok ${ZPOOL} destroy ${name0}
137expect_fl ${ZPOOL} status -x ${name0}
138expect_fl ${ZPOOL} destroy ${name0}
139
140expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1} log ${file2} ${file3}
141expect_ok ${ZPOOL} status -x ${name0}
142expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
143exp=`(
144  echo "  pool: ${name0}"
145  echo " state: ONLINE"
146  echo " scrub: none requested"
147  echo "config:"
148  echo "	NAME          STATE   READ WRITE CKSUM"
149  echo "	${name0}      ONLINE     0     0     0"
150  echo "	  mirror      ONLINE     0     0     0"
151  echo "	    ${file0}  ONLINE     0     0     0"
152  echo "	    ${file1}  ONLINE     0     0     0"
153  echo "	logs          ONLINE     0     0     0"
154  echo "	  ${file2}    ONLINE     0     0     0"
155  echo "	  ${file3}    ONLINE     0     0     0"
156  echo "errors: No known data errors"
157)`
158expect "${exp}" ${ZPOOL} status ${name0}
159expect_ok ${ZPOOL} destroy ${name0}
160expect_fl ${ZPOOL} status -x ${name0}
161expect_fl ${ZPOOL} destroy ${name0}
162
163expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1} log mirror ${file2} ${file3}
164expect_ok ${ZPOOL} status -x ${name0}
165expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
166exp=`(
167  echo "  pool: ${name0}"
168  echo " state: ONLINE"
169  echo " scrub: none requested"
170  echo "config:"
171  echo "	NAME          STATE   READ WRITE CKSUM"
172  echo "	${name0}      ONLINE     0     0     0"
173  echo "	  mirror      ONLINE     0     0     0"
174  echo "	    ${file0}  ONLINE     0     0     0"
175  echo "	    ${file1}  ONLINE     0     0     0"
176  echo "	logs          ONLINE     0     0     0"
177  echo "	  mirror      ONLINE     0     0     0"
178  echo "	    ${file2}  ONLINE     0     0     0"
179  echo "	    ${file3}  ONLINE     0     0     0"
180  echo "errors: No known data errors"
181)`
182expect "${exp}" ${ZPOOL} status ${name0}
183expect_ok ${ZPOOL} destroy ${name0}
184expect_fl ${ZPOOL} status -x ${name0}
185expect_fl ${ZPOOL} destroy ${name0}
186
187expect_fl ${ZPOOL} create ${name0} mirror ${file0} ${file1} cache ${file2} ${file3}
188expect_fl ${ZPOOL} status -x ${name0}
189expect_fl ${ZPOOL} destroy ${name0}
190
191files_destroy
192