1 @rem Licensed to the .NET Foundation under one or more agreements.
2 @rem The .NET Foundation licenses this file to you under the MIT license.
3 @rem See the LICENSE file in the project root for more information.
7 Setlocal EnableDelayedExpansion
9 rem Set defaults for the file extension, architecture and configuration
13 set TEST_ARCHITECTURE=x64
14 set TEST_CONFIG=Release
21 IF /I [%TEST_ARCHITECTURE%] == [x86jit32] (
24 set TEST_ARCH=%TEST_ARCHITECTURE%
27 set CORECLR_OVERLAY=%CORECLR_REPO%\bin\tests\Windows_NT.%TEST_ARCH%.%TEST_CONFIG%\Tests\Core_Root
28 set RUNLOG=%CORECLR_REPO%\bin\Logs\perfrun.log
30 if NOT EXIST %CORECLR_OVERLAY% (
31 echo Can't find test overlay directory '%CORECLR_OVERLAY%'
32 echo Please build and run Release CoreCLR tests
36 @echo --- setting up sandbox
38 if exist sandbox rd /s /q sandbox
39 if exist sandbox echo ERROR: Failed to remove the sandbox folder& exit /b 1
40 if not exist sandbox mkdir sandbox
41 if not exist sandbox echo ERROR: Failed to create the sandbox folder& exit /b 1
44 @rem stage stuff we need
47 "%CORECLR_REPO%\Tools\dotnetcli\dotnet.exe" restore "%CORECLR_REPO%\tests\src\Common\PerfHarness\project.json"
48 "%CORECLR_REPO%\Tools\dotnetcli\dotnet.exe" publish "%CORECLR_REPO%\tests\src\Common\PerfHarness\project.json" -c Release -o %CORECLR_REPO%\sandbox
49 xcopy /sy %CORECLR_REPO%\packages\Microsoft.Diagnostics.Tracing.TraceEvent\1.0.0-alpha-experimental\lib\native\* . >> %RUNLOG%
50 xcopy /sy %CORECLR_REPO%\bin\tests\Windows_NT.%TEST_ARCH%.%TEST_CONFIG%\Tests\Core_Root\* . >> %RUNLOG%
52 @rem find and stage the tests
53 for /R %CORECLR_PERF% %%T in (*.%TEST_FILE_EXT%) do (
57 @rem optionally upload results to benchview
58 if not [%BENCHVIEW_PATH%] == [] (
59 py "%BENCHVIEW_PATH%\submission.py" measurement.json ^
60 --build ..\build.json ^
61 --machine-data ..\machinedata.json ^
62 --metadata ..\submission-metadata.json ^
65 --config-name "%TEST_CONFIG%" ^
66 --config Configuration "%TEST_CONFIG%" ^
67 --config OS "Windows_NT" ^
68 --arch "%TEST_ARCHITECTURE%" ^
69 --machinepool "PerfSnake"
70 py "%BENCHVIEW_PATH%\upload.py" submission.json --container coreclr
78 set PERFOUT=perf-%BENCHNAME%
79 set XMLOUT=%PERFOUT%-summary.xml
81 echo --- Running %BENCHNAME%
83 @rem copy benchmark and any input files
85 xcopy /s %1 . >> %RUNLOG%
86 xcopy /s %BENCHDIR%*.txt . >> %RUNLOG%
88 set CORE_ROOT=%CORECLR_REPO%\sandbox
90 @rem setup additional environment variables
97 corerun.exe PerfHarness.dll %WORKSPACE%\sandbox\%BENCHNAME%.%TEST_FILE_EXT% --perf:runid Perf > %BENCHNAME%.out
99 @rem optionally generate results for benchview
100 if not [%BENCHVIEW_PATH%] == [] (
101 py "%BENCHVIEW_PATH%\measurement.py" xunit "Perf-%BENCHNAME%.xml" --better desc --drop-first-value --append
102 REM Save off the results to the root directory for recovery later in Jenkins
103 xcopy Perf-%BENCHNAME%*.xml %CORECLR_REPO%\
104 xcopy Perf-%BENCHNAME%*.etl %CORECLR_REPO%\
106 type %XMLOUT% | findstr "test name"
107 type %XMLOUT% | findstr Duration
108 type %XMLOUT% | findstr InstRetired
114 IF /I [%1] == [-testBinLoc] (
115 set CORECLR_PERF=%CORECLR_REPO%\%2
120 IF /I [%1] == [-runtype] (
126 IF /I [%1] == [-library] (
127 set TEST_FILE_EXT=dll
131 IF /I [%1] == [-uploadtobenchview] (
132 set BENCHVIEW_PATH=%2
137 IF /I [%1] == [-arch] (
138 set TEST_ARCHITECTURE=%2
143 IF /I [%1] == [-testEnv] (
149 IF /I [%1] == [-configuration] (
158 if /I [%1] == [-help] (
162 if [%CORECLR_PERF%] == [] (
169 echo run-xunit-perf.cmd -testBinLoc ^<path_to_tests^> [-library] [-arch] ^<x86^|x64^> [-configuration] ^<Release^|Debug^> [-uploadToBenchview] ^<path_to_benchview_tools^> [-runtype] ^<rolling^|private^>
171 echo For the path to the tests you can pass a parent directory and the script will grovel for
172 echo all tests in subdirectories and run them.
173 echo The library flag denotes whether the tests are build as libraries (.dll) or an executable (.exe)
174 echo Architecture defaults to x64 and configuration defaults to release.
175 echo -uploadtoBenchview is used to specify a path to the Benchview tooling and when this flag is
176 echo set we will upload the results of the tests to the coreclr container in benchviewupload.
177 echo Runtype sets the runtype that we upload to Benchview, rolling for regular runs, and private for