mirror of
https://github.com/systemd/systemd
synced 2024-10-14 20:17:52 +00:00
test: use systemd-journal-remote for journal copying, support $ARTIFACT_DIRECTORY
Using s-j-remote fixes the following issue: when coalescing files from multiple inputs, simply copying all files with into the the same directory might potentially mess things up, because a newer system.journal might overwrite an older journal. This happens because we run multiple tests from the same image, and need to clean out the directory after each run. By using systemd-journal-remote, we nicely coalesce all files. This has the advantage that if there aren't too many logs, we end up with just one journal file. ARTIFACT_DIRECTORY is for ubuntuautopackagetests, where the journal files are copied to a separate directory to preserve after tests have been run. This functionality can now be recreated by setting ARTIFACT_DIRECTORY=$AUTOPKGTEST_ARTIFACTS.
This commit is contained in:
parent
8943daf813
commit
f9eb2d51da
|
@ -791,13 +791,21 @@ check_asan_reports() {
|
|||
}
|
||||
|
||||
save_journal() {
|
||||
dest="${TESTDIR}"
|
||||
if [ -n "${ARTIFACT_DIRECTORY}" ]; then
|
||||
dest="${ARTIFACT_DIRECTORY}/${testname}.journal"
|
||||
else
|
||||
dest="$TESTDIR/system.journal"
|
||||
fi
|
||||
|
||||
cp -a $1 "$dest/"
|
||||
rm -r $1/*
|
||||
for j in $1/*; do
|
||||
/usr/lib/systemd/systemd-journal-remote \
|
||||
-o $dest \
|
||||
--getter="journalctl -o export -D $j"
|
||||
rm -r $j
|
||||
done
|
||||
|
||||
# we want to print this sometime later, so save this in a variable
|
||||
JOURNAL_LIST="$(ls -l $dest/*/*/*.journal 2>&1)"
|
||||
JOURNAL_LIST="$(ls -l $dest*)"
|
||||
}
|
||||
|
||||
check_result_nspawn() {
|
||||
|
|
Loading…
Reference in a new issue