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