[applied] tests/update-test-output.py: Adapt to some broken test output

Message ID 87ildi9780.fsf@redhat.com
State New
Headers
Series [applied] tests/update-test-output.py: Adapt to some broken test output |

Commit Message

Dodji Seketeli April 26, 2023, 12:08 p.m. UTC
  Hello,

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 | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
  

Patch

diff --git a/tests/update-test-output.py b/tests/update-test-output.py
index 39d96d72..7e321911 100755
--- a/tests/update-test-output.py
+++ b/tests/update-test-output.py
@@ -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()