systemd/SOURCES/1043-test-introduce-TEST-53-TIMER.patch

107 lines
3.0 KiB
Diff

From 7097abc3e9a0b76942b6844d43152e37f22158cf Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <fsumsal@redhat.com>
Date: Mon, 29 Sep 2025 13:37:02 +0200
Subject: [PATCH] test: introduce TEST-53-TIMER
This tries to mirror upstream's
953c347fb6f293acbd6da009646bfc071b68ddd7, but we don't have
TEST-53-ISSUE-16347 in RHEL 8 at all, so just introduce a new empty test
instead.
rhel-only
Related: RHEL-108744
---
test/TEST-53-TIMER/Makefile | 1 +
test/TEST-53-TIMER/test.sh | 51 +++++++++++++++++++++++++++++++++
test/TEST-53-TIMER/testsuite.sh | 14 +++++++++
3 files changed, 66 insertions(+)
create mode 120000 test/TEST-53-TIMER/Makefile
create mode 100755 test/TEST-53-TIMER/test.sh
create mode 100755 test/TEST-53-TIMER/testsuite.sh
diff --git a/test/TEST-53-TIMER/Makefile b/test/TEST-53-TIMER/Makefile
new file mode 120000
index 0000000000..e9f93b1104
--- /dev/null
+++ b/test/TEST-53-TIMER/Makefile
@@ -0,0 +1 @@
+../TEST-01-BASIC/Makefile
\ No newline at end of file
diff --git a/test/TEST-53-TIMER/test.sh b/test/TEST-53-TIMER/test.sh
new file mode 100755
index 0000000000..3619ff92b4
--- /dev/null
+++ b/test/TEST-53-TIMER/test.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+set -e
+TEST_DESCRIPTION="Tests for systemd timers"
+TEST_NO_NSPAWN=1
+
+# shellcheck source=test/test-functions
+. "$TEST_BASE_DIR/test-functions"
+
+test_setup() {
+ create_empty_image
+ mkdir -p "${TESTDIR:?}/root"
+ mount "${LOOPDEV:?}p1" "$TESTDIR/root"
+
+ (
+ LOG_LEVEL=5
+ # shellcheck disable=SC2046
+ eval $(udevadm info --export --query=env --name="${LOOPDEV}p2")
+
+ setup_basic_environment
+
+ # mask some services that we do not want to run in these tests
+ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-hwdb-update.service"
+ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-journal-catalog-update.service"
+ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-networkd.service"
+ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-networkd.socket"
+ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-resolved.service"
+ ln -fs /dev/null "$initdir/etc/systemd/system/systemd-machined.service"
+
+ # setup the testsuite service
+ cat >"$initdir/etc/systemd/system/testsuite.service" <<EOF
+[Unit]
+Description=Testsuite service
+
+[Service]
+ExecStart=/bin/bash -x /testsuite.sh
+Type=oneshot
+StandardOutput=tty
+StandardError=tty
+NotifyAccess=all
+EOF
+ cp testsuite*.sh "$initdir/"
+
+ setup_testsuite
+ ) || return 1
+ setup_nspawn_root
+
+ ddebug "umount $TESTDIR/root"
+ umount "$TESTDIR/root"
+}
+
+do_test "$@"
diff --git a/test/TEST-53-TIMER/testsuite.sh b/test/TEST-53-TIMER/testsuite.sh
new file mode 100755
index 0000000000..13c767e490
--- /dev/null
+++ b/test/TEST-53-TIMER/testsuite.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -eux
+set -o pipefail
+
+: >/failed
+
+for script in "${0%.sh}".*.sh; do
+ echo "Running $script"
+ "./$script"
+done
+
+touch /testok
+rm /failed