2013-01-25 20:10:00 +01:00
|
|
|
#!/bin/bash
|
2017-08-07 21:09:21 +02:00
|
|
|
set -e
|
2013-02-22 18:59:07 +01:00
|
|
|
TEST_DESCRIPTION="Job-related tests"
|
2018-06-05 21:30:19 +02:00
|
|
|
TEST_NO_QEMU=1
|
2013-01-25 20:10:00 +01:00
|
|
|
|
2013-04-23 02:39:40 +02:00
|
|
|
. $TEST_BASE_DIR/test-functions
|
2013-01-25 20:10:00 +01:00
|
|
|
|
|
|
|
test_setup() {
|
2013-11-05 23:32:56 +01:00
|
|
|
create_empty_image
|
2013-01-25 20:10:00 +01: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-05 23:32:56 +01:00
|
|
|
setup_basic_environment
|
2013-01-25 20:10:00 +01:00
|
|
|
|
2018-11-01 09:26:36 +01: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 20:10:00 +01: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 10:16:42 +02:00
|
|
|
StandardOutput=tty
|
|
|
|
StandardError=tty
|
2013-01-25 20:10:00 +01:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# copy the units used by this test
|
2013-02-22 18:59:07 +01:00
|
|
|
cp $TEST_BASE_DIR/{hello.service,sleep.service,hello-after-sleep.target,unstoppable.service} \
|
|
|
|
$initdir/etc/systemd/system
|
2013-01-25 20:10:00 +01:00
|
|
|
cp test-jobs.sh $initdir/
|
|
|
|
|
2013-11-05 23:32:56 +01:00
|
|
|
setup_testsuite
|
2015-11-25 18:51:17 +01:00
|
|
|
) || return 1
|
2013-11-05 23:32:56 +01:00
|
|
|
setup_nspawn_root
|
2013-01-25 20:10:00 +01:00
|
|
|
|
|
|
|
ddebug "umount $TESTDIR/root"
|
|
|
|
umount $TESTDIR/root
|
|
|
|
}
|
|
|
|
|
|
|
|
do_test "$@"
|