[igt-dev] [PATCH i-g-t] scripts/igt_doc.py: improve check tool to look at the right files

Kamil Konieczny kamil.konieczny at linux.intel.com
Tue Apr 4 15:47:15 UTC 2023


Hi Mauro,

On 2023-03-28 at 15:54:34 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
> 
> We can't rely only at the prefix, as a test list could include files
> from other places.
> 
> So, add a logic to look into the files listed at the configuration
- ^^^
s/So, add/Added/

> file.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
> ---
>  scripts/igt_doc.py | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
> index 92d925c451ed..f52d458bec60 100755
> --- a/scripts/igt_doc.py
> +++ b/scripts/igt_doc.py
> @@ -757,11 +757,18 @@ class TestList:
>  
>          """Compare documented subtests with the IGT test list"""
>  
> +        test_prefixes = {}
> +
> +        for cfg_file in self.config["files"]:
> +            prefix = "^igt@" + re.sub(r"(.*/)?(.*)\.[ch]",r"\2", cfg_file)
-------------------------------------------------------- ^
imho headers do not contain any tests ?

Regards,
Kamil

> +            test_prefixes[prefix] = 1
> +
>          doc_subtests = sorted(self.get_subtests()[""])
>  
>          for i in range(0, len(doc_subtests)): # pylint: disable=C0200
>              doc_subtests[i] = re.sub(r'\<[^\>]+\>', r'\\d+', doc_subtests[i])
>  
> +        # Just to optimize the runner
>          test_prefix = os.path.commonprefix(doc_subtests)
>  
>          # Get a list of tests from
> @@ -775,7 +782,17 @@ class TestList:
>              print("Error:", sub_err)
>              sys.exit(1)
>  
> -        run_subtests = sorted(result.stdout.splitlines())
> +        run_subtests = []
> +        for subtest in result.stdout.splitlines():
> +            found = 0
> +            for prefix in test_prefixes.keys():
> +                if re.match(prefix, subtest):
> +                    found = 1
> +                    break
> +            if found:
> +                run_subtests.append(subtest)
> +
> +        run_subtests = sorted(run_subtests)
>  
>          # Compare arrays
>  
> -- 
> 2.39.2
> 


More information about the igt-dev mailing list