kconfig check: remove redundant component lists

Components are the sets of kernel config options in
pmb/config/__init__.py, such as the ones for waydroid, nftables, etc.

Generate the list of components dynamically and refactor the code, so we
can add/remove components in just one place.

Reviewed-by: Clayton Craft <clayton@craftyguy.net>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230312151325.1968-4-ollieparanoid@postmarketos.org%3E
This commit is contained in:
Oliver Smith 2023-03-12 16:13:10 +01:00
parent d14dbd49de
commit 1a124ec2b6
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 96 additions and 150 deletions

View file

@ -31,21 +31,14 @@ def test_kconfig_check(args):
"bad-missing-required-option")
assert pmb.parse.kconfig.check_file(dir + "good")
assert not pmb.parse.kconfig.check_file(dir + "bad-wrong-option-set")
assert pmb.parse.kconfig.check_file(dir + "good-waydroid",
waydroid=True)
assert not pmb.parse.kconfig.check_file(dir +
"bad-array-missing-some-options",
waydroid=True)
assert pmb.parse.kconfig.check_file(dir + "good-nftables",
nftables=True)
assert not pmb.parse.kconfig.check_file(dir + "bad-nftables",
nftables=True)
assert pmb.parse.kconfig.check_file(dir + "good-zram",
zram=True)
assert pmb.parse.kconfig.check_file(dir + "good-uefi",
uefi=True)
assert not pmb.parse.kconfig.check_file(dir + "bad-uefi",
uefi=True)
assert pmb.parse.kconfig.check_file(dir + "good-waydroid", ["waydroid"])
assert not pmb.parse.kconfig.check_file(f"{dir}/bad-array-missing-some-options",
["waydroid"])
assert pmb.parse.kconfig.check_file(dir + "good-nftables", ["nftables"])
assert not pmb.parse.kconfig.check_file(dir + "bad-nftables", ["nftables"])
assert pmb.parse.kconfig.check_file(dir + "good-zram", ["zram"])
assert pmb.parse.kconfig.check_file(dir + "good-uefi", ["uefi"])
assert not pmb.parse.kconfig.check_file(dir + "bad-uefi", ["uefi"])
# tests on real devices
# *** do not add more of these! ***
@ -60,8 +53,7 @@ def test_kconfig_check(args):
assert pmb.parse.kconfig.check(args, "postmarketos-allwinner")
# testing the force param: nokia-n900 will never need the uefi options
assert not pmb.parse.kconfig.check(args, "nokia-n900",
force_uefi_check=True)
assert not pmb.parse.kconfig.check(args, "nokia-n900", ["uefi"])
# supports zram (with pmb:kconfigcheck-zram), nftables
assert pmb.parse.kconfig.check(args, "linux-purism-librem5")