[igt-dev] [PATCH i-g-t 2/2] scripts/test_list.py: fix and simplify missing doc check
Kamil Konieczny
kamil.konieczny at linux.intel.com
Tue Oct 10 15:15:19 UTC 2023
Hi Mauro,
On 2023-10-10 at 15:17:20 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
>
> Instead of using regexes, we can simply use sets to check what's
> missing. This make checks easier and less error-prone.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
> scripts/test_list.py | 34 ++++------------------------------
> 1 file changed, 4 insertions(+), 30 deletions(-)
>
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index daca290a02bd..c0462188ba8a 100644
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -1105,39 +1105,13 @@ class TestList:
>
> doc_subtests.add(subtest)
>
> - doc_subtests = list(sorted(doc_subtests))
> -
> # Get a list of tests from
> - run_subtests = self.get_testlist()
> + run_subtests = set(self.get_testlist())
>
> - # Compare arrays
> + # Compare sets
>
> - run_missing = []
> - doc_uneeded = []
> -
> - test_regex = r""
> - for doc_test in doc_subtests:
> - if test_regex != r"":
> - test_regex += r"|"
> - test_regex += doc_test
> -
> - test_regex = re.compile(r'^(' + test_regex + r')$')
> -
> - for doc_test in doc_subtests:
> - found = False
> - for run_test in run_subtests:
> - if test_regex.match(run_test):
> - found = True
> - break
> - if not found:
> - doc_uneeded.append(doc_test)
> -
> - for run_test in run_subtests:
> - found = False
> - if test_regex.match(run_test):
> - found = True
> - if not found:
> - run_missing.append(run_test)
> + run_missing = list(sorted(run_subtests - doc_subtests))
> + doc_uneeded = list(sorted(doc_subtests - run_subtests))
>
> if doc_uneeded:
> for test_name in doc_uneeded:
> --
> 2.41.0
>
More information about the igt-dev
mailing list