mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
Merge pull request #23771 from mrc0mmand/test-tweaks
A couple of test-output-related tweaks
This commit is contained in:
commit
297cc64bfb
@ -14,15 +14,10 @@ TEST_NO_QEMU=1
|
||||
# could turn into a reboot if the test fails.
|
||||
NSPAWN_TIMEOUT=60
|
||||
|
||||
# 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
|
||||
|
||||
check_result_nspawn_hook() {
|
||||
grep -q "Shutdown is already active. Skipping emergency action request" /tmp/honorfirstshutdown.log
|
||||
local workspace="${1:?}"
|
||||
|
||||
"${JOURNALCTL:?}" -D "${workspace:?}/var/log/journal" --grep "Shutdown is already active. Skipping emergency action request" --no-pager
|
||||
}
|
||||
|
||||
# Note: don't use a pipe in the following expression, as it breaks the trap
|
||||
# handlers we have defined in test/test-functions.
|
||||
do_test "$@" > >(tee /tmp/honorfirstshutdown.log)
|
||||
do_test "$@"
|
||||
|
@ -1502,17 +1502,17 @@ check_result_nspawn() {
|
||||
local workspace="${1:?}"
|
||||
local ret
|
||||
|
||||
check_result_common "${workspace}"
|
||||
ret=$?
|
||||
|
||||
# Run additional test-specific checks if defined by check_result_nspawn_hook()
|
||||
# Run a test-specific checks if defined by check_result_nspawn_hook()
|
||||
if declare -F check_result_nspawn_hook >/dev/null; then
|
||||
if ! check_result_nspawn_hook; then
|
||||
if ! check_result_nspawn_hook "${workspace}"; then
|
||||
derror "check_result_nspawn_hook() returned with EC > 0"
|
||||
ret=4
|
||||
fi
|
||||
fi
|
||||
|
||||
check_result_common "${workspace}"
|
||||
ret=$?
|
||||
|
||||
_umount_dir "${initdir:?}"
|
||||
|
||||
return $ret
|
||||
@ -1523,19 +1523,19 @@ check_result_qemu() {
|
||||
local ret
|
||||
mount_initdir
|
||||
|
||||
check_result_common "${initdir:?}"
|
||||
ret=$?
|
||||
|
||||
_umount_dir "${initdir:?}"
|
||||
|
||||
# Run additional test-specific checks if defined by check_result_qemu_hook()
|
||||
# Run a test-specific checks if defined by check_result_qemu_hook()
|
||||
if declare -F check_result_qemu_hook >/dev/null; then
|
||||
if ! check_result_qemu_hook; then
|
||||
if ! check_result_qemu_hook "${initdir:?}"; then
|
||||
derror "check_result_qemu_hook() returned with EC > 0"
|
||||
ret=4
|
||||
fi
|
||||
fi
|
||||
|
||||
check_result_common "${initdir:?}"
|
||||
ret=$?
|
||||
|
||||
_umount_dir "${initdir:?}"
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
@ -2484,9 +2484,9 @@ inst_binary() {
|
||||
|
||||
# Same as above, but we need to wrap certain libraries unconditionally
|
||||
#
|
||||
# login - dlopen()s (not only) systemd's PAM modules
|
||||
# login, useradd, userdel - dlopen()s (not only) systemd's PAM modules
|
||||
# tar - called by machinectl in TEST-25
|
||||
if get_bool "$IS_BUILT_WITH_ASAN" && [[ "$bin" =~ /(login|tar)$ ]]; then
|
||||
if get_bool "$IS_BUILT_WITH_ASAN" && [[ "$bin" =~ /(login|tar|useradd|userdel)$ ]]; then
|
||||
wrap_binary=1
|
||||
fi
|
||||
|
||||
|
@ -49,6 +49,7 @@ function report_result() {
|
||||
systemd-cat cat "/$name.log"
|
||||
}
|
||||
|
||||
set +x
|
||||
# Associative array for running tasks, where running[test-path]=PID
|
||||
declare -A running=()
|
||||
for task in "${TEST_LIST[@]}"; do
|
||||
@ -60,7 +61,7 @@ for task in "${TEST_LIST[@]}"; do
|
||||
# Task has finished, report its result and drop it from the queue
|
||||
wait "${running[$key]}" && ec=0 || ec=$?
|
||||
report_result "$key" $ec
|
||||
unset running["$key"]
|
||||
unset "running[$key]"
|
||||
# Break from inner for loop and outer while loop to skip
|
||||
# the sleep below when we find a free slot in the queue
|
||||
break 2
|
||||
@ -72,6 +73,7 @@ for task in "${TEST_LIST[@]}"; do
|
||||
done
|
||||
|
||||
if [[ -x $task ]]; then
|
||||
echo "Executing test '$task'"
|
||||
log_file="/${task##*/}.log"
|
||||
$task &>"$log_file" &
|
||||
running[$task]=$!
|
||||
@ -80,11 +82,14 @@ done
|
||||
|
||||
# Wait for remaining running tasks
|
||||
for key in "${!running[@]}"; do
|
||||
echo "Waiting for test '$key' to finish"
|
||||
wait ${running[$key]} && ec=0 || ec=$?
|
||||
report_result "$key" $ec
|
||||
unset running["$key"]
|
||||
unset "running[$key]"
|
||||
done
|
||||
|
||||
set -x
|
||||
|
||||
# Test logs are sometimes lost, as the system shuts down immediately after
|
||||
journalctl --sync
|
||||
|
||||
|
@ -4,7 +4,6 @@ set -eux
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
test "$(systemctl show -P MainPID testsuite-20.service)" -eq $$
|
||||
|
||||
|
@ -4,7 +4,6 @@ set -eux
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
# Create a binary for which execve() will fail
|
||||
touch /tmp/brokenbinary
|
||||
|
@ -4,7 +4,6 @@ set -eux
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
systemd-run --wait --unit=test27-one \
|
||||
-p StandardOutput=file:/tmp/stdout \
|
||||
|
@ -4,7 +4,6 @@ set -eux
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
systemctl disable --now systemd-timesyncd.service
|
||||
|
||||
|
@ -11,7 +11,6 @@ set -o pipefail
|
||||
|
||||
if test -f /sys/fs/cgroup/system.slice/testsuite-32.service/memory.oom.group; then
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
# Run a service that is guaranteed to be the first candidate for OOM killing
|
||||
systemd-run --unit=oomtest.service \
|
||||
|
@ -4,7 +4,6 @@ set -eux
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
function test_directory() {
|
||||
local directory="$1"
|
||||
|
@ -5,7 +5,6 @@ set -eux
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
unit=testsuite-38-sleep.service
|
||||
|
||||
@ -18,7 +17,7 @@ dbus_freeze() {
|
||||
local name object_path suffix
|
||||
|
||||
suffix="${1##*.}"
|
||||
name="${1%.$suffix}"
|
||||
name="${1%".$suffix"}"
|
||||
object_path="/org/freedesktop/systemd1/unit/${name//-/_2d}_2e${suffix}"
|
||||
|
||||
busctl call \
|
||||
@ -32,7 +31,7 @@ dbus_thaw() {
|
||||
local name object_path suffix
|
||||
|
||||
suffix="${1##*.}"
|
||||
name="${1%.$suffix}"
|
||||
name="${1%".$suffix"}"
|
||||
object_path="/org/freedesktop/systemd1/unit/${name//-/_2d}_2e${suffix}"
|
||||
|
||||
busctl call \
|
||||
@ -66,7 +65,7 @@ dbus_can_freeze() {
|
||||
local name object_path suffix
|
||||
|
||||
suffix="${1##*.}"
|
||||
name="${1%.$suffix}"
|
||||
name="${1%".$suffix"}"
|
||||
object_path="/org/freedesktop/systemd1/unit/${name//-/_2d}_2e${suffix}"
|
||||
|
||||
busctl get-property \
|
||||
@ -80,7 +79,7 @@ check_freezer_state() {
|
||||
local name object_path suffix
|
||||
|
||||
suffix="${1##*.}"
|
||||
name="${1%.$suffix}"
|
||||
name="${1%".$suffix"}"
|
||||
object_path="/org/freedesktop/systemd1/unit/${name//-/_2d}_2e${suffix}"
|
||||
|
||||
for _ in {0..10}; do
|
||||
|
@ -4,7 +4,6 @@ set -eux
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
export SYSTEMD_PAGER=
|
||||
SERVICE_PATH="$(mktemp /etc/systemd/system/execreloadXXX.service)"
|
||||
|
@ -4,7 +4,6 @@ set -eux
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
declare -A property
|
||||
|
||||
|
@ -7,7 +7,6 @@ set -o pipefail
|
||||
MAX_SECS=60
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
# test one: Restart=on-failure should restart the service
|
||||
systemd-run --unit=one -p Type=oneshot -p Restart=on-failure /bin/bash -c "exit 1" \
|
||||
|
@ -34,7 +34,6 @@ wait_for_state() {
|
||||
}
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
systemctl service-log-level systemd-homed debug
|
||||
|
||||
# Create a tmpfs to use as backing store for the home dir. That way we can enforce a size limit nicely.
|
||||
|
@ -4,7 +4,6 @@ set -eux
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
systemctl start testsuite-47-repro
|
||||
sleep 4
|
||||
|
@ -4,7 +4,6 @@ set -ex
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
systemctl enable test-honor-first-shutdown.service
|
||||
systemctl start test-honor-first-shutdown.service
|
||||
|
@ -4,7 +4,6 @@ set -eux
|
||||
set -o pipefail
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
# Loose checks to ensure the environment has the necessary features for systemd-oomd
|
||||
[[ -e /proc/pressure ]] || echo "no PSI" >>/skipped
|
||||
|
@ -28,7 +28,6 @@ wait_on_state_or_fail () {
|
||||
}
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
|
||||
cat >/run/systemd/system/testservice-fail-59.service <<EOF
|
||||
|
@ -5,7 +5,6 @@ set -o pipefail
|
||||
|
||||
setup() {
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
for i in {0..3};
|
||||
do
|
||||
|
@ -6,7 +6,6 @@ set -o pipefail
|
||||
RESULTS_FILE=/tmp/testsuite66serviceresults
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
systemctl start testsuite-66-deviceisolation.service
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user