summaryrefslogtreecommitdiff
path: root/tests/update_kernel_test
blob: 99d55ba0c9640d0216f3c43b6d018d84705560e3 (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
46
47
48
#!/usr/bin/env atf-sh

. $(atf_get_srcdir)/test_env.sh
init_tests \
	update_kernel_usage \
	update_kernel_builddir_and_flavor \
	update_kernel_arch \
	update_kernel_flavor \
	update_kernel_firmware

update_kernel_usage_body() {
	test_usage update-kernel
}

update_kernel_builddir_and_flavor_body() {
	init_env
	atf_check -s exit:1 \
		-o empty \
		-e match:"Cannot specify both build directory and flavor" \
		update-kernel --build-dir tmp --flavor virt
}

update_kernel_arch_body() {
	init_env
	atf_check -s exit:1 \
		-o empty \
		-e match:"Cannot specify architecture when updating the current kernel" \
		update-kernel --arch foobar
}

update_kernel_flavor_body() {
	init_env
	atf_check -s exit:1 \
		-o empty \
		-e match:"Cannot specify flavor when updating the current kernel" \
		update-kernel --flavor virt
}

update_kernel_firmware_body() {
	atf_require_prog mksquashfs
	init_env
	mkdir out
	MKSQUASHFS_OPTS="-info" atf_check -s exit:0 \
		-o match:"apk add.*linux-firmware" \
		-o match:"file .*brcmfmac.ko" \
		-o match:"file .*brcm/brcmfmac43752-sdio.bin" \
		update-kernel --verbose --flavor rpi out/
}