forked from microsoft/sarif-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RunTests.cmd
67 lines (56 loc) · 1.85 KB
/
RunTests.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
:: RunTests.cmd
::
:: This script runs the tests in each test project. This is done in a separate script,
:: rather than inline in BuildAndTest.cmd, because AppVeyor cannot run BuildAndTest.
:: AppVeyor runs the tests by invoking a separate script, and this is it.
@ECHO off
SETLOCAL ENABLEDELAYEDEXPANSION
set ReporterOption=
set ThisFileDirectory=%~dp0
:NextArg
if "%1" == "" goto :EndArgs
if "%1" == "/appveyor" (
set ReporterOption=-appveyor&& shift && goto :NextArg
)
if "%1" == "/config" (
if not "%2" == "Debug" if not "%2" == "Release" echo error: /config must be either Debug or Release && goto :ExitFailed
set Configuration=%2&& shift && shift && goto :NextArg
)
echo Unrecognized option "%1" && goto :ExitFailed
:EndArgs
call SetBuildEnvVars.cmd
set Frameworks=netcoreapp2.1 net461
set TestRunnerRootPath=%ThisFileDirectory%src\packages\xunit.runner.console\2.3.1\tools\
for %%p in (%NewTestProjects%) do (
for %%f in (%Frameworks%) do (
echo Running tests for %%p: %%f
pushd %ThisFileDirectory%bld\bin\%%p\AnyCPU_%Configuration%\%%f
if "%%f" EQU "netcoreapp2.1" (
dotnet %TestRunnerRootPath%netcoreapp2.1\xunit.console.dll %%p.dll %ReporterOption%
) else (
%TestRunnerRootPath%net452\xunit.console.exe %%p.dll %ReporterOption%
)
if "%ERRORLEVEL%" NEQ "0" (
popd
echo %%i: tests failed.
goto ExitFailed
)
popd
)
)
for %%p in (%OldTestProjects%) do (
echo Running tests for %%p
pushd %ThisFileDirectory%bld\bin\%%p\AnyCPU_%Configuration%
%TestRunnerRootPath%net452\xunit.console.exe %%p.dll %ReporterOption% -parallel none
if "%ERRORLEVEL%" NEQ "0" (
popd
echo %%i: tests failed.
goto ExitFailed
)
popd
)
goto Exit
:ExitFailed
@echo Tests did not complete successfully.
exit /B 1
:Exit