[igt-dev] [PATCH i-g-t 1/4] scripts/test_list.py: fix and simplify missing doc check

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Oct 9 10:46:31 UTC 2023


Hi Mauro,
On 2023-10-09 at 12:01:38 +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. I means an easier check and less error-prone.
---------- ^^^^^^^^^^^^^^^^^^^^^^^
Better: This make checks easier

Please merge this one as a last.

With this:
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

Regards,
Kamil
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
> ---
>  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