[PATCH i-g-t 09/10] scripts/xls_to_doc.py: better handle common attributes

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Mar 15 08:42:58 UTC 2024


Hi Mauro,
On 2024-03-14 at 11:29:18 +0100, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
> 

Please add description here, with that:

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

> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
> ---
>  scripts/xls_to_doc.py | 27 ++++++++++++++++++++-------
>  1 file changed, 20 insertions(+), 7 deletions(-)
> 
> diff --git a/scripts/xls_to_doc.py b/scripts/xls_to_doc.py
> index 03feae5834d7..60f7536c8839 100755
> --- a/scripts/xls_to_doc.py
> +++ b/scripts/xls_to_doc.py
> @@ -31,9 +31,10 @@ class FillTests(TestList):
>      def __init__(self, config_path, verbose):
>          self.tests = {}
>          self.spreadsheet_data = {}
> -        self.ignore_fields = []
>          self.verbose = verbose
>  
> +        self.update_fields = []
> +
>          # Read current documentation
>          TestList.__init__(self, config_path)
>  
> @@ -78,7 +79,9 @@ class FillTests(TestList):
>              if "sublevel" in item["_properties_"]:
>                  update = item["_properties_"].get("update-from-file")
>                  if update:
> -                    self.ignore_fields.append(field)
> +                    continue
> +
> +            self.update_fields.append(field)
>  
>      def add_field(self, dic, field, value):
>          """
> @@ -276,8 +279,22 @@ class FillTests(TestList):
>  
>              test_nr = self.tests[testname]["Test"]
>  
> +            # Update common fields
>              doc_content = self.orig_doc[test_nr]
> +            fields = set(self.doc[test_nr].keys()) | set(doc_content.keys())
>  
> +            for field in sorted(fields):
> +                if field not in self.update_fields:
> +                    continue
> +
> +                value = self.doc[test_nr].get(field, "")
> +                doc_value = doc_content.get(field, "")
> +
> +                if doc_value == value:
> +                    continue
> +
> +
> +            # Update subtest fields
>              for subtest, subtest_content in sorted(self.tests[testname]["subtests"].items()):
>                  if "line" not in subtest_content:
>                      print(f"Warning: didn't find where {subtest} is documented.")
> @@ -298,11 +315,7 @@ class FillTests(TestList):
>                  fields = set(subtest_content.keys()) | set(doc_content.keys())
>  
>                  for field in sorted(fields):
> -                    if field not in self.props:
> -                        continue
> -
> -                    if args.ignore_lists:
> -                        if field in self.ignore_fields:
> +                    if field not in self.update_fields:
>                              continue
>  
>                      value = subtest_content.get(field, "")
> -- 
> 2.43.2
> 


More information about the igt-dev mailing list