summaryrefslogtreecommitdiff
path: root/tests/setup_lbu_test
blob: 0b07ac3d6fc8c62f9ec40cde396251ce00de0a60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env atf-sh

. $(atf_get_srcdir)/test_env.sh
init_tests \
	setup_lbu_usage \
	setup_lbu_label \
	setup_lbu_uuid

setup_lbu_usage_body() {
	test_usage setup-lbu
}

setup_lbu_label_body() {
	init_env
	atf_check -s exit:0 \
		-o empty \
		-e empty \
		setup-lbu LABEL=APKOVL
	grep -q 'LBU_MEDIA=LABEL=APKOVL' etc/lbu/lbu.conf || atf_fail "LBU_MEDIA not set in etc/lbu/lbu.conf"
	test -d media/LABEL=APKOVL || atf_fail "directory /media/LABEL=APKOVL was not created"

	atf_check -s exit:0 \
		-o match:"LABEL=APKOVL.*ro" \
		cat etc/fstab
}

setup_lbu_uuid_body() {
	init_env
	mkdir -p proc media/mmcblk0p1
	echo "/dev/mmcblk0p1 /media/mmcblk0p1 vfat ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0" > proc/mounts
	atf_check -s exit:0 \
		-o empty \
		-e empty \
		setup-lbu mmcblk0p1
	atf_check \
		-o match:"LBU_MEDIA=mmcblk0p1" \
		cat etc/lbu/lbu.conf

	test -d media/mmcblk0p1 || atf_fail "directory /media/mmcblk0p1 was not created"

	atf_check -s exit:0 \
		-o match:"^UUID=" \
		cat etc/fstab
}