action #16166
closedLog per test
0%
Description
All the logs are into one file, called autoinst-log.txt. This single file contains all the logs for the tests that took part during a build. As you can probably imagine this file is rather big, sometimes up to 20K lines long. Inside of it, you can find all sorts of messages; no doubt about it. But ... I would like to propose to create log per test (aka *.pm
) which is imho much more helpful and meaningful.
This can be done by extracting the text between the ||| starting
and ||| finished
placeholders.
For example:
10:44:49.1221 26680 ||| starting boot_to_desktop tests/boot/boot_to_desktop.pm at 2016-11-18 10:44:49
... (extract)
... (this)
... (part)
10:45:21.5714 26680 ||| finished boot_to_desktop boot at 2016-11-18 10:45:21 (32 s)
As soon as you have successfully extracted the correct portion of the log file, you can save it as $test.log
(in that case it should be: boot_to_desktop.log
)
Then repeat the same procedure for all the tests which run during the build and save each log separately.
Attention : When a test fails, the placeholder for signaling the end of the test, is not the same. Expected keywords are failed
and died
.
For example:
starting=1; # Number of the line that the test log starts
finished=1 # Number of the line that the test log finishes
while IFS='' read -r line || [[ -n "$line" ]]; do
if [[ $line == *"starting $testname "* ]]
then
line_start=$starting
fi
if [[ $line == *"finished $testname "* ]] || [[ $line == *"$testname died"* ]] || [[ $line == *"$testname failed"* ]]
then
line_finish=$finished
fi
starting=$[$starting +1]
finished=$[$finished +1]
done < "$file"
PS: Most probably, the back-end developers have another (better) way of doing this, without looking for placeholders
, since this kind of wording can be changed anytime.