]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/TEST-10-ISSUE-2467/test.sh
tests: don't use "netcat" for testing TEST-10-ISSUE-2467
[thirdparty/systemd.git] / test / TEST-10-ISSUE-2467 / test.sh
CommitLineData
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 4set -e
33e40442
EV
5TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2467"
6
7. $TEST_BASE_DIR/test-functions
8SKIP_INITRD=yes
9
33e40442
EV
10test_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
9b45c2bf 21 dracut_install true rm
33e40442
EV
22
23 # setup the testsuite service
24 cat >$initdir/etc/systemd/system/testsuite.service <<'EOF'
25[Unit]
26Description=Testsuite service
27After=multi-user.target
28
29[Service]
30Type=oneshot
9b45c2bf
LP
31StandardOutput=tty
32StandardError=tty
33ExecStart=/bin/sh -e -x -c 'rm -f /tmp/nonexistent; systemctl start test.socket; echo > /run/test.ctl; >/testok'
33e40442
EV
34TimeoutStartSec=10s
35EOF
36
37 cat >$initdir/etc/systemd/system/test.socket <<'EOF'
38[Socket]
9b45c2bf 39ListenFIFO=/run/test.ctl
33e40442
EV
40EOF
41
42 cat > $initdir/etc/systemd/system/test.service <<'EOF'
43[Unit]
44Requires=test.socket
45ConditionPathExistsGlob=/tmp/nonexistent
46
47[Service]
48ExecStart=/bin/true
49EOF
50
51 setup_testsuite
52 ) || return 1
f2d566b7 53 setup_nspawn_root
33e40442
EV
54
55 # mask some services that we do not want to run in these tests
56 ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
57 ln -s /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
58 ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.service
59 ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
60 ln -s /dev/null $initdir/etc/systemd/system/systemd-resolved.service
61
62 ddebug "umount $TESTDIR/root"
63 umount $TESTDIR/root
64}
65
33e40442 66do_test "$@"