From 99fb67803c01fb424960f65bf6caced4fac88f3c Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 4 Oct 2021 22:46:20 +0000 Subject: [PATCH] test: allow user to override autotest_common.sh HUGEMEM By default on Linux, we hardcode HUGEMEM=4096. But some environments (like VMs) may not have enough memory to allocate that much hugepage memory, and the user may want to run some test scripts that don't require that much memory. So allow user to specify HUGEMEM in their environment before calling a script that uses autotest_common.sh. If it's set, it will use the specified value, otherwise default to the values used prior to this patch. Signed-off-by: Jim Harris Change-Id: I6e441ed2d703a04430305ad712903a7fa41190c1 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9726 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Tomasz Zawadzki --- test/common/autotest_common.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index fea8cad75..f5cd4fbf9 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -221,7 +221,8 @@ if [ $SPDK_RUN_VALGRIND -eq 0 ]; then fi if [ "$(uname -s)" = "Linux" ]; then - export HUGEMEM=4096 CLEAR_HUGE=yes + HUGEMEM=${HUGEMEM:-4096} + export CLEAR_HUGE=yes if [[ $SPDK_TEST_CRYPTO -eq 1 || $SPDK_TEST_REDUCE -eq 1 ]]; then # Make sure that memory is distributed across all NUMA nodes - by default, all goes to # node0, but if QAT devices are attached to a different node, all of their VFs will end @@ -240,17 +241,19 @@ elif [ "$(uname -s)" = "FreeBSD" ]; then MAKE="gmake" MAKEFLAGS=${MAKEFLAGS:--j$(sysctl -a | grep -E -i 'hw.ncpu' | awk '{print $2}')} # FreeBSD runs a much more limited set of tests, so keep the default 2GB. - export HUGEMEM=2048 + HUGEMEM=${HUGEMEM:-2048} elif [ "$(uname -s)" = "Windows" ]; then MAKE="make" MAKEFLAGS=${MAKEFLAGS:--j$(nproc)} # Keep the default 2GB for Windows. - export HUGEMEM=2048 + HUGEMEM=${HUGEMEM:-2048} else echo "Unknown OS \"$(uname -s)\"" exit 1 fi +export HUGEMEM=$HUGEMEM + if [ -z "$output_dir" ]; then mkdir -p "$rootdir/../output" export output_dir="$rootdir/../output"