mirror of
https://github.com/systemd/systemd
synced 2024-09-06 00:41:36 +00:00
test: use a helper function to move the journal files
This commit is contained in:
parent
3597bf7550
commit
8943daf813
|
@ -13,13 +13,12 @@ check_result_qemu() {
|
||||||
[[ -f $initdir/failed ]] && cp -a $initdir/failed $TESTDIR
|
[[ -f $initdir/failed ]] && cp -a $initdir/failed $TESTDIR
|
||||||
cryptsetup luksOpen ${LOOPDEV}p2 varcrypt <$TESTDIR/keyfile
|
cryptsetup luksOpen ${LOOPDEV}p2 varcrypt <$TESTDIR/keyfile
|
||||||
mount /dev/mapper/varcrypt $initdir/var
|
mount /dev/mapper/varcrypt $initdir/var
|
||||||
cp -a $initdir/var/log/journal $TESTDIR
|
save_journal $initdir/var/log/journal
|
||||||
rm -r $initdir/var/log/journal/*
|
|
||||||
_umount_dir $initdir/var
|
_umount_dir $initdir/var
|
||||||
_umount_dir $initdir
|
_umount_dir $initdir
|
||||||
cryptsetup luksClose /dev/mapper/varcrypt
|
cryptsetup luksClose /dev/mapper/varcrypt
|
||||||
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
|
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
|
||||||
ls -l $TESTDIR/journal/*/*.journal
|
echo $JOURNAL_LIST
|
||||||
test -s $TESTDIR/failed && ret=$(($ret+1))
|
test -s $TESTDIR/failed && ret=$(($ret+1))
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,7 @@ check_result_nspawn() {
|
||||||
cat $1/testok
|
cat $1/testok
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cp -a $1/var/log/journal $TESTDIR
|
save_journal $1/var/log/journal
|
||||||
rm -r $1/var/log/journal/*
|
|
||||||
_umount_dir $initdir
|
_umount_dir $initdir
|
||||||
[[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
|
[[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
|
||||||
return $_ret
|
return $_ret
|
||||||
|
@ -55,8 +54,7 @@ check_result_qemu() {
|
||||||
cat $initdir/testok
|
cat $initdir/testok
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cp -a $initdir/var/log/journal $TESTDIR
|
save_journal $initdir/var/log/journal
|
||||||
rm -r $initdir/var/log/journal/*
|
|
||||||
_umount_dir $initdir
|
_umount_dir $initdir
|
||||||
[[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
|
[[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
|
||||||
return $_ret
|
return $_ret
|
||||||
|
|
|
@ -790,16 +790,25 @@ check_asan_reports() {
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
save_journal() {
|
||||||
|
dest="${TESTDIR}"
|
||||||
|
|
||||||
|
cp -a $1 "$dest/"
|
||||||
|
rm -r $1/*
|
||||||
|
|
||||||
|
# we want to print this sometime later, so save this in a variable
|
||||||
|
JOURNAL_LIST="$(ls -l $dest/*/*/*.journal 2>&1)"
|
||||||
|
}
|
||||||
|
|
||||||
check_result_nspawn() {
|
check_result_nspawn() {
|
||||||
local ret=1
|
local ret=1
|
||||||
local journald_report=""
|
local journald_report=""
|
||||||
local pids=""
|
local pids=""
|
||||||
[[ -e $1/testok ]] && ret=0
|
[[ -e $1/testok ]] && ret=0
|
||||||
[[ -f $1/failed ]] && cp -a $1/failed $TESTDIR
|
[[ -f $1/failed ]] && cp -a $1/failed $TESTDIR
|
||||||
cp -a $1/var/log/journal $TESTDIR
|
save_journal $1/var/log/journal
|
||||||
rm -r $1/var/log/journal/*
|
|
||||||
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
|
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
|
||||||
ls -l $TESTDIR/journal/*/*.journal
|
echo $JOURNAL_LIST
|
||||||
test -s $TESTDIR/failed && ret=$(($ret+1))
|
test -s $TESTDIR/failed && ret=$(($ret+1))
|
||||||
[ -n "$TIMED_OUT" ] && ret=$(($ret+1))
|
[ -n "$TIMED_OUT" ] && ret=$(($ret+1))
|
||||||
check_asan_reports "$1" || ret=$(($ret+1))
|
check_asan_reports "$1" || ret=$(($ret+1))
|
||||||
|
@ -813,12 +822,11 @@ check_result_qemu() {
|
||||||
mount_initdir
|
mount_initdir
|
||||||
[[ -e $initdir/testok ]] && ret=0
|
[[ -e $initdir/testok ]] && ret=0
|
||||||
[[ -f $initdir/failed ]] && cp -a $initdir/failed $TESTDIR
|
[[ -f $initdir/failed ]] && cp -a $initdir/failed $TESTDIR
|
||||||
cp -a $initdir/var/log/journal $TESTDIR
|
save_journal $initdir/var/log/journal
|
||||||
rm -r $initdir/var/log/journal/*
|
|
||||||
check_asan_reports "$initdir" || ret=$(($ret+1))
|
check_asan_reports "$initdir" || ret=$(($ret+1))
|
||||||
_umount_dir $initdir
|
_umount_dir $initdir
|
||||||
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
|
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
|
||||||
ls -l $TESTDIR/journal/*/*.journal
|
echo $JOURNAL_LIST
|
||||||
test -s $TESTDIR/failed && ret=$(($ret+1))
|
test -s $TESTDIR/failed && ret=$(($ret+1))
|
||||||
[ -n "$TIMED_OUT" ] && ret=$(($ret+1))
|
[ -n "$TIMED_OUT" ] && ret=$(($ret+1))
|
||||||
return $ret
|
return $ret
|
||||||
|
|
Loading…
Reference in a new issue