Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/tests/Common/tests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
<TestAssemblyDir Condition="'$(TestAssemblyDir)' == ''">$(BaseOutputPathWithConfig)\tests\</TestAssemblyDir>
<__TestRunHtmlLog Condition="'$(__TestRunHtmlLog)' == ''">$(__LogsDir)\TestRun.html</__TestRunHtmlLog>
<__TestRunXmlLog Condition="'$(__TestRunXmlLog)' == ''">$(__LogsDir)\TestRun.xml</__TestRunXmlLog>
<!-- When TestSubtree is set, only run tests under that subtree (e.g. JIT/Regression). -->
<_TestSearchRoot Condition="'$(TestSubtree)' == ''">$(BaseOutputPathWithConfig)\**</_TestSearchRoot>
<_TestSearchRoot Condition="'$(TestSubtree)' != ''">$(BaseOutputPathWithConfig)\$(TestSubtree)\**</_TestSearchRoot>
</PropertyGroup>


<Target Name="FindBuildAllTestsAsStandaloneRunnerScripts">
<ItemGroup>
<_StandaloneRunnerMarker Include="$(BaseOutputPathWithConfig)\**\*.StandaloneTestRunner" />
<_StandaloneRunnerMarker Include="$(_TestSearchRoot)\*.StandaloneTestRunner" />
<StandaloneRunnerScripts Include="$([System.IO.Path]::ChangeExtension('%(_StandaloneRunnerMarker.Identity)', '.$(TestScriptExtension)'))" />
<MergedTestWrapperScripts Update="@(MergedTestWrapperScripts)">
<RedirectOutputToFile>$([System.IO.Path]::ChangeExtension('%(MergedTestWrapperScripts.Identity)', '.log'))</RedirectOutputToFile>
Expand All @@ -24,7 +27,7 @@

<Target Name="FindMergedTestDirectories">
<ItemGroup>
<_MergedTestAssemblyMarkers Include="$(BaseOutputPathWithConfig)\**\*.MergedTestAssembly" />
<_MergedTestAssemblyMarkers Include="$(_TestSearchRoot)\*.MergedTestAssembly" />
<MergedTestWrapperScripts Include="$([System.IO.Path]::ChangeExtension('%(_MergedTestAssemblyMarkers.Identity)', '.$(TestScriptExtension)'))" />
<MergedTestWrapperScripts Update="@(MergedTestWrapperScripts)">
<RedirectOutputToFile>$([System.IO.Path]::ChangeExtension('%(MergedTestWrapperScripts.Identity)', '.log'))</RedirectOutputToFile>
Expand All @@ -40,7 +43,9 @@
<Target Name="PrepareTestsToRun"
DependsOnTargets="FindBuildAllTestsAsStandaloneRunnerScripts;FindMergedTestDirectories">
<Error Text="Tests must be built to do a test run."
Condition="'@(StandaloneRunnerScripts)' == '' and '@(MergedTestWrapperScripts)' == ''" />
Condition="'$(TestSubtree)' == '' and '@(StandaloneRunnerScripts)' == '' and '@(MergedTestWrapperScripts)' == ''" />
<Error Text="No tests found under subtree '$(TestSubtree)'. Ensure tests have been built for this configuration/subtree and verify the subtree path is relative to the test output directory (e.g. JIT/Regression)."
Condition="'$(TestSubtree)' != '' and '@(StandaloneRunnerScripts)' == '' and '@(MergedTestWrapperScripts)' == ''" />
<Error Text="Cannot run tests when both StandaloneRunnerScripts and MergedTestWrapperScripts are present. Either build the test tree as normal (merged runner) or with BuildAllTestsAsStandalone=true."
Condition="'@(StandaloneRunnerScripts)' != '' and '@(MergedTestWrapperScripts)' != ''" />
</Target>
Expand Down
10 changes: 10 additions & 0 deletions src/tests/run.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ if /i "%1" == "tieringtest" (set TieringTest=1&shift
if /i "%1" == "runnativeaottests" (set RunNativeAot=1&shift&goto Arg_Loop)
if /i "%1" == "interpreter" (set RunInterpreter=1&shift&goto Arg_Loop)
if /i "%1" == "node" (set RunWithNodeJS=1&shift&goto Arg_Loop)
@REM For tree, support '/', '-', and '--' prefixes like build.cmd
set __treeArg=%~1
set __treeArg=%__treeArg:/=%
set __treeArg=%__treeArg:-=%
if /i "%__treeArg%" == "tree" (set __TreeSubtree=%~2&shift&shift&goto Arg_Loop)

if /i not "%1" == "msbuildargs" goto SkipMsbuildArgs
:: All the rest of the args will be collected and passed directly to msbuild.
Expand Down Expand Up @@ -195,6 +200,10 @@ if defined RunWithNodeJS (
set __RuntestPyArgs=%__RuntestPyArgs% --node
)

if defined __TreeSubtree (
set __RuntestPyArgs=%__RuntestPyArgs% --tree "%__TreeSubtree%"
)

REM Find python and set it to the variable PYTHON
set _C=-c "import sys; sys.stdout.write(sys.executable)"
(py -3 %_C% || py -2 %_C% || python3 %_C% || python2 %_C% || python %_C%) > %TEMP%\pythonlocation.txt 2> NUL
Expand Down Expand Up @@ -261,6 +270,7 @@ echo msbuildargs ^<args...^> - Pass all subsequent args directly to msbuild
echo ^<CORE_ROOT^> - Path to the runtime to test ^(if specified^).
echo interpreter - Runs the tests with the interpreter enabled.
echo node - Runs the tests with NodeJS ^(wasm only^).
echo tree ^<path^> - Only run tests under the specified subtree ^(e.g. JIT/Regression^).
echo.
echo Note that arguments are not case-sensitive.
echo.
Expand Down
9 changes: 9 additions & 0 deletions src/tests/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
parser.add_argument("--run_in_context", dest="run_in_context", action="store_true", default=False)
parser.add_argument("--tiering_test", dest="tiering_test", action="store_true", default=False)
parser.add_argument("--run_nativeaot_tests", dest="run_nativeaot_tests", action="store_true", default=False)
parser.add_argument("--tree", dest="tree", default=None, help="Only run tests under the specified subtree (e.g. JIT/Regression).")

################################################################################
# Globals
Expand Down Expand Up @@ -575,6 +576,9 @@ def call_msbuild(args):
if args.limited_core_dumps:
command += ["/p:LimitedCoreDumps=true"]

if args.tree:
command += ["/p:TestSubtree=%s" % args.tree]

print(" ".join(command))

sys.stdout.flush() # flush output before creating sub-process
Expand Down Expand Up @@ -1019,6 +1023,11 @@ def setup_args(args):
lambda arg: True,
"Error setting run_nativeaot_tests")

coreclr_setup_args.verify(args,
"tree",
lambda arg: True,
"Error setting tree")

coreclr_setup_args.verify(args,
"interpreter",
lambda arg: True,
Expand Down
22 changes: 22 additions & 0 deletions src/tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function print_usage {
echo ' --runnativeaottests : Run NativeAOT compiled tests'
echo ' --interpreter : Runs the tests with the interpreter enabled'
echo ' --node : Runs the tests with NodeJS (wasm only)'
echo ' --tree=<path> : Only run tests under the specified subtree (e.g. JIT/Regression)'
Comment thread
jtschuster marked this conversation as resolved.
echo ' --limitedDumpGeneration : '
}

Expand Down Expand Up @@ -73,9 +74,16 @@ runSequential=0
runincontext=0
tieringtest=0
nativeaottest=0
treeSubtree=

for i in "$@"
do
if [[ "$__nextTreeArg" == "1" ]]; then
treeSubtree="$i"
__nextTreeArg=
continue
fi

case $i in
-h|--help)
print_usage
Expand Down Expand Up @@ -189,6 +197,15 @@ do
--runnativeaottests)
nativeaottest=1
;;
--tree=*|-tree=*)
treeSubtree=${i#*=}
;;
--tree:*|-tree:*)
treeSubtree=${i#*:}
;;
--tree|-tree)
__nextTreeArg=1
;;
--interpreter)
export RunInterpreter=1
;;
Expand Down Expand Up @@ -316,6 +333,11 @@ if [[ -n "$RunWithNodeJS" ]]; then
runtestPyArguments+=("--node")
fi

if [[ -n "$treeSubtree" ]]; then
echo "Running tests under subtree : ${treeSubtree}"
runtestPyArguments+=("--tree" "$treeSubtree")
fi

# Default to python3 if it is installed
__Python=python
if command -v python3 &>/dev/null; then
Expand Down