2013-01-25 23:10:00 +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
2013-02-22 21:59:07 +04:00
TEST_DESCRIPTION = "Job-related tests"
2018-06-05 22:30:19 +03:00
TEST_NO_QEMU = 1
2013-01-25 23:10:00 +04:00
2013-04-23 04:39:40 +04:00
. $TEST_BASE_DIR /test-functions
2013-01-25 23:10:00 +04:00
test_setup( ) {
2013-11-06 02:32:56 +04:00
create_empty_image
2013-01-25 23:10:00 +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
eval $( udevadm info --export --query= env --name= ${ LOOPDEV } p2)
2013-11-06 02:32:56 +04:00
setup_basic_environment
2013-01-25 23:10:00 +04:00
2018-11-01 11:26:36 +03:00
# mask some services that we do not want to run in these tests
ln -fs /dev/null $initdir /etc/systemd/system/systemd-hwdb-update.service
ln -fs /dev/null $initdir /etc/systemd/system/systemd-journal-catalog-update.service
ln -fs /dev/null $initdir /etc/systemd/system/systemd-networkd.service
ln -fs /dev/null $initdir /etc/systemd/system/systemd-networkd.socket
ln -fs /dev/null $initdir /etc/systemd/system/systemd-resolved.service
ln -fs /dev/null $initdir /etc/systemd/system/systemd-machined.service
2013-01-25 23:10:00 +04:00
# setup the testsuite service
cat >$initdir /etc/systemd/system/testsuite.service <<EOF
[ Unit]
Description = Testsuite service
After = multi-user.target
[ Service]
ExecStart = /test-jobs.sh
Type = oneshot
2018-06-06 11:16:42 +03:00
StandardOutput = tty
StandardError = tty
2013-01-25 23:10:00 +04:00
EOF
# copy the units used by this test
2013-02-22 21:59:07 +04:00
cp $TEST_BASE_DIR /{ hello.service,sleep.service,hello-after-sleep.target,unstoppable.service} \
$initdir /etc/systemd/system
2013-01-25 23:10:00 +04:00
cp test-jobs.sh $initdir /
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
2013-01-25 23:10:00 +04:00
ddebug " umount $TESTDIR /root "
umount $TESTDIR /root
}
do_test " $@ "