summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-05-30 22:31:53 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-05-30 23:45:04 +0200
commit4a71241b6c93b58ef8bc05b1f85c489b35f1d5f7 (patch)
treeb8da0a8cea9494706f2aa5e1ccfa97bc1ef8a520
parente783571e40ae02aed0bf76b1686dac664f87383d (diff)
Add an allmodconfig implementation
Verified to produce identical output to 'make allmodconfig', for all arches. Will be packaged.
-rwxr-xr-xallmodconfig.py39
-rw-r--r--testsuite.py20
2 files changed, 58 insertions, 1 deletions
diff --git a/allmodconfig.py b/allmodconfig.py
new file mode 100755
index 0000000..3f049a8
--- /dev/null
+++ b/allmodconfig.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+# Works like 'make allmodconfig'. Verified by the test suite to generate output
+# identical to 'make allmodconfig', for all ARCHES.
+#
+# Usage for the Linux kernel:
+#
+# $ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/examples/allyesconfig.py
+
+import kconfiglib
+
+def main():
+ kconf = kconfiglib.standard_kconfig()
+
+ # Avoid warnings printed by Kconfiglib when assigning a value to a symbol that
+ # has no prompt. Such assignments never have an effect.
+ kconf.disable_warnings()
+
+ # Small optimizations
+ BOOL = kconfiglib.BOOL
+ TRISTATE = kconfiglib.TRISTATE
+
+ for sym in kconf.defined_syms:
+ if sym.orig_type == BOOL:
+ # 'bool' choice symbols get their default value, as determined by
+ # e.g. 'default's on the choice
+ if not sym.choice:
+ # All other bool symbols get set to 'y', like for allyesconfig
+ sym.set_value(2)
+ elif sym.orig_type == TRISTATE:
+ sym.set_value(1)
+
+ for choice in kconf.choices:
+ choice.set_value(2 if choice.orig_type == BOOL else 1)
+
+ kconf.write_config(kconfiglib.standard_config_filename())
+
+if __name__ == "__main__":
+ main()
diff --git a/testsuite.py b/testsuite.py
index b5644d2..2a8588a 100644
--- a/testsuite.py
+++ b/testsuite.py
@@ -1917,7 +1917,8 @@ def run_compatibility_tests():
print("Running compatibility tests...\n")
- test_fns = (test_alldefconfig,
+ test_fns = (test_allmodconfig,
+ test_alldefconfig,
test_defconfig,
# Fails for a few defconfigs due to a bug in the C tools. Will
# be enabled once patches get in.
@@ -2000,6 +2001,23 @@ def test_allnoconfig_walk(conf, arch, srcarch):
compare_configs(arch)
+def test_allmodconfig(conf, arch, srcarch):
+ """
+ Verify that allmodconfig.py generates the same .config as
+ 'make allmodconfig', for each architecture. Runs the script via
+ 'make scriptconfig', so kinda slow even in speedy mode.
+ """
+ # TODO: Support speedy mode for running the script
+ shell("make scriptconfig SCRIPT=Kconfiglib/allmodconfig.py "
+ "PYTHONCMD='{}'".format(sys.executable))
+ shell("mv .config ._config")
+ if speedy:
+ shell("scripts/kconfig/conf --allmodconfig Kconfig")
+ else:
+ shell("make allmodconfig")
+
+ compare_configs(arch)
+
def test_allyesconfig(conf, arch, srcarch):
"""
Verify that allyesconfig.py generates the same .config as