]> git.proxmox.com Git - systemd.git/blob - test/TEST-07-ISSUE-1981/test.sh
Imported Upstream version 229
[systemd.git] / test / TEST-07-ISSUE-1981 / 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 TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/1981"
5
6 . $TEST_BASE_DIR/test-functions
7
8 test_run() {
9 dwarn "skipping QEMU"
10 if check_nspawn; then
11 timeout --foreground 30s systemd-nspawn --kill-signal=SIGKILL --boot --directory=$TESTDIR/nspawn-root $ROOTLIBDIR/systemd $KERNEL_APPEND
12 check_result_nspawn || return 1
13 else
14 dwarn "can't run systemd-nspawn, skipping"
15 fi
16 return 0
17 }
18
19 test_setup() {
20 create_empty_image
21 mkdir -p $TESTDIR/root
22 mount ${LOOPDEV}p1 $TESTDIR/root
23
24 # Create what will eventually be our root filesystem onto an overlay
25 (
26 LOG_LEVEL=5
27 eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
28
29 setup_basic_environment
30
31 # setup the testsuite service
32 cat >$initdir/etc/systemd/system/testsuite.service <<EOF
33 [Unit]
34 Description=Testsuite service
35 After=multi-user.target
36
37 [Service]
38 ExecStart=/test-segfault.sh
39 Type=oneshot
40 EOF
41
42 cp test-segfault.sh $initdir/
43
44 setup_testsuite
45 ) || return 1
46 setup_nspawn_root
47
48 ddebug "umount $TESTDIR/root"
49 umount $TESTDIR/root
50 }
51
52 test_cleanup() {
53 umount $TESTDIR/root 2>/dev/null
54 [[ $LOOPDEV ]] && losetup -d $LOOPDEV
55 return 0
56 }
57
58 do_test "$@"