]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test(FULL-SYSTEMD): factor out systemd unit files to be shared between tests
authorJo Zzsi <jozzsicsataban@gmail.com>
Sun, 12 Jan 2025 14:46:36 +0000 (09:46 -0500)
committerLaszlo <laszlo.gombos@gmail.com>
Sun, 12 Jan 2025 15:55:40 +0000 (10:55 -0500)
Create testsuite.target and testsuite.service files.

test/TEST-41-FULL-SYSTEMD/test.sh
test/TEST-41-FULL-SYSTEMD/testsuite.service [new file with mode: 0644]
test/TEST-41-FULL-SYSTEMD/testsuite.target [new file with mode: 0644]

index 284af1a108709ee9772353a2a3bf875fb42c7342..21bd83485f0cd86b3a190ad249c52eaec88d28f8 100755 (executable)
@@ -93,34 +93,12 @@ test_setup() {
         -a "$dracut_modules" \
         -i "${PKGLIBDIR}/modules.d/80test-root/test-init.sh" "/sbin/test-init.sh" \
         -i ./test-init.sh /sbin/test-init \
+        -i ./testsuite.target /etc/systemd/system/testsuite.target \
+        -i ./testsuite.service /etc/systemd/system/testsuite.service \
         -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1
 
     mkdir -p "$TESTDIR"/overlay/source && cp -a "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.* && export initdir=$TESTDIR/overlay/source
 
-    # setup the testsuite target
-    mkdir -p "$initdir"/etc/systemd/system
-    cat > "$initdir"/etc/systemd/system/testsuite.target << EOF
-[Unit]
-Description=Testsuite target
-Requires=basic.target
-After=basic.target
-Conflicts=rescue.target
-AllowIsolate=yes
-EOF
-
-    # setup the testsuite service
-    cat > "$initdir"/etc/systemd/system/testsuite.service << EOF
-[Unit]
-Description=Testsuite service
-After=basic.target
-
-[Service]
-ExecStart=/sbin/test-init
-Type=oneshot
-StandardInput=tty
-StandardOutput=tty
-EOF
-
     mkdir -p "$initdir"/etc/systemd/system/testsuite.target.wants
     ln -fs ../testsuite.service "$initdir"/etc/systemd/system/testsuite.target.wants/testsuite.service
 
diff --git a/test/TEST-41-FULL-SYSTEMD/testsuite.service b/test/TEST-41-FULL-SYSTEMD/testsuite.service
new file mode 100644 (file)
index 0000000..f096af1
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=Testsuite service
+After=basic.target multi-user.target
+
+[Service]
+ExecStart=/sbin/test-init
+Type=oneshot
+StandardInput=tty
+StandardOutput=tty
diff --git a/test/TEST-41-FULL-SYSTEMD/testsuite.target b/test/TEST-41-FULL-SYSTEMD/testsuite.target
new file mode 100644 (file)
index 0000000..1a7e5b3
--- /dev/null
@@ -0,0 +1,6 @@
+[Unit]
+Description=Testsuite target
+Requires=multi-user.target
+After=multi-user.target
+Conflicts=rescue.target
+AllowIsolate=yes