]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/TEST-05-RLIMITS/test.sh
3eb21657968496110bdff0046cafdbcccefc7524
[thirdparty/systemd.git] / test / TEST-05-RLIMITS / 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="Resource limits-related tests"
6
7 . $TEST_BASE_DIR/test-functions
8
9 test_setup() {
10 create_empty_image
11 mkdir -p $TESTDIR/root
12 mount ${LOOPDEV}p1 $TESTDIR/root
13
14 # Create what will eventually be our root filesystem onto an overlay
15 (
16 LOG_LEVEL=5
17 eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
18
19 setup_basic_environment
20
21 # mask some services that we do not want to run in these tests
22 ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
23 ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
24 ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service
25 ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
26 ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service
27 ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
28
29 cat >$initdir/etc/systemd/system.conf <<EOF
30 [Manager]
31 DefaultLimitNOFILE=10000:16384
32 EOF
33
34 # setup the testsuite service
35 cat >$initdir/etc/systemd/system/testsuite.service <<EOF
36 [Unit]
37 Description=Testsuite service
38
39 [Service]
40 ExecStart=/test-rlimits.sh
41 Type=oneshot
42 EOF
43
44 cp test-rlimits.sh $initdir/
45
46 setup_testsuite
47 ) || return 1
48 setup_nspawn_root
49
50 ddebug "umount $TESTDIR/root"
51 umount $TESTDIR/root
52 }
53
54 do_test "$@"