[PATCH i-g-t v3 7/8] scripts/igt_doc.py: simplify and cleanup tests_per_list logic

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Feb 9 13:14:02 UTC 2024


Hi Mauro,
On 2024-02-09 at 13:34:46 +0100, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
> 
> Re-do the logic which calculates tests_per_list dict inside
> gen_intelci_testlist():
> 
> - better handle "other" runtype;
> 
> - better handle driver name discovery logic.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
> ---
>  scripts/igt_doc.py | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
> index bf51e5f4ebb3..1b4f7eafd135 100755
> --- a/scripts/igt_doc.py
> +++ b/scripts/igt_doc.py
> @@ -61,36 +61,35 @@ class IgtTestList(TestList):
>          split_regex = re.compile(r",\s*")
>  
>          for subname, subtest in subtest_dict.items():
> -            run_types = subtest.get("Run type", "other")
> -            run_type_set = set(split_regex.split(run_types))
> -
> +            run_types = subtest.get("Run type", "other").lower()
> +            drivers = set()
>              run_type_set = set()
>              for run_type in set(split_regex.split(run_types)):
> -                run_type = run_type.lower()
> -
> -                drivers = set(self.drivers)
>  
>                  for driver in self.drivers:
> -                    driver = driver.lower()
> -
>                      if run_type.startswith(driver):
>                          run_type = re.sub(r"^" + driver + r"[\W_]*", "", run_type)
>                          drivers = set([driver])
>                          break
>  
> +                if not drivers:
> +                    drivers.update(self.drivers)
> +
> +                if not run_type:
> +                    run_type = "other"
> +
>                  run_type_set.add(run_type)
>  
> +            if not drivers:
> +                drivers = set(self.drivers)
> +
>              for driver in drivers:
>                  if driver not in tests_per_list:
>                      tests_per_list[driver] = {}
>  
>                  for run_type in run_type_set:
> -                    if not run_type:
> -                        run_type = "other"
> -
>                      if run_type not in tests_per_list[driver]:
>                          tests_per_list[driver][run_type] = {}
> -

imho this empty line should stay here but it is not a blocker

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

>                      if subname not in tests_per_list[driver][run_type]:
>                          tests_per_list[driver][run_type][subname] = {}
>  
> -- 
> 2.43.0
> 


More information about the igt-dev mailing list