diff options
author | Andres Gomez <agomez@igalia.com> | 2020-12-02 02:38:00 +0200 |
---|---|---|
committer | Andres Gomez <agomez@igalia.com> | 2020-12-03 21:33:08 +0200 |
commit | 5fafccc4c5cbb35c555756b0f2c6b640b4fb7c09 (patch) | |
tree | a92097738b5801611bfae6f2dc9357fa0e8daad3 /framework | |
parent | b1ef8101fa61a672f26b79b757868b773557336c (diff) |
framework: fix loading time start/end in junit test results
v2:
- Added fixes line.
Fixes: 733dddbc3 ("framework/backends/junit.py: restore time from stderr")
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/423>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/backends/junit.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/framework/backends/junit.py b/framework/backends/junit.py index e6b1a2069..324f388c2 100644 --- a/framework/backends/junit.py +++ b/framework/backends/junit.py @@ -45,6 +45,9 @@ __all__ = [ _JUNIT_SPECIAL_NAMES = ('api', 'search') +_PID_STR = "pid: " +_START_TIME_STR = "start time: " +_END_TIME_STR = "end time: " def junit_escape(name): name = name.replace('.', '_') @@ -85,8 +88,10 @@ class JUnitWriter(object): """Adds the 'system-err' element.""" err = etree.SubElement(element, 'system-err') err.text = data.err - err.text += '\n\npid: {}\nstart time: {}\nend time: {}\n'.format( - data.pid, data.time.start, data.time.end) + err.text += '\n\n{}{}\n{}{}\n{}{}\n'.format( + _PID_STR, data.pid, + _START_TIME_STR, data.time.start, + _END_TIME_STR, data.time.end) if data.result in ['fail', 'dmesg-warn', 'dmesg-fail']: if expected_result == "failure": @@ -410,14 +415,14 @@ def _load(results_file): # Try to get the values in stderr for time and pid for line in result.err.split('\n'): - if line.startswith('time start:'): - result.time.start = float(line[len('time start: '):]) + if line.startswith(_START_TIME_STR): + result.time.start = float(line[len(_START_TIME_STR):]) continue - elif line.startswith('time end:'): - result.time.end = float(line[len('time end: '):]) + elif line.startswith(_END_TIME_STR): + result.time.end = float(line[len(_END_TIME_STR):]) continue - elif line.startswith('pid:'): - result.pid = json.loads(line[len('pid: '):]) + elif line.startswith(_PID_STR): + result.pid = json.loads(line[len(_PID_STR):]) continue |