diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-03-06 00:24:32 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-03-06 00:25:56 +0100 |
| commit | 4070b29473d74ae586f39b984d211ac11a3a164b (patch) | |
| tree | 09c74ec4cfc54e8e1e9d5239e85dc4e795174296 | |
| parent | b499d06a8513ba599ca72d4d7bb6ae7fb6f1a9f9 (diff) | |
testsuite.py: Refactor run_compatibility_tests()
Get rid of the compare_configs flag and just do the comparison from the
test functions themselves with a helper.
Also get rid of the test_load() test. That's indirectly tested through
the other tests, and test_alldefconfig() runs first and is speedy.
| -rw-r--r-- | testsuite.py | 61 |
1 files changed, 28 insertions, 33 deletions
diff --git a/testsuite.py b/testsuite.py index db1b5f0..b47784f 100644 --- a/testsuite.py +++ b/testsuite.py @@ -1717,39 +1717,25 @@ def run_compatibility_tests(): print("Running compatibility tests...\n") - # The set of tests that want to run for all architectures in the kernel - # tree -- currently, all tests. The boolean flag indicates whether .config - # (generated by the C implementation) should be compared to ._config - # (generated by us) after each invocation. - all_arch_tests = ((test_load, False), - (test_alldefconfig, True), - # Needs to report success/failure for each arch/defconfig - # combo, hence False. - (test_defconfig, False), - (test_sanity, False), - (test_all_no, True), - (test_all_no_simpler, True), - (test_all_yes, True)) - - for test_fn, compare_configs in all_arch_tests: + test_fns = (test_alldefconfig, + test_defconfig, + test_sanity, + test_all_no, + test_all_no_simpler, + test_all_yes) + + for test_fn in test_fns: # The test description is taken from the docstring of the corresponding # function print(textwrap.dedent(test_fn.__doc__)) - # Previously we used to load all the arches once and keep them - # around for the tests. That now uses a huge amount of memory (pypy - # helps a bit), so reload them for each test instead. + # Previously we used to load all the arches once and keep them around + # for the tests. That now uses a lot of memory (pypy helps a bit), so + # reload them for each test instead. for kconf, arch, srcarch in all_arch_srcarch_kconfigs(): rm_configs() test_fn(kconf, arch, srcarch) - if compare_configs: - if equal_confs(): - print("{:14}OK".format(arch)) - else: - print("{:14}FAIL".format(arch)) - fail() - if all_passed: print("All selftests and compatibility tests passed") print("{} arch/defconfig pairs tested".format(nconfigs)) @@ -1782,12 +1768,6 @@ def all_arch_srcarch_kconfigs(): os.environ["SRCARCH"] = srcarch yield (Kconfig(), arch, srcarch) -def test_load(conf, arch, srcarch): - """ - Load all arch Kconfigs to make sure we don't throw any errors - """ - print("{:14}OK".format(arch)) - def test_all_no(conf, arch, srcarch): """ Verify that our examples/allnoconfig.py script generates the same .config @@ -1803,6 +1783,8 @@ def test_all_no(conf, arch, srcarch): else: shell("make allnoconfig") + compare_configs(arch) + def test_all_no_simpler(conf, arch, srcarch): """ Verify that our examples/allnoconfig_simpler.py script generates the same @@ -1818,6 +1800,8 @@ def test_all_no_simpler(conf, arch, srcarch): else: shell("make allnoconfig") + compare_configs(arch) + def test_all_yes(conf, arch, srcarch): """ Verify that our examples/allyesconfig.py script generates the same .config @@ -1833,6 +1817,8 @@ def test_all_yes(conf, arch, srcarch): else: shell("make allyesconfig") + compare_configs(arch) + def test_sanity(conf, arch, srcarch): """ Do sanity checks on each configuration and call all public methods on all @@ -1986,6 +1972,8 @@ def test_alldefconfig(conf, arch, srcarch): else: shell("make alldefconfig") + compare_configs(arch) + def test_defconfig(conf, arch, srcarch): """ Verify that Kconfiglib generates the same .config as scripts/kconfig/conf, @@ -2056,7 +2044,7 @@ def test_defconfig(conf, arch, srcarch): arch_defconfig_str = " {:14}with {:60} ".format(arch, defconfig) - if equal_confs(): + if equal_configs(): print(arch_defconfig_str + "OK") else: print(arch_defconfig_str + "FAIL") @@ -2084,7 +2072,14 @@ def rm_configs(): rm_if_exists(".config") rm_if_exists("._config") -def equal_confs(): +def compare_configs(arch): + if equal_configs(): + print("{:14}OK".format(arch)) + else: + print("{:14}FAIL".format(arch)) + fail() + +def equal_configs(): with open(".config") as f: their = f.readlines() |
