]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: convert TEST-04-JOURNAL to generic image
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 9 Dec 2019 18:19:05 +0000 (19:19 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 28 Mar 2020 10:46:47 +0000 (11:46 +0100)
test/TEST-04-JOURNAL/test.sh
test/meson.build
test/test-functions
test/testsuite-04.units/forever-print-hola.service [new file with mode: 0644]
test/units/testsuite-04.service [new file with mode: 0644]
test/units/testsuite-04.sh [moved from test/TEST-04-JOURNAL/test-journal.sh with 100% similarity]

index af96dfd7191a7563b319404ec974bdb12b59175d..868ac28aa107d01f2d9971ac4a5a4d918ac9c3df 100755 (executable)
@@ -14,31 +14,8 @@ test_setup() {
 
         setup_basic_environment
         mask_supporting_services
-
-        # setup the testsuite service
-        cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/test-journal.sh
-Type=oneshot
-EOF
-
-        cat >$initdir/etc/systemd/system/forever-print-hola.service <<EOF
-[Unit]
-Description=ForeverPrintHola service
-
-[Service]
-Type=simple
-ExecStart=/bin/sh -x -c 'while :; do printf "Hola\n" || touch /i-lose-my-logs; sleep 1; done'
-EOF
-
-        cp test-journal.sh $initdir/
-
-        setup_testsuite
     )
     setup_nspawn_root
 }
 
-do_test "$@"
+do_test "$@" 04
index 2b2ac590c4a0071c11d7215b5d1b0cbb15ad31e1..15b4c49ff9ec28275ac4fc4f86febf4bec930bd1 100644 (file)
@@ -12,6 +12,8 @@ install_subdir('test-path',
                install_dir : testdata_dir)
 install_subdir('test-umount',
                install_dir : testdata_dir)
+install_subdir('testsuite-04.units',
+               install_dir : testdata_dir)
 
 if conf.get('ENABLE_RESOLVE') == 1
         install_subdir('test-resolve',
index 673685ea6b613002bcde7d842e2441537733dd1b..b38c04c6b3d03dc9f9336baaee03b9bc1f9cda25 100644 (file)
@@ -220,7 +220,7 @@ init=$PATH_TO_INIT \
 console=$CONSOLE \
 selinux=0 \
 $_cgroup_args \
-SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/units: \
+SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-$1.units:/usr/lib/systemd/tests/testdata/units: \
 systemd.unit=testsuite.target \
 systemd.wants=testsuite-$1.service ${_end}
 $KERNEL_APPEND \
@@ -267,7 +267,7 @@ run_nspawn() {
         --register=no
         --kill-signal=SIGKILL
         --directory=$TESTDIR/$1
-        --setenv=SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/units:
+        --setenv=SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-$2.units:/usr/lib/systemd/tests/testdata/units:
         $PATH_TO_INIT
         $KERNEL_APPEND
         systemd.unit=testsuite.target
diff --git a/test/testsuite-04.units/forever-print-hola.service b/test/testsuite-04.units/forever-print-hola.service
new file mode 100644 (file)
index 0000000..a0dc095
--- /dev/null
@@ -0,0 +1,6 @@
+[Unit]
+Description=ForeverPrintHola service
+
+[Service]
+Type=simple
+ExecStart=sh -x -c 'while :; do printf "Hola\n" || touch /i-lose-my-logs; sleep 1; done'
diff --git a/test/units/testsuite-04.service b/test/units/testsuite-04.service
new file mode 100644 (file)
index 0000000..468acfa
--- /dev/null
@@ -0,0 +1,6 @@
+[Unit]
+Description=TEST-04-JOURNAL
+
+[Service]
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot