summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest/TEST-36-NUMAPOLICY/test.sh6
-rw-r--r--test/test-functions18
2 files changed, 23 insertions, 1 deletions
diff --git a/test/TEST-36-NUMAPOLICY/test.sh b/test/TEST-36-NUMAPOLICY/test.sh
index 02f013568c..a08ad6c14a 100755
--- a/test/TEST-36-NUMAPOLICY/test.sh
+++ b/test/TEST-36-NUMAPOLICY/test.sh
@@ -3,7 +3,11 @@ set -e
TEST_DESCRIPTION="test MUMAPolicy= and NUMAMask= options"
TEST_NO_NSPAWN=1
-QEMU_OPTIONS="-numa node,nodeid=0"
. $TEST_BASE_DIR/test-functions
+if qemu_min_version "5.2.0"; then
+ QEMU_OPTIONS="-object memory-backend-ram,id=mem0,size=512M -numa node,memdev=mem0,nodeid=0"
+else
+ QEMU_OPTIONS="-numa node,nodeid=0"
+fi
do_test "$@" 36
diff --git a/test/test-functions b/test/test-functions
index 91cd7312d6..39f2baea01 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -227,6 +227,24 @@ function find_qemu_bin() {
fi
}
+# Compares argument #1=X.Y.Z (X&Y&Z = numeric) to the version of the installed qemu
+# returns 0 if newer or equal
+# returns 1 if older
+# returns 2 if failing
+function qemu_min_version() {
+ find_qemu_bin || return 2
+
+ # get version from binary
+ qemu_ver=$($QEMU_BIN --version | awk '/^QEMU emulator version ([0-9]*\.[0-9]*\.[0-9]*) / {print $4}')
+
+ # Check version string format
+ echo "$qemu_ver" | grep -q '^[0-9]*\.[0-9]*\.[0-9]*$' || return 2
+ echo "$1" | grep -q '^[0-9]*\.[0-9]*\.[0-9]*$' || return 2
+
+ # compare as last command to return that value
+ printf "%s\n%s\n" "$1" "$qemu_ver" | sort -V -C
+}
+
# Return 0 if QEMU did run (then you must check the result state/logs for actual
# success), or 1 if QEMU is not available.
run_qemu() {