[igt-dev] [PATCH i-g-t 1/3] scripts/test_list.py: allow ignoring uppercase on testlist read

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Oct 13 14:42:32 UTC 2023


Hi Mauro,
On 2023-10-13 at 11:29:27 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
> 
> There are some tests in KMS which uses uppercase names. Add a
> config option on test_list.py json handler to allow parsing
> testlist regular expressions on a case-insensitive way.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>

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

> ---
>  scripts/test_list.py | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index c0462188ba8a..c75d15bfca73 100644
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -321,6 +321,10 @@ class TestList:
>              self.props["Class"]["_properties_"]["level"] = 1
>              self.props["Class"]["_properties_"]["sublevel"] = sublevel_count[0] + 1
>  
> +        flags = 0
> +        if self.config.get("case_insensitive_testlist", False):
> +            flags |= re.IGNORECASE
> +
>          # Remove non-multilevel items, as we're only interested on
>          # hierarchical item levels here
>          for field, item in self.props.items():
> @@ -335,7 +339,7 @@ class TestList:
>                  testlist = {}
>                  for value in item["_properties_"]["testlists"]:
>                      for name in value.keys():
> -                        self.read_testlist(testlist, name, cfg_path + value[name])
> +                        self.read_testlist(testlist, name, cfg_path + value[name], flags)
>  
>                  item["_properties_"]["testlist"] = testlist
>  
> @@ -344,7 +348,7 @@ class TestList:
>                  blocklist = {}
>                  for value in item["_properties_"]["blocklists"]:
>                      for name in value.keys():
> -                        self.read_testlist(testlist, name, cfg_path + value[name])
> +                        self.read_testlist(testlist, name, cfg_path + value[name], flags)
>  
>                  item["_properties_"]["blocklist"] = blocklist
>  
> @@ -448,7 +452,7 @@ class TestList:
>  
>              self.__add_field(key, sublevel, hierarchy_level, field[key])
>  
> -    def read_testlist(self, testlist, name, filename):
> +    def read_testlist(self, testlist, name, filename, flags):
>          base = r"^\s*({}[^\s\{}]+)(\S*)\s*(\#.*)?$"
>          regex = re.compile(base.format(self.main_name, self.subtest_separator))
>  
> @@ -462,7 +466,7 @@ class TestList:
>                      subtest = match.group(2)
>                      if not subtest.endswith("$"):
>                          subtest += r"(\@.*)?$"
> -                    testlist[name].append(re.compile(f"{test}{subtest}"))
> +                    testlist[name].append(re.compile(f"{test}{subtest}", flags))
>  
>      def __filter_subtest(self, test, subtest, field_not_found_value):
>  
> -- 
> 2.41.0
> 


More information about the igt-dev mailing list