]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/TEST-10-ISSUE-2467/test.sh
test: replace echo with socat
[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
33e40442 8
33e40442
EV
9test_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]
25Description=Testsuite service
33e40442
EV
26
27[Service]
28Type=oneshot
9b45c2bf
LP
29StandardOutput=tty
30StandardError=tty
b35d6d82 31ExecStart=/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
32TimeoutStartSec=10s
33EOF
34
35 cat >$initdir/etc/systemd/system/test.socket <<'EOF'
36[Socket]
b35d6d82 37ListenStream=/run/test.ctl
33e40442
EV
38EOF
39
40 cat > $initdir/etc/systemd/system/test.service <<'EOF'
41[Unit]
42Requires=test.socket
43ConditionPathExistsGlob=/tmp/nonexistent
44
45[Service]
46ExecStart=/bin/true
47EOF
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 64do_test "$@"