xref: /freebsd/tests/sys/geom/class/eli/configure_test.sh (revision 96950419f15510287080c557174e0d8409f06956)
1f397a004SAlan Somers
2cf551b8aSAlan Somers. $(atf_get_srcdir)/conf.sh
3cf551b8aSAlan Somers
4f397a004SAlan Somersatf_test_case configure_b_B cleanup
5f397a004SAlan Somersconfigure_b_B_head()
6f397a004SAlan Somers{
7f397a004SAlan Somers	atf_set "descr" "geli configure -b will set the BOOT flag"
8f397a004SAlan Somers	atf_set "require.user" "root"
9f397a004SAlan Somers}
10f397a004SAlan Somersconfigure_b_B_body()
11f397a004SAlan Somers{
12cf551b8aSAlan Somers	geli_test_setup
13f397a004SAlan Somers
14f397a004SAlan Somers	sectors=100
15*96950419SGleb Smirnoff	attach_md md -t malloc -s `expr $sectors + 1`
16f397a004SAlan Somers
17f397a004SAlan Somers	atf_check geli init -B none -P -K /dev/null ${md}
18f397a004SAlan Somers
191e560a0cSPawel Jakub Dawidek	atf_check -s exit:0 -o match:'flags: 0x200$' geli dump ${md}
20f397a004SAlan Somers
21f397a004SAlan Somers	atf_check geli init -B none -b -P -K /dev/null ${md}
22f397a004SAlan Somers
231e560a0cSPawel Jakub Dawidek	atf_check -s exit:0 -o match:'flags: 0x202$' geli dump ${md}
24f397a004SAlan Somers
25f397a004SAlan Somers	atf_check geli configure -B ${md}
26f397a004SAlan Somers
271e560a0cSPawel Jakub Dawidek	atf_check -s exit:0 -o match:'flags: 0x200$' geli dump ${md}
28f397a004SAlan Somers
29f397a004SAlan Somers	atf_check geli configure -b ${md}
30f397a004SAlan Somers
311e560a0cSPawel Jakub Dawidek	atf_check -s exit:0 -o match:'flags: 0x202$' geli dump ${md}
32f397a004SAlan Somers
33f397a004SAlan Somers	atf_check geli attach -p -k /dev/null ${md}
34f397a004SAlan Somers
35f397a004SAlan Somers	atf_check -s exit:0 -o match:'^Flags: .*BOOT' geli list ${md}.eli
36f397a004SAlan Somers
37f397a004SAlan Somers	atf_check geli configure -B ${md}
38f397a004SAlan Somers
39f397a004SAlan Somers	atf_check -o not-match:'^Flags: .*BOOT' geli list ${md}.eli
40f397a004SAlan Somers
411e560a0cSPawel Jakub Dawidek	atf_check -s exit:0 -o match:'flags: 0x200$' geli dump ${md}
42f397a004SAlan Somers
43f397a004SAlan Somers	atf_check geli configure -b ${md}
44f397a004SAlan Somers
45f397a004SAlan Somers	atf_check -s exit:0 -o match:'^Flags: .*BOOT' geli list ${md}.eli
46f397a004SAlan Somers
471e560a0cSPawel Jakub Dawidek	atf_check -s exit:0 -o match:'flags: 0x202$' geli dump ${md}
48f397a004SAlan Somers
49f397a004SAlan Somers	atf_check geli detach ${md}
50f397a004SAlan Somers}
51f397a004SAlan Somersconfigure_b_B_cleanup()
52f397a004SAlan Somers{
53f397a004SAlan Somers	geli_test_cleanup
54f397a004SAlan Somers}
55f397a004SAlan Somers
56f397a004SAlan Somersatf_init_test_cases()
57f397a004SAlan Somers{
58f397a004SAlan Somers	atf_add_test_case configure_b_B
59f397a004SAlan Somers}
60