]> git.proxmox.com Git - systemd.git/blob - test/TEST-04-JOURNAL/test.sh
New upstream version 240
[systemd.git] / test / TEST-04-JOURNAL / test.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 -e
5 TEST_DESCRIPTION="Journal-related tests"
6
7 . $TEST_BASE_DIR/test-functions
8
9 test_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
20
21 # mask some services that we do not want to run in these tests
22 ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
23 ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
24 ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service
25 ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
26 ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service
27 ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
28
29 # setup the testsuite service
30 cat >$initdir/etc/systemd/system/testsuite.service <<EOF
31 [Unit]
32 Description=Testsuite service
33
34 [Service]
35 ExecStart=/test-journal.sh
36 Type=oneshot
37 EOF
38
39 cat >$initdir/etc/systemd/system/forever-print-hola.service <<EOF
40 [Unit]
41 Description=ForeverPrintHola service
42
43 [Service]
44 Type=simple
45 ExecStart=/bin/sh -x -c 'while :; do printf "Hola\n" || touch /i-lose-my-logs; sleep 1; done'
46 EOF
47
48 cp test-journal.sh $initdir/
49
50 setup_testsuite
51 ) || return 1
52 setup_nspawn_root
53
54 ddebug "umount $TESTDIR/root"
55 umount $TESTDIR/root
56 }
57
58 do_test "$@"