summaryrefslogtreecommitdiff
path: root/tests/fake_modinfo_test
blob: de72e3b3ed0a23b02cc7a81a1cdd8095bdf19480 (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
#!/usr/bin/env atf-sh

. $(atf_get_srcdir)/test_env.sh
init_tests \
	fake_modinfo

fake_modinfo_body() {
	init_env
	kver=5.15.79-0
	flavor=virt
	mkdir -p "lib/modules/$kver-$flavor"/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac
	cat >"lib/modules/$kver-$flavor"/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko <<-EOF
		vermagic:       $kver-$flavor SMP preempt mod_unload modversions aarch64
		firmware:       brcm/brcmfmac*-sdio.*.bin
		firmware:       brcm/brcmfmac*-sdio.*.txt
		firmware:       brcm/brcmfmac43752-sdio.clm_blob
		firmware:       brcm/brcmfmac43752-sdio.bin
	EOF
	atf_check -s exit:0 \
		-o match:"vermagic:" \
		-o match:"firmware:" \
		modinfo "lib/modules/$kver-$flavor"/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko

	atf_check -s exit:0 \
		-o not-match:"vermagic:" \
		-o not-match:"firmware:" \
		-o match:"brcm/brcmfmac43752-sdio.clm_blob" \
		modinfo -k 1.0 -F firmware "lib/modules/$kver-$flavor"/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
}