diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2024-03-21 01:52:09 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2024-03-21 02:39:40 +0900 |
commit | c9aa7d862144f7b5d74cf316fc1172629a3b438f (patch) | |
tree | ca9e8d64254af5d886f9c961fa806279ebd4a235 /scripts | |
parent | 097f1200bf7ea19fb39ccf538a07a153260a7763 (diff) |
kconfig: tests: support KCONFIG_SEED for the randconfig runner
This will help get consistent results for randconfig tests.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kconfig/tests/conftest.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py index af8774a5697c..2a2a7e2da060 100644 --- a/scripts/kconfig/tests/conftest.py +++ b/scripts/kconfig/tests/conftest.py @@ -154,12 +154,10 @@ class Conf: defconfig_path = os.path.join(self._test_dir, defconfig) return self._run_conf('--defconfig={}'.format(defconfig_path)) - def _allconfig(self, mode, all_config): + def _allconfig(self, mode, all_config, extra_env={}): if all_config: all_config_path = os.path.join(self._test_dir, all_config) - extra_env = {'KCONFIG_ALLCONFIG': all_config_path} - else: - extra_env = {} + extra_env['KCONFIG_ALLCONFIG'] = all_config_path return self._run_conf('--{}config'.format(mode), extra_env=extra_env) @@ -195,13 +193,19 @@ class Conf: """ return self._allconfig('alldef', all_config) - def randconfig(self, all_config=None): + def randconfig(self, all_config=None, seed=None): """Run randconfig. all_config: fragment config file for KCONFIG_ALLCONFIG (optional) + seed: the seed for randconfig (optional) returncode: exit status of the Kconfig executable """ - return self._allconfig('rand', all_config) + if seed is not None: + extra_env = {'KCONFIG_SEED': hex(seed)} + else: + extra_env = {} + + return self._allconfig('rand', all_config, extra_env=extra_env) def savedefconfig(self, dot_config): """Run savedefconfig. |