intel/genxml: Fix comparing xml when node counts differ
authorJordan Justen <jordan.l.justen@intel.com>
Tue, 15 Aug 2023 10:07:30 +0000 (03:07 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 6 Sep 2023 07:18:47 +0000 (07:18 +0000)
This fix is more relevant to MR !20593. Normally when sorting the
number of nodes will be equivalent today, so this bug will not be
encountered. But in !20593, we can shrink (--import) or grow the
number of elements (--flatten) when the genxml_import.py tool is used.

Fixes: e60a0b16163 ("intel/genxml: Move sorting & writing into GenXml class")
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24902>

src/intel/genxml/intel_genxml.py

index 21fe159..9cb9021 100755 (executable)
@@ -199,6 +199,8 @@ class GenXml(object):
         return clone
 
     def is_equivalent_xml(self, other):
+        if len(self.et.getroot()) != len(other.et.getroot()):
+            return False
         return all(node_validator(old, new)
                    for old, new in zip(self.et.getroot(), other.et.getroot()))