]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-10-ISSUE-2467/test.sh
Merge pull request #12461 from Werkov/fix-job-ordering
[thirdparty/systemd.git] / test / TEST-10-ISSUE-2467 / test.sh
1 #!/bin/bash
2 set -e
3 TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2467"
4
5 . $TEST_BASE_DIR/test-functions
6
7 test_setup() {
8 create_empty_image
9 mkdir -p $TESTDIR/root
10 mount ${LOOPDEV}p1 $TESTDIR/root
11
12 # Create what will eventually be our root filesystem onto an overlay
13 (
14 LOG_LEVEL=5
15 eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
16
17 setup_basic_environment
18 dracut_install true rm socat
19
20 # setup the testsuite service
21 cat >$initdir/etc/systemd/system/testsuite.service <<'EOF'
22 [Unit]
23 Description=Testsuite service
24
25 [Service]
26 Type=oneshot
27 StandardOutput=tty
28 StandardError=tty
29 ExecStart=/bin/sh -e -x -c 'rm -f /tmp/nonexistent; systemctl start test.socket; printf x > test.file; socat -t20 OPEN:test.file UNIX-CONNECT:/run/test.ctl; >/testok'
30 TimeoutStartSec=10s
31 EOF
32
33 cat >$initdir/etc/systemd/system/test.socket <<'EOF'
34 [Socket]
35 ListenStream=/run/test.ctl
36 EOF
37
38 cat > $initdir/etc/systemd/system/test.service <<'EOF'
39 [Unit]
40 Requires=test.socket
41 ConditionPathExistsGlob=/tmp/nonexistent
42
43 [Service]
44 ExecStart=/bin/true
45 EOF
46
47 setup_testsuite
48 )
49 setup_nspawn_root
50
51 # mask some services that we do not want to run in these tests
52 ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
53 ln -s /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
54 ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.service
55 ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
56 ln -s /dev/null $initdir/etc/systemd/system/systemd-resolved.service
57
58 ddebug "umount $TESTDIR/root"
59 umount $TESTDIR/root
60 }
61
62 do_test "$@"