]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-04-JOURNAL/test.sh
test: add function to reduce copied setup boilerplate
[thirdparty/systemd.git] / test / TEST-04-JOURNAL / test.sh
1 #!/bin/bash
2 set -e
3 TEST_DESCRIPTION="Journal-related tests"
4
5 . $TEST_BASE_DIR/test-functions
6
7 test_setup() {
8 create_empty_image_rootdir
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
16 mask_supporting_services
17
18 # setup the testsuite service
19 cat >$initdir/etc/systemd/system/testsuite.service <<EOF
20 [Unit]
21 Description=Testsuite service
22
23 [Service]
24 ExecStart=/test-journal.sh
25 Type=oneshot
26 EOF
27
28 cat >$initdir/etc/systemd/system/forever-print-hola.service <<EOF
29 [Unit]
30 Description=ForeverPrintHola service
31
32 [Service]
33 Type=simple
34 ExecStart=/bin/sh -x -c 'while :; do printf "Hola\n" || touch /i-lose-my-logs; sleep 1; done'
35 EOF
36
37 cp test-journal.sh $initdir/
38
39 setup_testsuite
40 )
41 setup_nspawn_root
42 }
43
44 do_test "$@"