1# CDDL HEADER START
2#
3# The contents of this file are subject to the terms of the
4# Common Development and Distribution License (the "License").
5# You may not use this file except in compliance with the License.
6#
7# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8# or http://www.opensolaris.org/os/licensing.
9# See the License for the specific language governing permissions
10# and limitations under the License.
11#
12# When distributing Covered Code, include this CDDL HEADER in each
13# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14# If applicable, add the following below this CDDL HEADER, with the
15# fields enclosed by brackets "[]" replaced with your own identifying
16# information: Portions Copyright [yyyy] [name of copyright owner]
17#
18# CDDL HEADER END
19#
20
21#
22# Copyright 2012 Spectra Logic.  All rights reserved.
23# Use is subject to license terms.
24#
25
26
27atf_test_case history_001_pos
28history_001_pos_head()
29{
30	atf_set "descr" "Verify zpool sub-commands which modify state are logged."
31	atf_set "require.progs" "ksh93 zpool nawk"
32	atf_set "timeout" 1800
33}
34history_001_pos_body()
35{
36	. $(atf_get_srcdir)/../../include/default.cfg
37	. $(atf_get_srcdir)/history_common.kshlib
38	. $(atf_get_srcdir)/history.cfg
39
40	ksh93 $(atf_get_srcdir)/history_001_pos.ksh || atf_fail "Testcase failed"
41}
42
43atf_test_case history_002_pos cleanup
44history_002_pos_head()
45{
46	atf_set "descr" "Verify zfs sub-commands which modify state are logged."
47	atf_set "require.progs" "ksh93 zfs zpool"
48	atf_set "timeout" 1800
49}
50history_002_pos_body()
51{
52	. $(atf_get_srcdir)/../../include/default.cfg
53	. $(atf_get_srcdir)/history_common.kshlib
54	. $(atf_get_srcdir)/history.cfg
55
56	verify_disk_count "$DISKS" 1
57	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
58	ksh93 $(atf_get_srcdir)/history_002_pos.ksh || atf_fail "Testcase failed"
59}
60history_002_pos_cleanup()
61{
62	. $(atf_get_srcdir)/../../include/default.cfg
63	. $(atf_get_srcdir)/history_common.kshlib
64	. $(atf_get_srcdir)/history.cfg
65
66	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
67}
68
69
70atf_test_case history_003_pos cleanup
71history_003_pos_head()
72{
73	atf_set "descr" "zpool history limitation test."
74	atf_set "require.progs" "ksh93 zpool zfs"
75	atf_set "timeout" 1800
76}
77history_003_pos_body()
78{
79	. $(atf_get_srcdir)/../../include/default.cfg
80	. $(atf_get_srcdir)/history_common.kshlib
81	. $(atf_get_srcdir)/history.cfg
82
83	verify_disk_count "$DISKS" 1
84	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
85	ksh93 $(atf_get_srcdir)/history_003_pos.ksh || atf_fail "Testcase failed"
86}
87history_003_pos_cleanup()
88{
89	. $(atf_get_srcdir)/../../include/default.cfg
90	. $(atf_get_srcdir)/history_common.kshlib
91	. $(atf_get_srcdir)/history.cfg
92
93	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
94}
95
96
97atf_test_case history_004_pos cleanup
98history_004_pos_head()
99{
100	atf_set "descr" "'zpool history' can copes with many simultaneous command."
101	atf_set "require.progs" "ksh93 zfs zpool"
102	atf_set "timeout" 1800
103}
104history_004_pos_body()
105{
106	. $(atf_get_srcdir)/../../include/default.cfg
107	. $(atf_get_srcdir)/history_common.kshlib
108	. $(atf_get_srcdir)/history.cfg
109
110	verify_disk_count "$DISKS" 1
111	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
112	ksh93 $(atf_get_srcdir)/history_004_pos.ksh || atf_fail "Testcase failed"
113}
114history_004_pos_cleanup()
115{
116	. $(atf_get_srcdir)/../../include/default.cfg
117	. $(atf_get_srcdir)/history_common.kshlib
118	. $(atf_get_srcdir)/history.cfg
119
120	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
121}
122
123
124atf_test_case history_005_neg cleanup
125history_005_neg_head()
126{
127	atf_set "descr" "Verify 'zpool list|status|iostat' will not be logged."
128	atf_set "require.progs" "ksh93 zpool"
129	atf_set "timeout" 1800
130}
131history_005_neg_body()
132{
133	. $(atf_get_srcdir)/../../include/default.cfg
134	. $(atf_get_srcdir)/history_common.kshlib
135	. $(atf_get_srcdir)/history.cfg
136
137	verify_disk_count "$DISKS" 1
138	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
139	ksh93 $(atf_get_srcdir)/history_005_neg.ksh || atf_fail "Testcase failed"
140}
141history_005_neg_cleanup()
142{
143	. $(atf_get_srcdir)/../../include/default.cfg
144	. $(atf_get_srcdir)/history_common.kshlib
145	. $(atf_get_srcdir)/history.cfg
146
147	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
148}
149
150
151atf_test_case history_006_neg cleanup
152history_006_neg_head()
153{
154	atf_set "descr" "Verify 'zfs list|get|mount|unmount|share|unshare|send' will notbe logged."
155	atf_set "require.progs" "ksh93 zfs zpool"
156	atf_set "timeout" 1800
157}
158history_006_neg_body()
159{
160	. $(atf_get_srcdir)/../../include/default.cfg
161	. $(atf_get_srcdir)/history_common.kshlib
162	. $(atf_get_srcdir)/history.cfg
163
164	verify_disk_count "$DISKS" 1
165	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
166	ksh93 $(atf_get_srcdir)/history_006_neg.ksh || atf_fail "Testcase failed"
167}
168history_006_neg_cleanup()
169{
170	. $(atf_get_srcdir)/../../include/default.cfg
171	. $(atf_get_srcdir)/history_common.kshlib
172	. $(atf_get_srcdir)/history.cfg
173
174	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
175}
176
177
178atf_test_case history_007_pos cleanup
179history_007_pos_head()
180{
181	atf_set "descr" "Verify command history moves with pool while migrating."
182	atf_set "require.progs" "ksh93 zpool"
183	atf_set "timeout" 1800
184}
185history_007_pos_body()
186{
187	. $(atf_get_srcdir)/../../include/default.cfg
188	. $(atf_get_srcdir)/history_common.kshlib
189	. $(atf_get_srcdir)/history.cfg
190
191	verify_disk_count "$DISKS" 1
192	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
193	ksh93 $(atf_get_srcdir)/history_007_pos.ksh || atf_fail "Testcase failed"
194}
195history_007_pos_cleanup()
196{
197	. $(atf_get_srcdir)/../../include/default.cfg
198	. $(atf_get_srcdir)/history_common.kshlib
199	. $(atf_get_srcdir)/history.cfg
200
201	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
202}
203
204
205atf_test_case history_008_pos cleanup
206history_008_pos_head()
207{
208	atf_set "descr" "Internal journal records all the recursively operations."
209	atf_set "require.progs" "ksh93 zfs zpool"
210	atf_set "timeout" 1800
211}
212history_008_pos_body()
213{
214	. $(atf_get_srcdir)/../../include/default.cfg
215	. $(atf_get_srcdir)/history_common.kshlib
216	. $(atf_get_srcdir)/history.cfg
217
218	verify_disk_count "$DISKS" 1
219	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
220	ksh93 $(atf_get_srcdir)/history_008_pos.ksh || atf_fail "Testcase failed"
221}
222history_008_pos_cleanup()
223{
224	. $(atf_get_srcdir)/../../include/default.cfg
225	. $(atf_get_srcdir)/history_common.kshlib
226	. $(atf_get_srcdir)/history.cfg
227
228	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
229}
230
231
232atf_test_case history_009_pos cleanup
233history_009_pos_head()
234{
235	atf_set "descr" "Verify the delegation internal history are correctly."
236	atf_set "require.progs" "ksh93 zfs zpool"
237	atf_set "timeout" 1800
238}
239history_009_pos_body()
240{
241	. $(atf_get_srcdir)/../../include/default.cfg
242	. $(atf_get_srcdir)/history_common.kshlib
243	. $(atf_get_srcdir)/history.cfg
244
245	verify_disk_count "$DISKS" 1
246	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
247	ksh93 $(atf_get_srcdir)/history_009_pos.ksh || atf_fail "Testcase failed"
248}
249history_009_pos_cleanup()
250{
251	. $(atf_get_srcdir)/../../include/default.cfg
252	. $(atf_get_srcdir)/history_common.kshlib
253	. $(atf_get_srcdir)/history.cfg
254
255	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
256}
257
258
259atf_test_case history_010_pos cleanup
260history_010_pos_head()
261{
262	atf_set "descr" "Verify internal long history information are correct."
263	atf_set "require.progs" "ksh93 zfs zpool"
264	atf_set "timeout" 1800
265}
266history_010_pos_body()
267{
268	. $(atf_get_srcdir)/../../include/default.cfg
269	. $(atf_get_srcdir)/history_common.kshlib
270	. $(atf_get_srcdir)/history.cfg
271
272	verify_disk_count "$DISKS" 1
273	ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed"
274	ksh93 $(atf_get_srcdir)/history_010_pos.ksh || atf_fail "Testcase failed"
275}
276history_010_pos_cleanup()
277{
278	. $(atf_get_srcdir)/../../include/default.cfg
279	. $(atf_get_srcdir)/history_common.kshlib
280	. $(atf_get_srcdir)/history.cfg
281
282	ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed"
283}
284
285
286atf_init_test_cases()
287{
288
289	atf_add_test_case history_001_pos
290	atf_add_test_case history_002_pos
291	atf_add_test_case history_003_pos
292	atf_add_test_case history_004_pos
293	atf_add_test_case history_005_neg
294	atf_add_test_case history_006_neg
295	atf_add_test_case history_007_pos
296	atf_add_test_case history_008_pos
297	atf_add_test_case history_009_pos
298	atf_add_test_case history_010_pos
299}
300