diff options
author | Marvin Scholz <epirat07@gmail.com> | 2022-02-02 22:11:03 +0100 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-11-22 20:22:04 -0500 |
commit | 08262c3102e250759c09f5cdde80f13fbbf3dc08 (patch) | |
tree | 8dbc585ae4dfa13df7c5a7eefd1225540241b2f6 | |
parent | fd43842041e8ca83b1baee94f053c814e144f98b (diff) | |
download | meson-08262c3102e250759c09f5cdde80f13fbbf3dc08.zip meson-08262c3102e250759c09f5cdde80f13fbbf3dc08.tar.gz meson-08262c3102e250759c09f5cdde80f13fbbf3dc08.tar.bz2 |
test runner: fix excluding null options
It was impossible to specify null arguments in the exclude array,
while they were passed properly in the code, they were stringified
while the entries in the options array were just completely removed.
To fix this, do not early stringify the argument name and option
together as that would make it impossible to properly match it to
None without introducing a new special case for the string "None".
So instead they are now kept as tuples and only stringified when
its actually needed.
-rwxr-xr-x | run_project_tests.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/run_project_tests.py b/run_project_tests.py index b55d116..8be63b2 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -832,15 +832,15 @@ def load_test_json(t: TestDef, stdout_mandatory: bool) -> T.List[TestDef]: t.stdout = stdout return [t] - new_opt_list: T.List[T.List[T.Tuple[str, bool, bool]]] + new_opt_list: T.List[T.List[T.Tuple[str, str, bool, bool]]] # 'matrix; entry is present, so build multiple tests from matrix definition - opt_list = [] # type: T.List[T.List[T.Tuple[str, bool, bool]]] + opt_list = [] # type: T.List[T.List[T.Tuple[str, str, bool, bool]]] matrix = test_def['matrix'] assert "options" in matrix for key, val in matrix["options"].items(): assert isinstance(val, list) - tmp_opts = [] # type: T.List[T.Tuple[str, bool, bool]] + tmp_opts = [] # type: T.List[T.Tuple[str, str, bool, bool]] for i in val: assert isinstance(i, dict) assert "val" in i @@ -856,10 +856,10 @@ def load_test_json(t: TestDef, stdout_mandatory: bool) -> T.List[TestDef]: # Add an empty matrix entry if i['val'] is None: - tmp_opts += [(None, skip, skip_expected)] + tmp_opts += [(key, None, skip, skip_expected)] continue - tmp_opts += [('{}={}'.format(key, i['val']), skip, skip_expected)] + tmp_opts += [(key, i['val'], skip, skip_expected)] if opt_list: new_opt_list = [] @@ -876,10 +876,10 @@ def load_test_json(t: TestDef, stdout_mandatory: bool) -> T.List[TestDef]: new_opt_list = [] for i in opt_list: exclude = False - opt_names = [x[0] for x in i] + opt_tuple = [(x[0], x[1]) for x in i] for j in matrix['exclude']: - ex_list = [f'{k}={v}' for k, v in j.items()] - if all([x in opt_names for x in ex_list]): + ex_list = [(k, v) for k, v in j.items()] + if all([x in opt_tuple for x in ex_list]): exclude = True break @@ -889,10 +889,10 @@ def load_test_json(t: TestDef, stdout_mandatory: bool) -> T.List[TestDef]: opt_list = new_opt_list for i in opt_list: - name = ' '.join([x[0] for x in i if x[0] is not None]) - opts = ['-D' + x[0] for x in i if x[0] is not None] - skip = any([x[1] for x in i]) - skip_expected = any([x[2] for x in i]) + name = ' '.join([f'{x[0]}={x[1]}' for x in i if x[1] is not None]) + opts = [f'-D{x[0]}={x[1]}' for x in i if x[1] is not None] + skip = any([x[2] for x in i]) + skip_expected = any([x[3] for x in i]) test = TestDef(t.path, name, opts, skip or t.skip) test.env.update(env) test.installed_files = installed |