2012-05-21 20:55:48 +04:00
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
2017-08-07 22:09:21 +03:00
set -e
2012-05-21 20:55:48 +04:00
TEST_DESCRIPTION = "Basic systemd setup"
2018-12-23 16:28:01 +03:00
RUN_IN_UNPRIVILEGED_CONTAINER = ${ RUN_IN_UNPRIVILEGED_CONTAINER :- yes }
2012-05-21 20:55:48 +04:00
2013-04-23 04:39:40 +04:00
. $TEST_BASE_DIR /test-functions
2012-05-21 20:55:48 +04:00
test_setup( ) {
2013-11-06 02:32:56 +04:00
create_empty_image
2012-05-21 20:55:48 +04:00
mkdir -p $TESTDIR /root
mount ${ LOOPDEV } p1 $TESTDIR /root
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL = 5
2012-05-25 20:32:55 +04:00
eval $( udevadm info --export --query= env --name= ${ LOOPDEV } p2)
2013-11-06 02:32:56 +04:00
setup_basic_environment
2012-05-21 20:55:48 +04:00
# setup the testsuite service
2012-05-24 17:27:53 +04:00
cat >$initdir /etc/systemd/system/testsuite.service <<EOF
2012-05-21 20:55:48 +04:00
[ Unit]
Description = Testsuite service
After = multi-user.target
[ Service]
2018-12-23 16:46:00 +03:00
ExecStart = /bin/sh -x -c 'systemctl --state=failed --no-legend --no-pager > /failed ; systemctl daemon-reload ; echo OK > /testok'
2012-05-21 20:55:48 +04:00
Type = oneshot
EOF
2013-01-26 01:19:19 +04:00
2013-11-06 02:32:56 +04:00
setup_testsuite
2015-11-25 20:51:17 +03:00
) || return 1
2013-11-06 02:32:56 +04:00
setup_nspawn_root
2012-05-25 20:32:55 +04:00
ddebug " umount $TESTDIR /root "
2012-05-24 17:51:10 +04:00
umount $TESTDIR /root
2012-05-21 20:55:48 +04:00
}
do_test " $@ "