tools: run-tests: sample-passthrough*

This commit is contained in:
Bill Zissimopoulos
2017-01-30 23:10:34 -08:00
parent 9a9d3cd4e8
commit ff649e05c5
2 changed files with 74 additions and 1 deletions

36
tools/build-sample.bat Normal file
View File

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