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 <nick.connolly@mayadata.io>
Change-Id: I130b892ee55c925a0b033bda271a29133993afb7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7101
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Nick Connolly 2021-03-29 14:00:11 +01:00 committed by Tomasz Zawadzki
parent 93e6e40442
commit 5a21edf4e3
2 changed files with 16 additions and 2 deletions

View File

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

View File

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