]>
Commit | Line | Data |
---|---|---|
33e40442 EV |
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 | |
818567fc | 4 | set -e |
33e40442 EV |
5 | TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2467" |
6 | ||
7 | . $TEST_BASE_DIR/test-functions | |
33e40442 | 8 | |
33e40442 EV |
9 | test_setup() { |
10 | create_empty_image | |
11 | mkdir -p $TESTDIR/root | |
12 | mount ${LOOPDEV}p1 $TESTDIR/root | |
13 | ||
14 | # Create what will eventually be our root filesystem onto an overlay | |
15 | ( | |
16 | LOG_LEVEL=5 | |
17 | eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) | |
18 | ||
19 | setup_basic_environment | |
b35d6d82 | 20 | dracut_install true rm socat |
33e40442 EV |
21 | |
22 | # setup the testsuite service | |
23 | cat >$initdir/etc/systemd/system/testsuite.service <<'EOF' | |
24 | [Unit] | |
25 | Description=Testsuite service | |
33e40442 EV |
26 | |
27 | [Service] | |
28 | Type=oneshot | |
9b45c2bf LP |
29 | StandardOutput=tty |
30 | StandardError=tty | |
b35d6d82 | 31 | 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' |
33e40442 EV |
32 | TimeoutStartSec=10s |
33 | EOF | |
34 | ||
35 | cat >$initdir/etc/systemd/system/test.socket <<'EOF' | |
36 | [Socket] | |
b35d6d82 | 37 | ListenStream=/run/test.ctl |
33e40442 EV |
38 | EOF |
39 | ||
40 | cat > $initdir/etc/systemd/system/test.service <<'EOF' | |
41 | [Unit] | |
42 | Requires=test.socket | |
43 | ConditionPathExistsGlob=/tmp/nonexistent | |
44 | ||
45 | [Service] | |
46 | ExecStart=/bin/true | |
47 | EOF | |
48 | ||
49 | setup_testsuite | |
50 | ) || return 1 | |
f2d566b7 | 51 | setup_nspawn_root |
33e40442 EV |
52 | |
53 | # mask some services that we do not want to run in these tests | |
54 | ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service | |
55 | ln -s /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service | |
56 | ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.service | |
57 | ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.socket | |
58 | ln -s /dev/null $initdir/etc/systemd/system/systemd-resolved.service | |
59 | ||
60 | ddebug "umount $TESTDIR/root" | |
61 | umount $TESTDIR/root | |
62 | } | |
63 | ||
33e40442 | 64 | do_test "$@" |