mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 18:23:32 +08:00
TEST-55-OOMD: use swap file instead of partition
The partition seems not to work on Ubuntu for some reason, use a swap file instead
This commit is contained in:
parent
937e82cb7d
commit
f434f182cc
@ -5,20 +5,19 @@ set -e
|
||||
TEST_DESCRIPTION="systemd-oomd Memory Pressure Test"
|
||||
IMAGE_NAME="oomd"
|
||||
|
||||
# Need to set up swap
|
||||
TEST_NO_NSPAWN=1
|
||||
|
||||
# shellcheck source=test/test-functions
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
test_append_files() {
|
||||
# Create a swap device
|
||||
# Create a swap file
|
||||
(
|
||||
mkswap "${LOOPDEV:?}p2"
|
||||
image_install swapon swapoff
|
||||
image_install mkswap swapon swapoff stress
|
||||
|
||||
inst_binary stress
|
||||
|
||||
cat >>"${initdir:?}/etc/fstab" <<EOF
|
||||
UUID=$(blkid -o value -s UUID "${LOOPDEV}p2") none swap defaults 0 0
|
||||
EOF
|
||||
dd if=/dev/zero of="${initdir:?}/swapfile" bs=1M count=48
|
||||
chmod 0600 "${initdir:?}/swapfile"
|
||||
|
||||
mkdir -p "${initdir:?}/etc/systemd/system/init.scope.d/"
|
||||
cat >>"${initdir:?}/etc/systemd/system/init.scope.d/test-55-oomd.conf" <<EOF
|
||||
|
@ -24,6 +24,13 @@ fi
|
||||
|
||||
rm -rf /run/systemd/system/testsuite-55-testbloat.service.d
|
||||
|
||||
# Activate swap file if we are in a VM
|
||||
if systemd-detect-virt --vm --quiet; then
|
||||
mkswap /swapfile
|
||||
swapon /swapfile
|
||||
swapon --show
|
||||
fi
|
||||
|
||||
# Configure oomd explicitly to avoid conflicts with distro dropins
|
||||
mkdir -p /run/systemd/oomd.conf.d/
|
||||
cat >/run/systemd/oomd.conf.d/99-oomd-test.conf <<EOF
|
||||
|
Loading…
Reference in New Issue
Block a user