From ff649e05c57666b8ecbd1a011d614f4bb13351b4 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Mon, 30 Jan 2017 23:10:34 -0800 Subject: [PATCH] tools: run-tests: sample-passthrough* --- tools/build-sample.bat | 36 ++++++++++++++++++++++++++++++++++++ tools/run-tests.bat | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 tools/build-sample.bat diff --git a/tools/build-sample.bat b/tools/build-sample.bat new file mode 100644 index 00000000..3a3e2e23 --- /dev/null +++ b/tools/build-sample.bat @@ -0,0 +1,36 @@ +@echo off + +setlocal +setlocal EnableDelayedExpansion + +if not X%1==X set Config=%1 +if not X%2==X set Arch=%2 +if not X%3==X set Sample=%3 +if not X%4==X set ProjDir=%~4 + +if X!ProjDir!==X (echo usage: build-sample Config Arch Sample ProjDir >&2 & goto fail) + +call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x64 + +set RegKey="HKLM\SOFTWARE\WinFsp" +set RegVal="InstallDir" +reg query !RegKey! /v !RegVal! /reg:32 >nul 2>&1 +if !ERRORLEVEL! equ 0 ( + for /f "tokens=2,*" %%i in ('reg query !RegKey! /v !RegVal! /reg:32 ^| findstr !RegVal!') do ( + set InstallDir=%%j + ) +) +if not exist "!InstallDir!" (echo cannot find WinFsp installation >&2 & goto fail) +if not exist "!InstallDir!samples\!Sample!" (echo cannot find WinFsp sample !Sample! >&2 & goto fail) + +if exist "!ProjDir!" rmdir /s/q "!ProjDir!" +mkdir "!ProjDir!" +xcopy /s/e/q/y "!InstallDir!samples\!Sample!" "!ProjDir!" + +devenv "!ProjDir!\!Sample!.sln" /build "!Config!|!Arch!" +if !ERRORLEVEL! neq 0 goto :fail + +exit /b 0 + +:fail +exit /b 1 diff --git a/tools/run-tests.bat b/tools/run-tests.bat index 0ec89623..5fe8de76 100755 --- a/tools/run-tests.bat +++ b/tools/run-tests.bat @@ -57,7 +57,9 @@ set dfl_tests=^ fscrash-x86 set opt_tests=^ ifstest-memfs-x64-disk ^ - ifstest-memfs-x86-disk + ifstest-memfs-x86-disk ^ + sample-passthrough-x64 ^ + sample-passthrough-x86 set tests= for %%f in (%dfl_tests%) do ( @@ -477,6 +479,41 @@ for /F "delims=" %%l in ('call "%ProjRoot%\tools\ifstest.bat" %* /z /v ^| findst if not X!IfsTestFound!==XYES set IfsTestExit=1 exit /b !IfsTestExit! +:sample-passthrough-x64 +call :__sample-passthrough x64 +if !ERRORLEVEL! neq 0 goto fail +exit /b 0 + +:sample-passthrough-x86 +call :__sample-passthrough x86 +if !ERRORLEVEL! neq 0 goto fail +exit /b 0 + +:__sample-passthrough +set SamplePassthroughExit=0 +call %ProjRoot%\tools\build-sample %Configuration% %1 passthrough "%TMP%\passthrough-%1" +if !ERRORLEVEL! neq 0 goto fail +mkdir "%TMP%\passthrough-%1\test" +call "%ProjRoot%\tools\fsreg" passthrough "%TMP%\passthrough-%1\build\%Configuration%\passthrough-%1.exe" "-u %%%%1 -m %%%%2" "D:P(A;;RPWPLC;;;WD)" +net use L: "\\passthrough\%TMP::=$%\passthrough-%1\test" +if !ERRORLEVEL! neq 0 goto fail +rem Cannot use timeout under cygwin/mintty: "Input redirection is not supported" +waitfor 7BF47D72F6664550B03248ECFE77C7DD /t 3 2>nul +pushd +cd L: >nul 2>nul || (echo Unable to find drive L: >&2 & goto fail) +L: + +"%ProjRoot%\build\VStudio\build\%Configuration%\winfsp-tests-%1.exe" ^ + --external --resilient --case-insensitive-cmp --share-prefix="\passthrough\%TMP::=$%\passthrough-%1\test" ^ + -create_allocation_test -getfileinfo_name_test -rename_flipflop_test -rename_mmap_test -reparse* -stream* +if !ERRORLEVEL! neq 0 set SamplePassthroughExit=1 + +popd +net use L: /delete +call "%ProjRoot%\tools\fsreg" -u passthrough +rmdir /s/q "%TMP%\passthrough-%1" +exit /b !SamplePassthroughExit! + :leak-test for /F "tokens=1,2 delims=:" %%i in ('verifier /query ^| findstr ^ /c:"Current Pool Allocations:" ^