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