Compare commits

..

No commits in common. "8cf85bb5750766cf0cff53b0b73be5a5a39279f5" and "92cad3f82dd314cd4d84a85448c499b9e71a7ae8" have entirely different histories.

7 changed files with 31 additions and 77 deletions

View File

@ -13,12 +13,13 @@ check_result_qemu() {
[[ -f $initdir/failed ]] && cp -a $initdir/failed $TESTDIR
cryptsetup luksOpen ${LOOPDEV}p2 varcrypt <$TESTDIR/keyfile
mount /dev/mapper/varcrypt $initdir/var
save_journal $initdir/var/log/journal
cp -a $initdir/var/log/journal $TESTDIR
rm -r $initdir/var/log/journal/*
_umount_dir $initdir/var
_umount_dir $initdir
cryptsetup luksClose /dev/mapper/varcrypt
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
echo $JOURNAL_LIST
ls -l $TESTDIR/journal/*/*.journal
test -s $TESTDIR/failed && ret=$(($ret+1))
return $ret
}

View File

@ -46,9 +46,7 @@ test_create_image() {
cp systemd_test.if $initdir/systemd-test-module
dracut_install -o sesearch
dracut_install runcon
dracut_install checkmodule semodule semodule_package m4 make load_policy sefcontext_compile
dracut_install -o /usr/libexec/selinux/hll/pp # Fedora/RHEL/...
dracut_install -o /usr/lib/selinux/hll/pp # Debian/Ubuntu/...
dracut_install checkmodule semodule semodule_package m4 make /usr/libexec/selinux/hll/pp load_policy sefcontext_compile
)
}

View File

@ -15,8 +15,8 @@ test_create_image() {
setup_basic_environment
mask_supporting_services
../create-busybox-container $initdir/testsuite-13.nc-container
initdir="$initdir/testsuite-13.nc-container" dracut_install nc ip
../create-busybox-container $initdir/nc-container
initdir="$initdir/nc-container" dracut_install nc ip
)
}

View File

@ -30,7 +30,8 @@ check_result_nspawn() {
cat $1/testok
fi
fi
save_journal $1/var/log/journal
cp -a $1/var/log/journal $TESTDIR
rm -r $1/var/log/journal/*
_umount_dir $initdir
[[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
return $_ret
@ -54,7 +55,8 @@ check_result_qemu() {
cat $initdir/testok
fi
fi
save_journal $initdir/var/log/journal
cp -a $initdir/var/log/journal $TESTDIR
rm -r $initdir/var/log/journal/*
_umount_dir $initdir
[[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
return $_ret

View File

@ -4,61 +4,44 @@ set -e
BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)"
if [ $# -gt 0 ]; then
args="$@"
do_clean=0
else
args="setup run clean-again"
do_clean=1
fi
args_no_clean=$(sed -r 's/(^| )clean($| )/ /g' <<<$args)
do_clean=$( [ "$args" = "$args_no_clean" ]; echo $? )
ninja -C "$BUILD_DIR"
declare -A results
declare -A times
COUNT=0
FAILURES=0
cd "$(dirname "$0")"
# Let's always do the cleaning operation first, because it destroys the image
# cache.
if [ $do_clean = 1 ]; then
for TEST in TEST-??-* ; do
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean )
done
fi
pass_blacklist() {
for marker in $BLACKLIST_MARKERS; do
if [ -f "$1/$marker" ]; then
echo "========== BLACKLISTED: $1 ($marker) =========="
return 1
fi
done
return 0
}
for TEST in TEST-??-* ; do
COUNT=$(($COUNT+1))
pass_blacklist $TEST || continue
start=$(date +%s)
echo -e "\n--x-- Running $TEST --x--"
set +e
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args_no_clean )
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args )
RESULT=$?
set -e
echo "--x-- Result of $TEST: $RESULT --x--"
results["$TEST"]="$RESULT"
times["$TEST"]=$(( $(date +%s) - $start ))
[ "$RESULT" -ne "0" ] && FAILURES=$(($FAILURES+1))
done
if [ $FAILURES -eq 0 -a $do_clean = 1 ]; then
for TEST in ${!results[@]}; do
for TEST in TEST-??-* ; do
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean-again )
done
fi
@ -67,9 +50,11 @@ echo ""
for TEST in ${!results[@]}; do
RESULT="${results[$TEST]}"
time="${times[$TEST]}"
string=$([ "$RESULT" = "0" ] && echo "SUCCESS" || echo "FAIL")
printf "%-35s %-8s (%3s s)\n" "${TEST}:" "${string}" "$time"
if [ "$RESULT" -eq "0" ] ; then
echo "$TEST: SUCCESS"
else
echo "$TEST: FAIL"
fi
done | sort
if [ "$FAILURES" -eq 0 ] ; then

View File

@ -675,7 +675,7 @@ cleanup_loopdev() {
fi
}
trap cleanup_loopdev EXIT INT QUIT PIPE
trap cleanup_loopdev EXIT
create_empty_image() {
if [ -z "$IMAGE_NAME" ]; then
@ -790,39 +790,16 @@ check_asan_reports() {
return $ret
}
save_journal() {
if [ -n "${ARTIFACT_DIRECTORY}" ]; then
dest="${ARTIFACT_DIRECTORY}/${testname}.journal"
else
dest="$TESTDIR/system.journal"
fi
for j in $1/*; do
/usr/lib/systemd/systemd-journal-remote \
-o $dest \
--getter="journalctl -o export -D $j"
if [ -n "${TEST_SHOW_JOURNAL}" ]; then
echo "---- $j ----"
journalctl --no-pager -o short-monotonic --no-hostname --priority=${TEST_SHOW_JOURNAL} -D $j
fi
rm -r $j
done
# we want to print this sometime later, so save this in a variable
JOURNAL_LIST="$(ls -l $dest*)"
}
check_result_nspawn() {
local ret=1
local journald_report=""
local pids=""
[[ -e $1/testok ]] && ret=0
[[ -f $1/failed ]] && cp -a $1/failed $TESTDIR
save_journal $1/var/log/journal
cp -a $1/var/log/journal $TESTDIR
rm -r $1/var/log/journal/*
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
echo $JOURNAL_LIST
ls -l $TESTDIR/journal/*/*.journal
test -s $TESTDIR/failed && ret=$(($ret+1))
[ -n "$TIMED_OUT" ] && ret=$(($ret+1))
check_asan_reports "$1" || ret=$(($ret+1))
@ -836,11 +813,12 @@ check_result_qemu() {
mount_initdir
[[ -e $initdir/testok ]] && ret=0
[[ -f $initdir/failed ]] && cp -a $initdir/failed $TESTDIR
save_journal $initdir/var/log/journal
cp -a $initdir/var/log/journal $TESTDIR
rm -r $initdir/var/log/journal/*
check_asan_reports "$initdir" || ret=$(($ret+1))
_umount_dir $initdir
[[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
echo $JOURNAL_LIST
ls -l $TESTDIR/journal/*/*.journal
test -s $TESTDIR/failed && ret=$(($ret+1))
[ -n "$TIMED_OUT" ] && ret=$(($ret+1))
return $ret
@ -941,12 +919,6 @@ install_config_files() {
# set the hostname
echo systemd-testsuite > $initdir/etc/hostname
# let's set up just one image with the traditional verbose output
if [ ${IMAGE_NAME} != "basic" ]; then
mkdir -p $initdir/etc/systemd/system.conf.d
echo -e '[Manager]\nStatusUnitFormat=name' >$initdir/etc/systemd/system.conf.d/status.conf
fi
}
install_basic_tools() {

View File

@ -33,8 +33,7 @@ fi
function check_bind_tmp_path {
# https://github.com/systemd/systemd/issues/4789
local _root="/var/lib/machines/testsuite-13.bind-tmp-path"
rm -rf "$_root"
local _root="/var/lib/machines/bind-tmp-path"
/usr/lib/systemd/tests/testdata/create-busybox-container "$_root"
>/tmp/bind
systemd-nspawn --register=no -D "$_root" --bind=/tmp/bind /bin/sh -c 'test -e /tmp/bind'
@ -42,8 +41,7 @@ function check_bind_tmp_path {
function check_norbind {
# https://github.com/systemd/systemd/issues/13170
local _root="/var/lib/machines/testsuite-13.norbind-path"
rm -rf "$_root"
local _root="/var/lib/machines/norbind-path"
mkdir -p /tmp/binddir/subdir
echo -n "outer" > /tmp/binddir/subdir/file
mount -t tmpfs tmpfs /tmp/binddir/subdir
@ -55,9 +53,8 @@ function check_norbind {
function check_notification_socket {
# https://github.com/systemd/systemd/issues/4944
local _cmd='echo a | $(busybox which nc) -U -u -w 1 /run/systemd/nspawn/notify'
# /testsuite-13.nc-container is prepared by test.sh
systemd-nspawn --register=no -D /testsuite-13.nc-container /bin/sh -x -c "$_cmd"
systemd-nspawn --register=no -D /testsuite-13.nc-container -U /bin/sh -x -c "$_cmd"
systemd-nspawn --register=no -D /nc-container /bin/sh -x -c "$_cmd"
systemd-nspawn --register=no -D /nc-container -U /bin/sh -x -c "$_cmd"
}
function run {
@ -70,8 +67,7 @@ function run {
return 0
fi
local _root="/var/lib/machines/testsuite-13.unified-$1-cgns-$2-api-vfs-writable-$3"
rm -rf "$_root"
local _root="/var/lib/machines/unified-$1-cgns-$2-api-vfs-writable-$3"
/usr/lib/systemd/tests/testdata/create-busybox-container "$_root"
SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" -b
SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" --private-network -b