From bfb7ccb372788a1214d868ea07a5bcee6fccb515 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Fri, 21 Apr 2023 19:55:49 +0200 Subject: [PATCH] tests/update-test-output.py: Adapt to some broken test output 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 --- tests/update-test-output.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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() -- 2.34.1