Skip to content

Commit a80241d

Browse files
broonienuclearcat
authored andcommitted
automated: linux: ltp: Speed up parsing of JSON results
When parsing the JSON output from kirk we capture any logs that were generated for tests that didn't pass. Currently we do this by first invoking jq to generate a list of tests that were run, then for each test invoke jq again to check if the result was a pass or not. If the result wasn't a pass we then invoke jq again to get the log. This is wildly inefficient, we invoke a new copy of jq and parse the entire results file once per test on the test system in order to generate a list of tests that didn't pass (which will hopefully be much shorter than the list of those that fails). Fortunately jq is capable of directly generating the list of non-passing tests so we can do a single parse for the initial filter, update to do that. We still invoke jq again to generate the log files, these are all written into per-test files for reporting, but most of the time most tests should pass. With the existing implementation for the syscalls suite on an Avenger96 the results parsing takes longer than running the actual tests, currently it takes over an hour and 20 minutes for the full job but with this change that time is reduced to a bit under 50 minutes. Approximately 35 minutes of the jobs is taken running the tests so the actual parsing is about twice as fast, there are a lot of failures in these jobs and the benefits should be greater with a higher pass rate. Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 241be9a commit a80241d

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

automated/linux/ltp/ltp.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,9 @@ parse_ltp_output() {
165165
}
166166

167167
parse_ltp_json_results() {
168-
local result
169168
jq -r '.results| .[]| "\(.test_fqn) \(.test.result)"' "$1" \
170169
| sed 's/brok/fail/; s/conf/skip/' >> "${RESULT_FILE}"
171-
for test_fqn in $(jq -r '.results| .[]| .test_fqn' "$1"); do
172-
result="$(jq -r '.results | .[] | select(.test_fqn == "'"${test_fqn}"'") | .test.result' "$1")"
173-
if [ "${result}" = pass ]; then
174-
continue
175-
fi
170+
for test_fqn in $(jq -r '.results| .[]| select(.test.result != "pass") | .test_fqn' "$1"); do
176171
jq -r '.results | .[] | select(.test_fqn == "'"${test_fqn}"'") | .test.log' "$1" > ${OUTPUT}/${test_fqn}.log
177172
done
178173
}

0 commit comments

Comments
 (0)