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 bootfs_001_pos
30bootfs_001_pos_head()
31{
32	atf_set "descr" "Valid datasets are accepted as bootfs property values"
33	atf_set "require.progs" "ksh93 zpool zfs"
34}
35bootfs_001_pos_body()
36{
37	. $(atf_get_srcdir)/../../include/default.cfg
38	. $(atf_get_srcdir)/bootfs.cfg
39
40	ksh93 $(atf_get_srcdir)/bootfs_001_pos.ksh || atf_fail "Testcase failed"
41}
42
43
44atf_test_case bootfs_002_neg
45bootfs_002_neg_head()
46{
47	atf_set "descr" "Invalid datasets are rejected as boot property values"
48	atf_set "require.progs" "ksh93 zfs zpool"
49}
50bootfs_002_neg_body()
51{
52	. $(atf_get_srcdir)/../../include/default.cfg
53	. $(atf_get_srcdir)/bootfs.cfg
54
55	verify_disk_count "$DISKS" 1
56	ksh93 $(atf_get_srcdir)/bootfs_002_neg.ksh || atf_fail "Testcase failed"
57}
58
59
60atf_test_case bootfs_003_pos
61bootfs_003_pos_head()
62{
63	atf_set "descr" "Valid pool names are accepted by zpool set bootfs"
64	atf_set "require.progs" "ksh93 zpool zfs"
65}
66bootfs_003_pos_body()
67{
68	. $(atf_get_srcdir)/../../include/default.cfg
69	. $(atf_get_srcdir)/bootfs.cfg
70
71	ksh93 $(atf_get_srcdir)/bootfs_003_pos.ksh || atf_fail "Testcase failed"
72}
73
74
75atf_test_case bootfs_004_neg
76bootfs_004_neg_head()
77{
78	atf_set "descr" "Invalid pool names are rejected by zpool set bootfs"
79	atf_set "require.progs" "ksh93 zpool zfs"
80}
81bootfs_004_neg_body()
82{
83	. $(atf_get_srcdir)/../../include/default.cfg
84	. $(atf_get_srcdir)/bootfs.cfg
85
86	ksh93 $(atf_get_srcdir)/bootfs_004_neg.ksh || atf_fail "Testcase failed"
87}
88
89
90atf_test_case bootfs_005_neg
91bootfs_005_neg_head()
92{
93	atf_set "descr" "Boot properties cannot be set on pools with older versions"
94	atf_set "require.progs" "ksh93 zfs zpool"
95}
96bootfs_005_neg_body()
97{
98	. $(atf_get_srcdir)/../../include/default.cfg
99	. $(atf_get_srcdir)/bootfs.cfg
100
101	verify_disk_count "$DISKS" 1
102	ksh93 $(atf_get_srcdir)/bootfs_005_neg.ksh || atf_fail "Testcase failed"
103}
104
105
106atf_test_case bootfs_006_pos
107bootfs_006_pos_head()
108{
109	atf_set "descr" "Pools of correct vdev types accept boot property"
110	atf_set "require.progs" "ksh93 zfs zpool"
111}
112bootfs_006_pos_body()
113{
114	. $(atf_get_srcdir)/../../include/default.cfg
115	. $(atf_get_srcdir)/bootfs.cfg
116
117	ksh93 $(atf_get_srcdir)/bootfs_006_pos.ksh || atf_fail "Testcase failed"
118}
119
120
121atf_test_case bootfs_007_pos
122bootfs_007_pos_head()
123{
124	atf_set "descr" "setting bootfs on a pool which was configured with the whole disk will succeed"
125	atf_set "require.progs" "ksh93 zfs zpool"
126}
127bootfs_007_pos_body()
128{
129	. $(atf_get_srcdir)/../../include/default.cfg
130	. $(atf_get_srcdir)/bootfs.cfg
131
132	verify_disk_count "$DISKS" 1
133	ksh93 $(atf_get_srcdir)/bootfs_007_pos.ksh || atf_fail "Testcase failed"
134}
135
136
137atf_test_case bootfs_008_neg
138bootfs_008_neg_head()
139{
140	atf_set "descr" "setting bootfs on a dataset which has gzip compression enabled will fail"
141	atf_set "require.progs" "ksh93 zpool zfs"
142}
143bootfs_008_neg_body()
144{
145	. $(atf_get_srcdir)/../../include/default.cfg
146	. $(atf_get_srcdir)/bootfs.cfg
147
148	ksh93 $(atf_get_srcdir)/bootfs_008_neg.ksh || atf_fail "Testcase failed"
149}
150
151
152atf_test_case bootfs_009_neg
153bootfs_009_neg_head()
154{
155	atf_set "descr" "Valid encrypted datasets can't be set bootfs property values"
156	atf_set "require.config" zfs_encryption
157	atf_set "require.progs" "ksh93 zfs zpool"
158}
159bootfs_009_neg_body()
160{
161	. $(atf_get_srcdir)/../../include/default.cfg
162	. $(atf_get_srcdir)/bootfs.cfg
163
164	ksh93 $(atf_get_srcdir)/bootfs_009_neg.ksh || atf_fail "Testcase failed"
165}
166
167
168atf_init_test_cases()
169{
170
171	atf_add_test_case bootfs_001_pos
172	atf_add_test_case bootfs_002_neg
173	atf_add_test_case bootfs_003_pos
174	atf_add_test_case bootfs_004_neg
175	atf_add_test_case bootfs_005_neg
176	atf_add_test_case bootfs_006_pos
177	atf_add_test_case bootfs_007_pos
178	atf_add_test_case bootfs_008_neg
179	atf_add_test_case bootfs_009_neg
180}
181