]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-08-ISSUE-2730/test.sh
test: Drop SKIP_INITRD for QEMU-based tests
[thirdparty/systemd.git] / test / TEST-08-ISSUE-2730 / 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="https://github.com/systemd/systemd/issues/2730"
6 TEST_NO_NSPAWN=1
7
8 . $TEST_BASE_DIR/test-functions
9 QEMU_TIMEOUT=180
10 FSTYPE=ext4
11
12 test_setup() {
13 create_empty_image
14 mkdir -p $TESTDIR/root
15 mount ${LOOPDEV}p1 $TESTDIR/root
16
17 # Create what will eventually be our root filesystem onto an overlay
18 (
19 LOG_LEVEL=5
20 eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
21
22 setup_basic_environment
23
24 # setup the testsuite service
25 cat >$initdir/etc/systemd/system/testsuite.service <<EOF
26 [Unit]
27 Description=Testsuite service
28 After=multi-user.target
29
30 [Service]
31 ExecStart=/bin/sh -x -c 'mount -o remount,rw /dev/sda1 && echo OK > /testok; systemctl poweroff'
32 Type=oneshot
33 EOF
34
35 rm $initdir/etc/fstab
36 cat >$initdir/etc/systemd/system/-.mount <<EOF
37 [Unit]
38 Before=local-fs.target
39
40 [Mount]
41 What=/dev/sda1
42 Where=/
43 Type=ext4
44 Options=errors=remount-ro,noatime
45
46 [Install]
47 WantedBy=local-fs.target
48 Alias=root.mount
49 EOF
50
51 cat >$initdir/etc/systemd/system/systemd-remount-fs.service <<EOF
52 [Unit]
53 DefaultDependencies=no
54 Conflicts=shutdown.target
55 After=systemd-fsck-root.service
56 Before=local-fs-pre.target local-fs.target shutdown.target
57 Wants=local-fs-pre.target
58
59 [Service]
60 Type=oneshot
61 RemainAfterExit=yes
62 ExecStart=/bin/systemctl reload /
63 EOF
64
65 setup_testsuite
66 ) || return 1
67
68 ln -s /etc/systemd/system/-.mount $initdir/etc/systemd/system/root.mount
69 mkdir -p $initdir/etc/systemd/system/local-fs.target.wants
70 ln -s /etc/systemd/system/-.mount $initdir/etc/systemd/system/local-fs.target.wants/-.mount
71
72 # mask some services that we do not want to run in these tests
73 ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
74 ln -s /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
75 ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.service
76 ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
77 ln -s /dev/null $initdir/etc/systemd/system/systemd-resolved.service
78
79 ddebug "umount $TESTDIR/root"
80 umount $TESTDIR/root
81 }
82
83 do_test "$@"