]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-27-STDOUTFILE/testsuite.sh
b8fcc46e336cc1337de9c23a862f87b72f7649bc
[thirdparty/systemd.git] / test / TEST-27-STDOUTFILE / testsuite.sh
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
4 set -ex
5 set -o pipefail
6
7 systemd-analyze set-log-level debug
8 systemd-analyze set-log-target console
9
10 systemd-run --wait --unit=one -p StandardOutput=file:/tmp/stdout -p StandardError=file:/tmp/stderr -p Type=exec sh -c 'echo x ; echo y >&2'
11 cmp /tmp/stdout <<EOF
12 x
13 EOF
14 cmp /tmp/stderr <<EOF
15 y
16 EOF
17
18 systemd-run --wait --unit=two -p StandardOutput=file:/tmp/stdout -p StandardError=file:/tmp/stderr -p Type=exec sh -c 'echo z ; echo a >&2'
19 cmp /tmp/stdout <<EOF
20 z
21 EOF
22 cmp /tmp/stderr <<EOF
23 a
24 EOF
25
26 systemd-run --wait --unit=three -p StandardOutput=append:/tmp/stdout -p StandardError=append:/tmp/stderr -p Type=exec sh -c 'echo b ; echo c >&2'
27 cmp /tmp/stdout <<EOF
28 z
29 b
30 EOF
31 cmp /tmp/stderr <<EOF
32 a
33 c
34 EOF
35
36 systemd-analyze set-log-level info
37
38 echo OK > /testok
39
40 exit 0