]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-01-BASIC/test.sh
1c64017aaa0e8af9d56fc91bb0cee66e341f6f24
[thirdparty/systemd.git] / test / TEST-01-BASIC / 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="Basic systemd setup"
6 RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes}
7
8 . $TEST_BASE_DIR/test-functions
9
10 test_setup() {
11 create_empty_image
12 mkdir -p $TESTDIR/root
13 mount ${LOOPDEV}p1 $TESTDIR/root
14
15 # Create what will eventually be our root filesystem onto an overlay
16 (
17 LOG_LEVEL=5
18 eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
19
20 setup_basic_environment
21
22 # setup the testsuite service
23 cat >$initdir/etc/systemd/system/testsuite.service <<EOF
24 [Unit]
25 Description=Testsuite service
26 After=multi-user.target
27
28 [Service]
29 ExecStart=/bin/sh -x -c 'systemctl --state=failed --no-legend --no-pager > /failed ; systemctl daemon-reload ; echo OK > /testok'
30 Type=oneshot
31 EOF
32
33 setup_testsuite
34 ) || return 1
35 setup_nspawn_root
36
37 ddebug "umount $TESTDIR/root"
38 umount $TESTDIR/root
39 }
40
41 do_test "$@"