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 <james.r.harris@intel.com>
Change-Id: I6e441ed2d703a04430305ad712903a7fa41190c1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9726
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Jim Harris 2021-10-04 22:46:20 +00:00 committed by Tomasz Zawadzki
parent 93351b0e01
commit 99fb67803c

View File

@ -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"