#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Basic systemd setup"
IMAGE_NAME="basic"
RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes}
TEST_REQUIRE_INSTALL_TESTS=0
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
test_append_files() {
# install tests manually so the test is functional even when -Dinstall-tests=false
- local dst="$1/usr/lib/systemd/tests/testdata/units/"
+ local dst="${1:?}/usr/lib/systemd/tests/testdata/units/"
mkdir -p "$dst"
- cp -v $TEST_UNITS_DIR/{testsuite-01,end}.service $TEST_UNITS_DIR/testsuite.target "$dst"
+ cp -v "$TEST_UNITS_DIR"/{testsuite-01,end}.service "$TEST_UNITS_DIR/testsuite.target" "$dst"
}
do_test "$@" 01
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Run unit tests under containers"
RUN_IN_UNPRIVILEGED_CONTAINER=yes
$KERNEL_APPEND
"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
check_result_nspawn() {
- local _ret=1
- [[ -e $1/testok ]] && _ret=0
- if [[ -s $1/failed ]]; then
- _ret=$(($_ret+1))
+ local workspace="${1:?}"
+ local ret=1
+
+ [[ -e "$workspace/testok" ]] && ret=0
+
+ if [[ -s "$workspace/failed" ]]; then
+ ret=$((ret + 1))
echo "=== Failed test log ==="
- cat $1/failed
+ cat "$workspace/failed"
else
- if [[ -s $1/skipped ]]; then
+ if [[ -s "$workspace/skipped" ]]; then
echo "=== Skipped test log =="
- cat $1/skipped
+ cat "$workspace/skipped"
fi
- if [[ -s $1/testok ]]; then
+ if [[ -s "$workspace/testok" ]]; then
echo "=== Passed tests ==="
- cat $1/testok
+ cat "$workspace/testok"
fi
fi
- save_journal $1/var/log/journal
- _umount_dir $initdir
- [[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
- return $_ret
+
+ save_journal "$workspace/var/log/journal"
+ _umount_dir "${initdir:?}"
+
+ [[ -n "${TIMED_OUT:=}" ]] && ret=$((ret + 1))
+ return $ret
}
check_result_qemu() {
- local _ret=1
+ local ret=1
+
mount_initdir
- [[ -e $initdir/testok ]] && _ret=0
- if [[ -s $initdir/failed ]]; then
- _ret=$(($_ret+1))
+ [[ -e "${initdir:?}/testok" ]] && ret=0
+
+ if [[ -s "$initdir/failed" ]]; then
+ ret=$((ret + 1))
echo "=== Failed test log ==="
- cat $initdir/failed
+ cat "$initdir/failed"
else
- if [[ -s $initdir/skipped ]]; then
+ if [[ -s "$initdir/skipped" ]]; then
echo "=== Skipped test log =="
- cat $initdir/skipped
+ cat "$initdir/skipped"
fi
- if [[ -s $initdir/testok ]]; then
+ if [[ -s "$initdir/testok" ]]; then
echo "=== Passed tests ==="
- cat $initdir/testok
+ cat "$initdir/testok"
fi
fi
- save_journal $initdir/var/log/journal
- _umount_dir $initdir
- [[ -n "$TIMED_OUT" ]] && _ret=$(($_ret+1))
- return $_ret
+
+ save_journal "$initdir/var/log/journal"
+ _umount_dir "$initdir"
+
+ [[ -n "${TIMED_OUT:=}" ]] && ret=$((ret + 1))
+ return $ret
}
do_test "$@" 02
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Job-related tests"
TEST_NO_QEMU=1
IMAGE_NAME="default"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 03
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Journal-related tests"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 04
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Resource limits-related tests"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 05
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="SELinux tests"
IMAGE_NAME="selinux"
TEST_NO_NSPAWN=1
# Check if selinux-policy-devel is installed, and if it isn't bail out early instead of failing
test -f /usr/share/selinux/devel/include/system/systemd.if || exit 0
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
SETUP_SELINUX=yes
-KERNEL_APPEND="$KERNEL_APPEND selinux=1 security=selinux"
+KERNEL_APPEND="${KERNEL_APPEND:=} selinux=1 security=selinux"
test_append_files() {
(
+ local workspace="${1:?}"
+ local policy_headers_dir=/usr/share/selinux/devel
+ local modules_dir=/var/lib/selinux
+
setup_selinux
- local _modules_dir=/var/lib/selinux
- rm -rf $1/$_modules_dir
- if ! cp -ar $_modules_dir $1/$_modules_dir; then
- dfatal "Failed to copy $_modules_dir"
+ # Make sure we never expand this to "/..."
+ rm -rf "${workspace:?}/$modules_dir"
+
+ if ! cp -ar "$modules_dir" "$workspace/$modules_dir"; then
+ dfatal "Failed to copy $modules_dir"
exit 1
fi
- local _policy_headers_dir=/usr/share/selinux/devel
- rm -rf $1/$_policy_headers_dir
+ rm -rf "${workspace:?}/$policy_headers_dir"
inst_dir /usr/share/selinux
- if ! cp -ar $_policy_headers_dir $1/$_policy_headers_dir; then
- dfatal "Failed to copy $_policy_headers_dir"
+
+ if ! cp -ar "$policy_headers_dir" "$workspace/$policy_headers_dir"; then
+ dfatal "Failed to copy $policy_headers_dir"
exit 1
fi
- mkdir $1/systemd-test-module
- cp systemd_test.te $1/systemd-test-module
- cp systemd_test.if $1/systemd-test-module
- cp systemd_test.fc $1/systemd-test-module
+ mkdir "$workspace/systemd-test-module"
+ cp systemd_test.te "$workspace/systemd-test-module"
+ cp systemd_test.if "$workspace/systemd-test-module"
+ cp systemd_test.fc "$workspace/systemd-test-module"
dracut_install -o sesearch
dracut_install runcon
dracut_install checkmodule semodule semodule_package m4 make load_policy sefcontext_compile
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/1981"
TEST_NO_QEMU=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
NSPAWN_TIMEOUT=30
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2730"
IMAGE_NAME="test08"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
QEMU_TIMEOUT=300
FSTYPE=ext4
TEST_FORCE_NEWIMAGE=1
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2691"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
QEMU_TIMEOUT=300
do_test "$@" 09
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2467"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 10
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/3166"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 11
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/3171"
TEST_NO_QEMU=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 12
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="systemd-nspawn smoke test"
IMAGE_NAME="nspawn"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
test_append_files() {
(
- ../create-busybox-container $1/testsuite-13.nc-container
- initdir="$1/testsuite-13.nc-container" dracut_install nc ip md5sum
+ local workspace="${1:?}"
+
+ "$TEST_BASE_DIR/create-busybox-container" "$workspace/testsuite-13.nc-container"
+ initdir="$workspace/testsuite-13.nc-container" dracut_install nc ip md5sum
)
}
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="/etc/machine-id testing"
IMAGE_NAME="badid"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
test_append_files() {
- printf "556f48e837bc4424a710fa2e2c9d3e3c\ne3d\n" >$1/etc/machine-id
+ printf "556f48e837bc4424a710fa2e2c9d3e3c\ne3d\n" >"${1:?}/etc/machine-id"
}
do_test "$@" 14
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Dropin tests"
TEST_NO_QEMU=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 15
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="EXTEND_TIMEOUT_USEC=usec start/runtime/stop tests"
SKIP_INITRD=yes
TEST_NO_QEMU=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 16
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="UDEV"
IMAGE_NAME="udev"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
QEMU_TIMEOUT=500
test_append_files() {
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="FailureAction= operation"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
QEMU_TIMEOUT=600
do_test "$@" 18
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test cgroup delegation in the unified hierarchy"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
QEMU_TIMEOUT=600
UNIFIED_CGROUP_HIERARCHY=yes
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test changing main PID"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 20
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Tmpfiles related tests"
TEST_NO_QEMU=1
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
test_append_files() {
- if [[ "$IS_BUILT_WITH_ASAN" == "yes" ]]; then
- if [[ -z "$initdir" ]]; then
+ if [[ "${IS_BUILT_WITH_ASAN:=}" == "yes" ]]; then
+ if [[ -z "${initdir:=}" ]]; then
echo >&2 "\$initdir is not defined, can't continue"
exit 1
fi
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test Type=exec"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 23
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="cryptsetup systemd setup"
IMAGE_NAME="cryptsetup"
TEST_NO_NSPAWN=1
TEST_FORCE_NEWIMAGE=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
check_result_qemu() {
- ret=1
+ local ret=1
+
mount_initdir
- [[ -e $initdir/testok ]] && ret=0
- [[ -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
- _umount_dir $initdir/var
- _umount_dir $initdir
+ [[ -e "${initdir:?}/testok" ]] && ret=0
+ [[ -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"
+ _umount_dir "$initdir/var"
+ _umount_dir "$initdir"
cryptsetup luksClose /dev/mapper/varcrypt
- [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
- echo $JOURNAL_LIST
- test -s $TESTDIR/failed && ret=$(($ret+1))
+
+ [[ -f "$TESTDIR/failed" ]] && cat "$TESTDIR/failed"
+ echo "${JOURNAL_LIST:-No journals were saved}"
+
+ test -s "$TESTDIR/failed" && ret=$((ret + 1))
return $ret
}
test_create_image() {
create_empty_image_rootdir
- echo -n test >$TESTDIR/keyfile
- cryptsetup -q luksFormat --pbkdf pbkdf2 --pbkdf-force-iterations 1000 ${LOOPDEV}p2 $TESTDIR/keyfile
- cryptsetup luksOpen ${LOOPDEV}p2 varcrypt <$TESTDIR/keyfile
+
+ echo -n test >"${TESTDIR:?}/keyfile"
+ cryptsetup -q luksFormat --pbkdf pbkdf2 --pbkdf-force-iterations 1000 "${LOOPDEV:?}p2" "$TESTDIR/keyfile"
+ cryptsetup luksOpen "${LOOPDEV}p2" varcrypt <"$TESTDIR/keyfile"
mkfs.ext4 -L var /dev/mapper/varcrypt
- mkdir -p $initdir/var
- mount /dev/mapper/varcrypt $initdir/var
+ mkdir -p "${initdir:?}/var"
+ mount /dev/mapper/varcrypt "$initdir/var"
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
- eval $(udevadm info --export --query=env --name=/dev/mapper/varcrypt)
- eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
+ # shellcheck source=/dev/null
+ source <(udevadm info --export --query=env --name=/dev/mapper/varcrypt)
+ # shellcheck source=/dev/null
+ source <(udevadm info --export --query=env --name="${LOOPDEV}p2")
setup_basic_environment
mask_supporting_services
install_dmevent
generate_module_dependencies
- cat >$initdir/etc/crypttab <<EOF
+ cat >"$initdir/etc/crypttab" <<EOF
$DM_NAME UUID=$ID_FS_UUID /etc/varkey
EOF
- echo -n test >$initdir/etc/varkey
- cat $initdir/etc/crypttab | ddebug
+ echo -n test >"$initdir/etc/varkey"
+ ddebug <"$initdir/etc/crypttab"
- cat >>$initdir/etc/fstab <<EOF
+ cat >>"$initdir/etc/fstab" <<EOF
/dev/mapper/varcrypt /var ext4 defaults 0 1
EOF
# Forward journal messages to the console, so we have something
# to investigate even if we fail to mount the encrypted /var
- echo ForwardToConsole=yes >> $initdir/etc/systemd/journald.conf
+ echo ForwardToConsole=yes >> "$initdir/etc/systemd/journald.conf"
)
}
cleanup_root_var() {
- ddebug "umount $initdir/var"
- mountpoint $initdir/var && umount $initdir/var
+ ddebug "umount ${initdir:?}/var"
+ mountpoint "$initdir/var" && umount "$initdir/var"
[[ -b /dev/mapper/varcrypt ]] && cryptsetup luksClose /dev/mapper/varcrypt
}
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test importd"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 25
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test setenv"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 26
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test StandardOutput=file:"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 27
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Ensure %j Wants directives work"
RUN_IN_UNPRIVILEGED_CONTAINER=yes
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 28
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
set -e
+
TEST_DESCRIPTION="test systemd-portabled"
IMAGE_NAME="portabled"
TEST_NO_NSPAWN=1
TEST_INSTALL_VERITY_MINIMAL=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
# Need loop devices for mounting images
test_append_files() {
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test OnClockChange= + OnTimezoneChange="
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 30
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="plugged -> dead -> plugged issue #11997"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
QEMU_TIMEOUT=300
do_test "$@" 31
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test OOM killer logic"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
UNIFIED_CGROUP_HIERARCHY=yes
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
set -e
+
TEST_DESCRIPTION="test CleanUnit"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 33
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test migrating state directory from DynamicUser=1 to DynamicUser=0 and back"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 34
TEST_DESCRIPTION="test NUMAPolicy= and NUMAMask= options"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
if qemu_min_version "5.2.0"; then
QEMU_OPTIONS="-object memory-backend-ram,id=mem0,size=512M -numa node,memdev=mem0,nodeid=0"
else
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
set -e
+
TEST_DESCRIPTION="test RuntimeDirectoryPreserve=yes"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 37
#!/bin/bash
set -e
+
TEST_DESCRIPTION="test unit freezing and thawing via DBus and systemctl"
TEST_NO_NSPAWN=1
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 38
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Test ExecReload= (PR #13098)"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 39
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test ExecXYZEx= service unit dbus hookups"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 40
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Test oneshot unit restart on failure"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 41
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test that ExecStopPost= is always run"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 42
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Test PrivateUsers=yes on user manager"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
has_user_dbus_socket || exit 0
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test log namespaces"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 44
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="testing homed"
TEST_NO_QEMU=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 46
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Test that KillMode=mixed does not leave left over processes with ExecStopPost="
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 47
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
set -e
+
TEST_DESCRIPTION="test StartStopNoReload"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 48
set -e
TEST_DESCRIPTION="test adding new BindPaths while unit is already running"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 49
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
set -e
+
TEST_DESCRIPTION="test systemd-dissect"
IMAGE_NAME="dissect"
TEST_NO_NSPAWN=1
TEST_INSTALL_VERITY_MINIMAL=1
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
command -v mksquashfs >/dev/null 2>&1 || exit 0
command -v veritysetup >/dev/null 2>&1 || exit 0
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="Test ExecCondition= does not restart on abnormal or failure"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 51
#!/bin/bash
set -e
-. $TEST_BASE_DIR/test-functions
+
TEST_REQUIRE_INSTALL_TESTS=0
TEST_DESCRIPTION="testing honor first shutdown"
-#INTERACTIVE_DEBUG=1
TEST_NO_QEMU=1
-#Using timeout because if the test fails it can loop.
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
+# Using timeout because if the test fails it can loop.
# The reason is because the poweroff executed by end.service
# could turn into a reboot if the test fails.
NSPAWN_TIMEOUT=20
-#Remove this file if it exists. this is used along with
-# the make target "finish". Since concrete confirmaion is
+# Remove this file if it exists. This is used along with
+# the make target "finish". Since concrete confirmation is
# only found from the console during the poweroff.
rm -f /tmp/honorfirstshutdown.log >/dev/null
TEST_DESCRIPTION="test timer units when initial clock is ahead"
TEST_NO_NSPAWN=1
-future_date=$(date -u +%Y-%m-%dT%H:%M:%S -d '+3 days')
-QEMU_OPTIONS="-rtc base=${future_date}"
-. $TEST_BASE_DIR/test-functions
+QEMU_OPTIONS="-rtc base=$(date -u +%Y-%m-%dT%H:%M:%S -d '+3 days')"
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 53
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test credentials"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 54
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="systemd-oomd Memory Pressure Test"
-. $TEST_BASE_DIR/test-functions
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
check_result_nspawn() {
+ local workspace="${1:?}"
local ret=1
local journald_report=""
local pids=""
- [[ -e $1/testok ]] && ret=0
- if [[ -e $1/skipped ]]; then
+
+ [[ -e "$workspace/testok" ]] && ret=0
+ if [[ -e "$workspace/skipped" ]]; then
echo "TEST-56-OOMD was skipped:"
- cat $1/skipped
+ cat "$workspace/skipped"
ret=0
fi
- [[ -f $1/failed ]] && cp -a $1/failed $TESTDIR
- save_journal $1/var/log/journal
- [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
- echo $JOURNAL_LIST
- test -s $TESTDIR/failed && ret=$(($ret+1))
- [ -n "$TIMED_OUT" ] && ret=$(($ret+1))
- check_asan_reports "$1" || ret=$(($ret+1))
- _umount_dir $initdir
+
+ [[ -f "$workspace/failed" ]] && cp -a "$workspace/failed" "${TESTDIR:?}"
+ save_journal "$workspace/var/log/journal"
+ [[ -f "$TESTDIR/failed" ]] && cat "$TESTDIR/failed"
+ echo "${JOURNAL_LIST:-No journals were saved}"
+
+ test -s "$TESTDIR/failed" && ret=$((ret + 1))
+ [ -n "${TIMED_OUT:=}" ] && ret=$((ret + 1))
+ check_asan_reports "$workspace" || ret=$((ret + 1))
+ _umount_dir "${initdir:?}"
return $ret
}
check_result_qemu() {
local ret=1
+
mount_initdir
- [[ -e $initdir/testok ]] && ret=0
- if [[ -e $initdir/skipped ]]; then
+ [[ -e "${initdir:?}/testok" ]] && ret=0
+ if [[ -e "$initdir/skipped" ]]; then
echo "TEST-56-OOMD was skipped:"
- cat $initdir/skipped
+ cat "$initdir/skipped"
ret=0
fi
- [[ -f $initdir/failed ]] && cp -a $initdir/failed $TESTDIR
- save_journal $initdir/var/log/journal
- check_asan_reports "$initdir" || ret=$(($ret+1))
- _umount_dir $initdir
- [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
- echo $JOURNAL_LIST
- test -s $TESTDIR/failed && ret=$(($ret+1))
- [ -n "$TIMED_OUT" ] && ret=$(($ret+1))
+
+ [[ -f "$initdir/failed" ]] && cp -a "$initdir/failed" "${TESTDIR:?}"
+ save_journal "$initdir/var/log/journal"
+ check_asan_reports "$initdir" || ret=$((ret + 1))
+ _umount_dir "$initdir"
+ [[ -f "$TESTDIR/failed" ]] && cat "$TESTDIR/failed"
+ echo "${JOURNAL_LIST:-No journals were saved}"
+
+ test -s "$TESTDIR/failed" && ret=$((ret + 1))
+ [ -n "${TIMED_OUT:=}" ] && ret=$((ret + 1))
return $ret
}
#!/usr/bin/env bash
set -e
+
TEST_DESCRIPTION="test ExitType=cgroup"
-. $TEST_BASE_DIR/test-functions
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@" 56