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