2009-07-22 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.Core / run-tests.bat
blob2523375b0265aa304720cbe6f03a07d7d15af1f8
1 REM @echo on\r
2 REM ********************************************************\r
3 REM This batch file receives the follwing parameters:\r
4 REM build/rebuild (optional): should the solution file be rebuilded \r
5 REM                             or just builded before test run (default is rebuild)\r
6 REM output files name prefix (mandratory) : prefix for naming output xml files\r
7 REM test fixture name (optional) : if you want to run some particular test fixture\r
8 REM directory to run tests (optional)\r
9 REM path back to root directory (opposite to previous param)\r
10 REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\\r
11 REM will cause to build (and not rebuild) test solutions,\r
12 REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test\r
13 REM with output files named GhTests.Net.xml and GhTests.GH.xml\r
14 REM ********************************************************\r
16 IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION\r
18 IF "%1"=="rebuild" (\r
19         set BUILD_OPTION=rebuild\r
20 ) ELSE (\r
21         set BUILD_OPTION=build\r
22 )\r
24 REM ********************************************************\r
25 REM Set parameters\r
26 REM ********************************************************\r
28 set OUTPUT_FILE_PREFIX=System_Core_MonoTests\r
29 set RUNNING_FIXTURE=MonoTests\r
30 set TEST_SOLUTION=Test\System.Core.Tests-2008.JavaEE.csproj\r
31 set TEST_ASSEMBLY=System.Core.Tests.jar\r
32 set PROJECT_CONFIGURATION=Debug_Java20\r
35 set startDate=%date%\r
36 set startTime=%time%\r
37 set sdy=%startDate:~10%\r
38 set /a sdm=1%startDate:~4,2% - 100\r
39 set /a sdd=1%startDate:~7,2% - 100\r
40 set /a sth=%startTime:~0,2%\r
41 set /a stm=1%startTime:~3,2% - 100\r
42 set /a sts=1%startTime:~6,2% - 100\r
43 set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm%\r
46 REM ********************************************************\r
47 REM @echo Set environment\r
48 REM ********************************************************\r
50 set JGAC_PATH=%VMW_HOME%\java_refs\framework\\r
51 set JAVA_HOME=%VMW_HOME%\jre\r
53 set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar\r
54 set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar\r
55 set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar\r
56 set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Configuration.jar\r
57 set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar\r
58 set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Drawing.jar\r
59 set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Core.jar\r
60 set NUNIT_OPTIONS=/exclude=NotWorking,NotDotNet,TargetJvmNotSupported,TargetJvmNotWorking,NotDotNet\r
62 if "%GH_VERSION%"=="" (\r
63         set GH_VERSION=0_0_0_0\r
64 )\r
66 set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME%\r
67 set GH_OUTPUT_XML=%COMMON_PREFIX%.xml\r
68 set BUILD_LOG=%COMMON_PREFIX%.build.log\r
69 set RUN_LOG=%COMMON_PREFIX%.run.log\r
71 set OUTPUT_DIR=..\r
72 set NUNIT_PATH=..\..\nunit20\\r
73 set NUNIT_CLASSPATH=%NUNIT_PATH%framework\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar\r
74 set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%util\bin\%PROJECT_CONFIGURATION%\nunit.util.jar\r
75 set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%core\bin\%PROJECT_CONFIGURATION%\nunit.core.jar\r
76 set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar\r
77 set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;.\r
78 set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY%\r
80 set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%"\r
82 REM ********************************************************\r
83 rem @echo Building GH solution...\r
84 REM ********************************************************\r
86 rem devenv %TEST_SOLUTION% /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1\r
87 msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1\r
89 IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION\r
91 REM ********************************************************\r
92 rem @echo Building NUnit solution...\r
93 REM ********************************************************\r
95 if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP\r
97 REM devenv ..\..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1\r
98 rem msbuild %NUNIT_PATH%nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1\r
100 goto NUNITREADY\r
102 :NUNITSKIP\r
103 echo Skipping NUnit Build...\r
105 :NUNITREADY\r
106 set NUNIT_BUILD=DONE\r
108 IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION\r
110 REM ********************************************************\r
111 @echo Running GH tests...\r
112 REM ********************************************************\r
114 REM ********************************************************\r
115 @echo Running fixture "%RUNNING_FIXTURE%"\r
116 REM ********************************************************\r
118 copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% .\r
120 set TEST_TEMP=C:\MonoTemp\r
121 mkdir %TEST_TEMP%\r
123 REM @echo on\r
124 echo "%JAVA_HOME%\bin\java" -server -Xmx1024M -Djava.io.tmpdir="%TEST_TEMP%" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE%  %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% \r
125 "%JAVA_HOME%\bin\java" -server -Xmx1024M -Djava.io.tmpdir="%TEST_TEMP%" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE%  %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1\r
126 REM jdb -server -Xmx1024M -Djava.io.tmpdir="%TEST_TEMP%" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE%  %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML%\r
127 REM @echo off\r
129 REM ********************************************************\r
130 @echo Build XmlTool\r
131 REM ********************************************************\r
132 set XML_TOOL_PATH=..\..\..\tools\mono-xmltool\r
134 if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP\r
136 REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1\r
137 msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1\r
139 IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION\r
141 goto XMLTOOLREADY\r
143 :XMLTOOLSKIP\r
144 echo Skipping XmlToll build...\r
146 :XMLTOOLREADY\r
147 set XMLTOOL_BUILD=DONE\r
149 copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe .\r
150 copy %XML_TOOL_PATH%\nunit_transform.xslt .\r
152 REM ********************************************************\r
153 @echo Analyze and print results\r
154 REM ********************************************************\r
155 @echo on\r
156 xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML%\r
157 @echo off\r
159 :FINALLY\r
160 GOTO END\r
162 :ENVIRONMENT_EXCEPTION\r
163 @echo This test requires environment variable VMW_HOME to be defined\r
164 GOTO END\r
166 :BUILD_EXCEPTION\r
167 @echo Error in building solutions. See %BUILD_LOG% for details...\r
168 REM EXIT 1\r
169 GOTO END\r
171 :RUN_EXCEPTION\r
172 @echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details...\r
173 REM EXIT 1\r
174 GOTO END\r
176 :USAGE\r
177 @echo Parameters: "[build|rebuild] <output_file_name_prefix> <test_fixture> <relative_Working_directory> <back_path (..\..\.....) >"\r
178 GOTO END\r
180 :END\r
181 copy %RUN_LOG% %OUTPUT_DIR%\r
182 copy %BUILD_LOG% %OUTPUT_DIR%\r
183 copy %GH_OUTPUT_XML% %OUTPUT_DIR%\r
185 REM EXIT 0\r