2014-03-14 01:08:07 +04:00
@ echo off
2014-06-12 11:39:05 +04:00
setlocal enableextensions enabledelayedexpansion
2016-05-04 20:42:26 +03:00
REM Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2014-06-12 11:39:05 +04:00
set COMMAND =
set ENABLERUNTIMETESTS =
2014-03-14 01:08:07 +04:00
set EXITCODE = 0
set FLAVOR = debug
2014-06-12 11:39:05 +04:00
set INTEGRATIONTESTS =
set WIX_TEST_ROOT = %~dp0
set WIX_ROOT = %WIX_TEST_ROOT:~0,-6%
2014-03-14 01:08:07 +04:00
: Parse_Args
2014-06-12 11:39:05 +04:00
if /i " %1 " == " " goto : End_Parse_Args
if /i " %1 " == " debug " set FLAVOR = debug& shift & goto : Parse_Args
if /i " %1 " == " -debug " set FLAVOR = debug& shift & goto : Parse_Args
if /i " %1 " == " /debug " set FLAVOR = debug& shift & goto : Parse_Args
if /i " %1 " == " ship " set FLAVOR = release& shift & goto : Parse_Args
if /i " %1 " == " -ship " set FLAVOR = release& shift & goto : Parse_Args
if /i " %1 " == " /ship " set FLAVOR = release& shift & goto : Parse_Args
if /i " %1 " == " -enableruntimetests " set ENABLERUNTIMETESTS = true& shift & goto : Parse_Args
if /i " %1 " == " /enableruntimetests " set ENABLERUNTIMETESTS = true& shift & goto : Parse_Args
if /i " %1 " == " -integrationtests " set INTEGRATIONTESTS = true& shift & goto : Parse_Args
if /i " %1 " == " /integrationtests " set INTEGRATIONTESTS = true& shift & goto : Parse_Args
if /i " %1 " == " -? " goto : Help
if /i " %1 " == " /? " goto : Help
if /i " %1 " == " -help " goto : Help
if /i " %1 " == " /help " goto : Help
echo .
echo .Invalid argument: %1
2014-03-14 01:08:07 +04:00
goto : Help
: End_Parse_Args
2014-06-12 11:39:05 +04:00
set WIX_BUILD_X86 = %WIX_ROOT% \build\%FLAVOR% \x86
2014-03-14 01:08:07 +04:00
2014-06-12 11:39:05 +04:00
REM Specify the test assemblies.
set TESTASSEMBLIES = !TESTASSEMBLIES! " %WIX_BUILD_X86% \WixTest.BurnIntegrationTests.dll "
set TESTASSEMBLIES = !TESTASSEMBLIES! " %WIX_BUILD_X86% \WixTest.MsbuildIntegrationTests.dll "
2014-03-14 01:08:07 +04:00
2014-06-12 11:39:05 +04:00
if not " %INTEGRATIONTESTS% " == " true " (
set TESTASSEMBLIES = !TESTASSEMBLIES! " %WIX_BUILD_X86% \BurnUnitTest.dll "
set TESTASSEMBLIES = !TESTASSEMBLIES! " %WIX_BUILD_X86% \DUtilUnitTest.dll "
set TESTASSEMBLIES = !TESTASSEMBLIES! " %WIX_BUILD_X86% \WixTests.dll "
2014-03-14 01:08:07 +04:00
)
2016-05-15 20:04:27 +03:00
REM Enable runtime tests
if " %ENABLERUNTIMETESTS% " == " true " (
set RuntimeTestsEnabled = true
)
2014-06-12 11:39:05 +04:00
for /f " usebackq " %% i in ( `where /f xunit.console.clr4.*` ) do (
set COMMAND = %% i
2014-03-14 01:08:07 +04:00
)
2014-06-12 11:39:05 +04:00
if not " !COMMAND! " == " " (
for %% i in ( !TESTASSEMBLIES! ) do (
call !COMMAND! %% i
if not " !EXITCODE! " == " 0 " set EXITCODE = %ERRORLEVEL%
)
) else (
2016-05-15 20:04:27 +03:00
call msbuild " %WIX_TEST_ROOT% test\All.testproj " /p:Configuration=%FLAVOR%
2014-06-12 11:39:05 +04:00
if not " !EXITCODE! " == " 0 " set EXITCODE = %ERRORLEVEL%
2014-03-14 01:08:07 +04:00
)
2014-06-12 11:39:05 +04:00
goto : End
2014-03-14 01:08:07 +04:00
: Help
echo .
echo test.bat - Runs tests against the WiX core toolset
echo .
2014-06-12 11:39:05 +04:00
echo Usage: test.bat [debug^| ship] [options]
2014-03-14 01:08:07 +04:00
echo .
echo Options:
echo flavor Sets the flavor to either debug (default) or ship
2014-06-12 11:39:05 +04:00
echo enableruntimetests Enable runnning tests that can change the machine state
echo integrationtests Run only integration tests
echo ?^| help Shows this help
2014-03-14 01:08:07 +04:00
echo .
2014-06-12 11:39:05 +04:00
goto : End
2014-03-14 01:08:07 +04:00
2014-06-12 11:39:05 +04:00
: End
endlocal
exit /b !EXITCODE!