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