]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/TEST-10-ISSUE-2467/test.sh
test: add function to reduce copied setup boilerplate
[thirdparty/systemd.git] / test / TEST-10-ISSUE-2467 / test.sh
CommitLineData
33e40442 1#!/bin/bash
818567fc 2set -e
33e40442
EV
3TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/2467"
4
5. $TEST_BASE_DIR/test-functions
33e40442 6
33e40442 7test_setup() {
ec4cab49 8 create_empty_image_rootdir
33e40442
EV
9
10 # Create what will eventually be our root filesystem onto an overlay
11 (
12 LOG_LEVEL=5
13 eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
14
15 setup_basic_environment
51fa8591 16 mask_supporting_services
b35d6d82 17 dracut_install true rm socat
33e40442
EV
18
19 # setup the testsuite service
20 cat >$initdir/etc/systemd/system/testsuite.service <<'EOF'
21[Unit]
22Description=Testsuite service
33e40442
EV
23
24[Service]
25Type=oneshot
b35d6d82 26ExecStart=/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
27EOF
28
29 cat >$initdir/etc/systemd/system/test.socket <<'EOF'
30[Socket]
b35d6d82 31ListenStream=/run/test.ctl
33e40442
EV
32EOF
33
34 cat > $initdir/etc/systemd/system/test.service <<'EOF'
35[Unit]
36Requires=test.socket
37ConditionPathExistsGlob=/tmp/nonexistent
38
39[Service]
40ExecStart=/bin/true
41EOF
42
43 setup_testsuite
cc469c3d 44 )
f2d566b7 45 setup_nspawn_root
33e40442
EV
46}
47
33e40442 48do_test "$@"