summaryrefslogtreecommitdiff
path: root/testsuite.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-03-05 20:10:01 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2018-03-11 07:29:19 +0100
commit652f11b60f7b738440fe0e919d4de0c188e80395 (patch)
tree4f8b8754f0b8abeba60f3973ab765943dbb2cc52 /testsuite.py
parent0bd841def7f3911771afa2346acae4938033ace9 (diff)
Add minimal configuration file generation support
Works like 'make savedefconfig' in the C tools. Call it write_min_config() rather than write_defconfig() to be a bit more explicit. Add a test similar to test_defconfig that compares Kconfiglib minimal configuration output against the C implementation, for all defconfig files. Disable the tests for now. The C tools have a bug that causes an incorrect configuration to be generated for tristate choices in some cases. They will be re-enabled once those are fixed.
Diffstat (limited to 'testsuite.py')
-rw-r--r--testsuite.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/testsuite.py b/testsuite.py
index 176de91..4b3d0f2 100644
--- a/testsuite.py
+++ b/testsuite.py
@@ -24,6 +24,9 @@
# by an order of magnitude. Occasionally finds (usually obscure) bugs, and I
# make sure everything passes with it.
#
+# - obsessive-min-config:
+# Like obsessive, for the minimal configuation (defconfig) tests.
+#
# - log:
# Log timestamped defconfig test failures to the file test_defconfig_fails.
# Handy in obsessive mode.
@@ -87,6 +90,7 @@ os.environ.pop("KCONFIG_ALLCONFIG", None)
speedy = False
obsessive = False
+obsessive_min_config = False
log = False
def run_tests():
@@ -98,6 +102,9 @@ def run_tests():
elif s == "obsessive":
obsessive = True
print("Obsessive mode enabled")
+ elif s == "obsessive-min-config":
+ obsessive_min_config = True
+ print("Obsessive minimal config mode enabled")
elif s == "log":
log = True
print("Log mode enabled")
@@ -1715,6 +1722,9 @@ def run_compatibility_tests():
test_fns = (test_alldefconfig,
test_defconfig,
+ # Fails for a few defconfigs due to a bug in the C tools. Will
+ # be enabled once patches get in.
+ #test_min_config,
test_sanity,
test_all_no,
test_all_no_simpler,
@@ -2022,6 +2032,37 @@ def test_defconfig(conf, arch, srcarch):
fail_log.write("{} with {} did not match\n"
.format(arch, defconfig))
+def test_min_config(conf, arch, srcarch):
+ """
+ Verify that Kconfiglib generates the same .config as 'make savedefconfig'
+ for each architecture/defconfig pair.
+ """
+ if obsessive_min_config:
+ defconfigs = []
+ for srcarch_ in os.listdir("arch"):
+ defconfigs.extend(defconfig_files(srcarch_))
+ else:
+ defconfigs = defconfig_files(srcarch)
+
+ for defconfig in defconfigs:
+ conf.load_config(defconfig)
+ conf.write_min_config("._config")
+
+ shell("cp {} .config".format(defconfig))
+
+ if speedy:
+ shell("scripts/kconfig/conf --savedefconfig=.config Kconfig")
+ else:
+ shell("make savedefconfig")
+ shell("mv defconfig .config")
+
+ arch_defconfig_str = " {:14}with {:60} ".format(arch, defconfig)
+
+ if equal_configs():
+ print(arch_defconfig_str + "OK")
+ else:
+ print(arch_defconfig_str + "FAIL")
+
#
# Helper functions
#