From 5a21edf4e3b16103cbd31e2f4f3c80943de3837f Mon Sep 17 00:00:00 2001 From: Nick Connolly Date: Mon, 29 Mar 2021 14:00:11 +0100 Subject: [PATCH] scripts: add autotest support for Windows Source Windows specific definitions from common.sh. These adjust uname to report the operating system as WSL, Msys or Cygwin and the kernel name as Windows. They also define kill() to invoke the SIGTERM handler before causing a hard stop with TerminateProcess. Adjust the ordering of the 'source' commands in autotest_common.sh so that the config definitions are available when common.sh is loaded. Define MAKE, MAKEFLAGS and HUGEMEM for Windows. Signed-off-by: Nick Connolly Change-Id: I130b892ee55c925a0b033bda271a29133993afb7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7101 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk --- scripts/common.sh | 7 +++++++ test/common/autotest_common.sh | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index 2edd0eddf..edd5fa5f5 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -315,3 +315,10 @@ le() { cmp_versions "$1" "<=" "$2"; } ge() { cmp_versions "$1" ">=" "$2"; } eq() { cmp_versions "$1" "==" "$2"; } neq() { ! eq "$1" "$2"; } + +if [[ -e "$CONFIG_WPDK_DIR/bin/wpdk_common.sh" ]]; then + # Adjust uname to report the operating system as WSL, Msys or Cygwin + # and the kernel name as Windows. Define kill() to invoke the SIGTERM + # handler before causing a hard stop with TerminateProcess. + source "$CONFIG_WPDK_DIR/bin/wpdk_common.sh" +fi diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 1e666cc39..937597c93 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -28,8 +28,6 @@ xtrace_disable set -e shopt -s expand_aliases -source "$rootdir/test/common/applications.sh" -source "$rootdir/scripts/common.sh" if [[ -e $rootdir/test/common/build_config.sh ]]; then source "$rootdir/test/common/build_config.sh" elif [[ -e $rootdir/mk/config.mk ]]; then @@ -39,6 +37,10 @@ else source "$rootdir/CONFIG" fi +# Source scripts after the config so that the definitions are available. +source "$rootdir/test/common/applications.sh" +source "$rootdir/scripts/common.sh" + # Dummy function to be called after restoring xtrace just so that it appears in the # xtrace log. This way we can consistently track when xtrace is enabled/disabled. function xtrace_enable() { @@ -233,6 +235,11 @@ elif [ "$(uname -s)" = "FreeBSD" ]; then 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 +elif [ "$(uname -s)" = "Windows" ]; then + MAKE="make" + MAKEFLAGS=${MAKEFLAGS:--j$(nproc)} + # Keep the default 2GB for Windows. + export HUGEMEM=2048 else echo "Unknown OS \"$(uname -s)\"" exit 1