summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@collabora.co.uk>2015-02-17 18:10:35 (GMT)
committerRamiro Polla <ramiro.polla@collabora.co.uk>2015-02-17 18:10:35 (GMT)
commitada7e11524abbeda3f9c637e7c5a553c9ce0adaa (patch)
treeeb4124e8aead77345ee99e0fd5f753f86a7ae750
parentab75c9f4f363b490ebe073cec184d3de61028f0a (diff)
downloadtest-definitions-ada7e11524abbeda3f9c637e7c5a553c9ce0adaa.tar.gz
test-definitions-ada7e11524abbeda3f9c637e7c5a553c9ce0adaa.tar.xz
gst-validate: Update parser to latest gst-validate-launcher outputHEADmaster
* Results line now prints testcase id instead of "Results" * Results may appear out of order when running tests in parallel
-rwxr-xr-xgst-validate/gst-validate-parser.py49
1 files changed, 32 insertions, 17 deletions
diff --git a/gst-validate/gst-validate-parser.py b/gst-validate/gst-validate-parser.py
index fba2a83..7519669 100755
--- a/gst-validate/gst-validate-parser.py
+++ b/gst-validate/gst-validate-parser.py
@@ -9,7 +9,7 @@ import re
result_start_re = re.compile('\[(?P<cur_test_num>\d+) / (?P<total_num_tests>\d+)\] Launching: (?P<test_case_id>.*)')
result_command_re = re.compile(' Command: (?P<command>.*)')
result_logfile_re = re.compile(' - (?P<logfile>.*)')
-result_end_re = re.compile('Result: (?P<result>\w+)( (?P<message>.*))?')
+result_end_re = re.compile('\[(?P<cur_test_num>\d+) / (?P<total_num_tests>\d+)\] (?!Launching)(?P<test_case_id>.*): (?P<result>\w+)( (?P<message>.*))?')
# Get LAVA_RESULT_DIR, which is set by lava-test-shell
lava_result_dir = os.getenv('LAVA_RESULT_DIR')
@@ -24,6 +24,10 @@ except OSError:
# fixup dictionary for translating gst-validate's results into LAVA's
fixupdict = { 'Passed': 'pass', 'Failed': 'fail', 'Timeout': 'unknown' }
+# Results may appear out of order when running tests in parallel
+# Keep information for each testcase until the result is found
+test_cases = {}
+
# Parse stdout from gst-validate
for line in sys.stdin:
# Output stdout to LAVA's log as well
@@ -33,39 +37,39 @@ for line in sys.stdin:
match = result_start_re.match(line)
if match is not None:
test_case_id = match.group('test_case_id')
- test_case_dir = results_dir + test_case_id + '/'
-
- # Create directory for individual test results
- os.mkdir(test_case_dir)
-
- # Create directory for individual test results attachments
- attachments_dir = test_case_dir + 'attachments/'
- os.mkdir(attachments_dir)
+ test_cases[test_case_id] = { 'logfiles': [] }
continue
# Locate test command - currently unused
match = result_command_re.match(line)
if match is not None:
command = match.group('command')
+ test_cases[test_case_id]['command'] = command
continue
# Locate log files to be used as attachments
match = result_logfile_re.match(line)
if match is not None:
logfile = match.group('logfile')
- dest = attachments_dir + os.path.basename(logfile)
-
- # Copy log file into results
- shutil.copyfile(logfile, dest)
-
- # LAVA expects a .mimetype file for each attachment
- with open(dest + '.mimetype', 'w') as f:
- f.write('text/plain')
+ test_cases[test_case_id]['logfiles'].append(logfile)
continue
# Locate the results of a test report
match = result_end_re.match(line)
if match is not None:
+ test_case_id = match.group('test_case_id')
+
+ ### Create directory structure
+ test_case_dir = results_dir + test_case_id + '/'
+
+ # Create directory for individual test results
+ os.mkdir(test_case_dir)
+
+ # Create directory for individual test results attachments
+ attachments_dir = test_case_dir + 'attachments/'
+ os.mkdir(attachments_dir)
+
+ ### Get test result
result = match.group('result')
# Translate result from gst-validate to LAVA
@@ -84,6 +88,17 @@ for line in sys.stdin:
with open(test_case_dir + 'message', 'w') as f:
f.write(message)
+ ### Copy logfiles
+ for logfile in test_cases[test_case_id]['logfiles']:
+ dest = attachments_dir + os.path.basename(logfile)
+
+ # Copy log file into results
+ shutil.copyfile(logfile, dest)
+
+ # LAVA expects a .mimetype file for each attachment
+ with open(dest + '.mimetype', 'w') as f:
+ f.write('text/plain')
+
# Print test case results
# LAVA doesn't seem to like mixing results from signals and files
# sys.stdout.write('<LAVA_SIGNAL_TESTCASE TEST_CASE_ID=' \