xref: /freebsd/tests/sys/geom/class/eli/configure_test.sh (revision 488ab515d6cc02f6f743f0badfc8e94eb553cd30)
1# $FreeBSD$
2
3atf_test_case configure_b_B cleanup
4configure_b_B_head()
5{
6	atf_set "descr" "geli configure -b will set the BOOT flag"
7	atf_set "require.user" "root"
8}
9configure_b_B_body()
10{
11	. $(atf_get_srcdir)/conf.sh
12
13	sectors=100
14	md=$(attach_md -t malloc -s `expr $sectors + 1`)
15
16	atf_check geli init -B none -P -K /dev/null ${md}
17
18	atf_check -s exit:0 -o match:'flags: 0x0$' geli dump ${md}
19
20	atf_check geli init -B none -b -P -K /dev/null ${md}
21
22	atf_check -s exit:0 -o match:'flags: 0x2$' geli dump ${md}
23
24	atf_check geli configure -B ${md}
25
26	atf_check -s exit:0 -o match:'flags: 0x0$' geli dump ${md}
27
28	atf_check geli configure -b ${md}
29
30	atf_check -s exit:0 -o match:'flags: 0x2$' geli dump ${md}
31
32	atf_check geli attach -p -k /dev/null ${md}
33
34	atf_check -s exit:0 -o match:'^Flags: .*BOOT' geli list ${md}.eli
35
36	atf_check geli configure -B ${md}
37
38	atf_check -o not-match:'^Flags: .*BOOT' geli list ${md}.eli
39
40	atf_check -s exit:0 -o match:'flags: 0x0$' geli dump ${md}
41
42	atf_check geli configure -b ${md}
43
44	atf_check -s exit:0 -o match:'^Flags: .*BOOT' geli list ${md}.eli
45
46	atf_check -s exit:0 -o match:'flags: 0x2$' geli dump ${md}
47
48	atf_check geli detach ${md}
49}
50configure_b_B_cleanup()
51{
52	. $(atf_get_srcdir)/conf.sh
53	geli_test_cleanup
54}
55
56atf_init_test_cases()
57{
58	atf_add_test_case configure_b_B
59}
60