diff options
author | Ross Burton <ross.burton@arm.com> | 2023-07-20 16:51:50 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-07-21 11:52:26 +0100 |
commit | b398c7653ec6272178dd6403dfcadf475f677bf5 (patch) | |
tree | 03500f603fb1ce3c115530cd868eade0d716bac6 /meta/lib/oeqa/runtime | |
parent | aceb924845e0a77c878c3aea2941e2d3548b5a61 (diff) | |
download | poky-b398c7653ec6272178dd6403dfcadf475f677bf5.tar.gz |
oeqa/ltp: rewrote LTP testcase and parser
The LTP test reporting appears to be a little fragile so I tried to make
it more reliable.
Primarily this is done by not passing -p to runltp, which results in
machine-readable logfiles instead of human-readable. These are easier
to parse and have more context in, so we can also report correctly
skipped tests.
(From OE-Core rev: d585c6062fcf452e7288f6f8fb540fd92cbf5ea2)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/ltp.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ltp.py b/meta/lib/oeqa/runtime/cases/ltp.py index a66d5d13d7..29c26d7d32 100644 --- a/meta/lib/oeqa/runtime/cases/ltp.py +++ b/meta/lib/oeqa/runtime/cases/ltp.py | |||
@@ -65,29 +65,34 @@ class LtpTest(LtpTestBase): | |||
65 | ltp_groups += ltp_fs | 65 | ltp_groups += ltp_fs |
66 | 66 | ||
67 | def runltp(self, ltp_group): | 67 | def runltp(self, ltp_group): |
68 | cmd = '/opt/ltp/runltp -f %s -p -q -r /opt/ltp -l /opt/ltp/results/%s -I 1 -d /opt/ltp' % (ltp_group, ltp_group) | 68 | # LTP appends to log files, so ensure we start with a clean log |
69 | self.target.deleteFiles("/opt/ltp/results/", ltp_group) | ||
70 | |||
71 | cmd = '/opt/ltp/runltp -f %s -q -r /opt/ltp -l /opt/ltp/results/%s -I 1 -d /opt/ltp' % (ltp_group, ltp_group) | ||
72 | |||
69 | starttime = time.time() | 73 | starttime = time.time() |
70 | (status, output) = self.target.run(cmd) | 74 | (status, output) = self.target.run(cmd) |
71 | endtime = time.time() | 75 | endtime = time.time() |
72 | 76 | ||
77 | # Write the console log to disk for convenience | ||
73 | with open(os.path.join(self.ltptest_log_dir, "%s-raw.log" % ltp_group), 'w') as f: | 78 | with open(os.path.join(self.ltptest_log_dir, "%s-raw.log" % ltp_group), 'w') as f: |
74 | f.write(output) | 79 | f.write(output) |
75 | 80 | ||
81 | # Also put the console log into the test result JSON | ||
76 | self.extras['ltpresult.rawlogs']['log'] = self.extras['ltpresult.rawlogs']['log'] + output | 82 | self.extras['ltpresult.rawlogs']['log'] = self.extras['ltpresult.rawlogs']['log'] + output |
77 | 83 | ||
78 | # copy nice log from DUT | 84 | # Copy the machine-readable test results locally so we can parse it |
79 | dst = os.path.join(self.ltptest_log_dir, "%s" % ltp_group ) | 85 | dst = os.path.join(self.ltptest_log_dir, ltp_group) |
80 | remote_src = "/opt/ltp/results/%s" % ltp_group | 86 | remote_src = "/opt/ltp/results/%s" % ltp_group |
81 | (status, output) = self.target.copyFrom(remote_src, dst, True) | 87 | (status, output) = self.target.copyFrom(remote_src, dst, True) |
82 | msg = 'File could not be copied. Output: %s' % output | ||
83 | if status: | 88 | if status: |
89 | msg = 'File could not be copied. Output: %s' % output | ||
84 | self.target.logger.warning(msg) | 90 | self.target.logger.warning(msg) |
85 | 91 | ||
86 | parser = LtpParser() | 92 | parser = LtpParser() |
87 | results, sections = parser.parse(dst) | 93 | results, sections = parser.parse(dst) |
88 | 94 | ||
89 | runtime = int(endtime-starttime) | 95 | sections['duration'] = int(endtime-starttime) |
90 | sections['duration'] = runtime | ||
91 | self.sections[ltp_group] = sections | 96 | self.sections[ltp_group] = sections |
92 | 97 | ||
93 | failed_tests = {} | 98 | failed_tests = {} |