dcavalca / rpms / systemd

Forked from rpms/systemd 4 months ago
Clone
594167
From 3e31fc66a206c272e7f73581c5ca752b4439fec3 Mon Sep 17 00:00:00 2001
594167
From: Frantisek Sumsal <frantisek@sumsal.cz>
594167
Date: Tue, 21 Jun 2022 12:09:35 +0200
594167
Subject: [PATCH] test: allow overriding $QEMU_MEM when running w/ ASan
594167
594167
(cherry picked from commit dc350e78fe66ae8698574202b2e30e5d650219ec)
594167
594167
Related: #2087652
594167
---
594167
 test/TEST-36-NUMAPOLICY/test.sh | 2 +-
594167
 test/test-functions             | 5 ++---
594167
 2 files changed, 3 insertions(+), 4 deletions(-)
594167
594167
diff --git a/test/TEST-36-NUMAPOLICY/test.sh b/test/TEST-36-NUMAPOLICY/test.sh
594167
index 5f38bf1009..7909b1dce3 100755
594167
--- a/test/TEST-36-NUMAPOLICY/test.sh
594167
+++ b/test/TEST-36-NUMAPOLICY/test.sh
594167
@@ -9,7 +9,7 @@ TEST_NO_NSPAWN=1
594167
 . "${TEST_BASE_DIR:?}/test-functions"
594167
 
594167
 if qemu_min_version "5.2.0"; then
594167
-    QEMU_OPTIONS="-object memory-backend-ram,id=mem0,size=${QEMU_MEM:?} -numa node,memdev=mem0,nodeid=0"
594167
+    QEMU_OPTIONS="-object memory-backend-ram,id=mem0,size=${QEMU_MEM:-512M} -numa node,memdev=mem0,nodeid=0"
594167
 else
594167
     QEMU_OPTIONS="-numa node,nodeid=0"
594167
 fi
594167
diff --git a/test/test-functions b/test/test-functions
594167
index 079a7249e4..98efd047d7 100644
594167
--- a/test/test-functions
594167
+++ b/test/test-functions
594167
@@ -30,7 +30,6 @@ TIMED_OUT=  # will be 1 after run_* if *_TIMEOUT is set and test timed out
594167
 [[ "$LOOKS_LIKE_SUSE" ]] && FSTYPE="${FSTYPE:-btrfs}" || FSTYPE="${FSTYPE:-ext4}"
594167
 UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-default}"
594167
 EFI_MOUNT="${EFI_MOUNT:-$(bootctl -x 2>/dev/null || echo /boot)}"
594167
-QEMU_MEM="${QEMU_MEM:-512M}"
594167
 # Note that defining a different IMAGE_NAME in a test setup script will only result
594167
 # in default.img being copied and renamed. It can then be extended by defining
594167
 # a test_append_files() function. The $1 parameter will be the root directory.
594167
@@ -255,7 +254,7 @@ if get_bool "$IS_BUILT_WITH_ASAN"; then
594167
     STRIP_BINARIES=no
594167
     SKIP_INITRD="${SKIP_INITRD:-yes}"
594167
     PATH_TO_INIT=$ROOTLIBDIR/systemd-under-asan
594167
-    QEMU_MEM="2048M"
594167
+    QEMU_MEM="${QEMU_MEM:-2G}"
594167
     QEMU_SMP="${QEMU_SMP:-4}"
594167
 
594167
     # We need to correctly distinguish between gcc's and clang's ASan DSOs.
594167
@@ -444,7 +443,7 @@ run_qemu() {
594167
     qemu_options+=(
594167
         -smp "$QEMU_SMP"
594167
         -net none
594167
-        -m "$QEMU_MEM"
594167
+        -m "${QEMU_MEM:-512M}"
594167
         -nographic
594167
         -kernel "$KERNEL_BIN"
594167
         -drive "format=raw,cache=unsafe,file=$image"