Skip to content

Commit 3f37704

Browse files
committed
Add integration test to catch missing files
Move static analysis test to a new lint target. Signed-off-by: Loïc Minier <[email protected]>
1 parent 8b0bba2 commit 3f37704

File tree

2 files changed

+85
-2
lines changed

2 files changed

+85
-2
lines changed

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PLATFORMS := $(foreach platform,$(wildcard platforms/*),$(platform)/gpt)
33
BINS := gen_partition.py msp.py ptool.py
44
PREFIX ?= /usr/local
55

6-
.PHONY: all check
6+
.PHONY: all check lint integration
77

88
all: $(PLATFORMS)
99

@@ -13,10 +13,16 @@ all: $(PLATFORMS)
1313
%/partitions.xml: %/partitions.conf
1414
$(TOPDIR)/gen_partition.py -i $^ -o $@
1515

16-
check:
16+
lint:
1717
# W605: invalid escape sequence
1818
pycodestyle --select=W605 *.py
1919

20+
integration: all
21+
# make sure generated output has created expected files
22+
tests/integration/check-missing-files platforms/*/*.xml
23+
24+
check: lint integration
25+
2026
install: $(BINS)
2127
install -d $(DESTDIR)$(PREFIX)/bin
2228
install -m 755 $^ $(DESTDIR)$(PREFIX)/bin
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/sh
2+
# Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved.
3+
# SPDX-License-Identifier: BSD-3-Clause-Clear
4+
5+
# Takes XML files as arguments, collects the filenames referenced, and checks
6+
# if any gpt_* or zeros_* file is missing
7+
8+
set -eu
9+
10+
errors=no
11+
12+
for xml in "$@"; do
13+
dir="$(dirname "${xml}")"
14+
for file in $(sed -En 's/.*filename="([^"]+)".*/\1/p' "${xml}" | sort -u); do
15+
case "${file}" in
16+
# expected files that should be generated by ptool
17+
gpt_*|zeros_*)
18+
if ! [ -r "${dir}/${file}" ]; then
19+
errors=yes
20+
echo "Missing ${file} referenced in ${xml}" >&2
21+
fi
22+
;;
23+
# known files that will be provided by the OS
24+
abl.elf) ;;
25+
aop.mbn) ;;
26+
boot.img) ;;
27+
cmnlib.mbn) ;;
28+
cmnlib64.mbn) ;;
29+
cpucp.elf) ;;
30+
devcfg_iot.mbn) ;;
31+
devcfg.mbn) ;;
32+
efi.bin) ;;
33+
DISK) ;;
34+
dtb.bin) ;;
35+
emmc_appsboot.mbn) ;;
36+
featenabler.mbn) ;;
37+
fs_image_linux.tar.gz.mbn.img) ;;
38+
hyp.mbn) ;;
39+
hypvm.mbn) ;;
40+
imagefv.elf) ;;
41+
keymaster.mbn) ;;
42+
keymaster64.mbn) ;;
43+
km4.mbn) ;;
44+
multi_image_qti.mbn) ;;
45+
multi_image.mbn) ;;
46+
pmic.elf) ;;
47+
qupv3fw.elf) ;;
48+
rootfs.img) ;;
49+
rpm.mbn) ;;
50+
sbc_1.0_8016.bin) ;;
51+
sbc_1.0_8096.bin) ;;
52+
sbl1.mbn) ;;
53+
sec.dat) ;;
54+
sed.dat) ;;
55+
shrm.elf) ;;
56+
storsec.mbn) ;;
57+
tools.fv) ;;
58+
tz.mbn) ;;
59+
uefi_sec.mbn) ;;
60+
uefi.elf) ;;
61+
xbl_config.elf) ;;
62+
xbl_feature_config.elf) ;;
63+
xbl.elf) ;;
64+
XblRamdump.elf) ;;
65+
*)
66+
echo "Unknown ${file} referenced in ${xml}" >&2
67+
errors=1
68+
;;
69+
esac
70+
done
71+
done
72+
73+
if [ "${errors}" != no ]; then
74+
exit 1
75+
fi
76+
exit 0
77+

0 commit comments

Comments
 (0)