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