tests/update-test-output.py: Adapt to some broken test output
authorDodji Seketeli <dodji@redhat.com>
Fri, 21 Apr 2023 17:55:49 +0000 (19:55 +0200)
committerDodji Seketeli <dodji@redhat.com>
Tue, 25 Apr 2023 13:50:25 +0000 (15:50 +0200)
Sometimes, the output of runtestreaddwarf or runtestannotate are
broken due the fact that they execute test units in parallel and each
unit might emit output that watch on each other toes.

This fixes tests/update-test-output.py to take that into account.

As this is a helper tool used to update updates, it won't have any
impact on libabigail's output.

* tests/update-test-output.py (process): Don't expect the start
pattern of the main diff hunk to begin at the end of a line
because that can be broken for runtestreaddwarf and co.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
tests/update-test-output.py

index 39d96d725c5d6a295b9dd5465656034bd71beb4b..7e32191131b79bee6f50d7eac9e738df7b9c9e6c 100755 (executable)
@@ -54,17 +54,20 @@ def main():
 
 
 def process(input_file):
-    source = ""
-    dest = ""
+    source = None
+    dest = None
     for line in input_file:
-        m = re.match(r'^--- (.*?)\t', line)
+        m = re.match(r'(.*?)--- (.*?)\t', line)
         if m:
-            dest = m.group(1)
+            dest = m.group(2)
         else:
-            m = re.match(r'^\+\+\+ (.*?)\t', line)
+            m = re.match(r'(.*?)\+\+\+ (.*?)\t', line)
             if m:
-                source = m.group(1)
-                sys.stdout.write("cp " + source + " " + dest + "\n");
+                source = m.group(2)
+                if source != None and dest != None:
+                    sys.stdout.write("cp " + source + " " + dest + "\n");
+                    source = None
+                    dest = None
 
 if __name__ == "__main__":
     main()