]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-03-JOBS/test.sh
93a387df5967070a67f008b5233bc09d8496c755
[thirdparty/systemd.git] / test / TEST-03-JOBS / test.sh
1 #!/bin/bash
2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
4 set -e
5 TEST_DESCRIPTION="Job-related tests"
6 TEST_NO_QEMU=1
7
8 . $TEST_BASE_DIR/test-functions
9
10 test_setup() {
11 create_empty_image
12 mkdir -p $TESTDIR/root
13 mount ${LOOPDEV}p1 $TESTDIR/root
14
15 # Create what will eventually be our root filesystem onto an overlay
16 (
17 LOG_LEVEL=5
18 eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
19
20 setup_basic_environment
21
22 # mask some services that we do not want to run in these tests
23 ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
24 ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
25 ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service
26 ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
27 ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service
28 ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
29
30 # setup the testsuite service
31 cat >$initdir/etc/systemd/system/testsuite.service <<EOF
32 [Unit]
33 Description=Testsuite service
34 After=multi-user.target
35
36 [Service]
37 ExecStart=/test-jobs.sh
38 Type=oneshot
39 StandardOutput=tty
40 StandardError=tty
41 EOF
42
43 # copy the units used by this test
44 cp $TEST_BASE_DIR/{hello.service,sleep.service,hello-after-sleep.target,unstoppable.service} \
45 $initdir/etc/systemd/system
46 cp test-jobs.sh $initdir/
47
48 setup_testsuite
49 ) || return 1
50 setup_nspawn_root
51
52 ddebug "umount $TESTDIR/root"
53 umount $TESTDIR/root
54 }
55
56 do_test "$@"