From 83791388a2ce458a976d38dce7be35bcbcc00bb4 Mon Sep 17 00:00:00 2001 From: Tomas Date: Tue, 10 Aug 2021 03:03:11 +0200 Subject: [PATCH 1/9] Add support for building just a subset of runtime tests This change adds four new options to the runtime test build command: 1) test - build just that one test. 2) dir - build all tests in the directory. 3) tree - build all tests in the given subtree. 4) all - use clean rebuild (i.e. don't apply incrementalism) when building the tests. Thanks Tomas --- src/tests/Common/dirs.proj | 18 +++++++++++++++++- src/tests/build.cmd | 22 ++++++++++++++++++++++ src/tests/build.sh | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/src/tests/Common/dirs.proj b/src/tests/Common/dirs.proj index 6766e6bdecf685..1b9b915b307f79 100644 --- a/src/tests/Common/dirs.proj +++ b/src/tests/Common/dirs.proj @@ -19,7 +19,23 @@ - + + + + + + + + + + + + + + + + + diff --git a/src/tests/build.cmd b/src/tests/build.cmd index aac5ffd6fb1646..166a6a7c08472a 100644 --- a/src/tests/build.cmd +++ b/src/tests/build.cmd @@ -41,6 +41,11 @@ set processedArgs= set __UnprocessedBuildArgs= set __CommonMSBuildArgs= +set __BuildTestProject= +set __BuildTestDir= +set __BuildTestTree= +set __BuildTestAll= + set __SkipRestorePackages= set __SkipManaged= set __SkipTestWrappers= @@ -95,6 +100,11 @@ if /i "%1" == "skipnative" (set __SkipNative=1&set __CopyNativeProjec if /i "%1" == "skiptestwrappers" (set __SkipTestWrappers=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "skipgeneratelayout" (set __SkipGenerateLayout=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "test" (set __BuildTestProject=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "dir" (set __BuildTestDir=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "tree" (set __BuildTestTree=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "all" (set __BuildTestAll=1&shift&goto Arg_Loop) + if /i "%1" == "copynativeonly" (set __CopyNativeTestBinaries=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set __SkipGenerateLayout=1&set __SkipTestWrappers=1&set __SkipCrossgenFramework=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "generatelayoutonly" (set __SkipManaged=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "buildtestwrappersonly" (set __SkipNative=1&set __SkipManaged=1&set __BuildTestWrappersOnly=1&set __SkipGenerateLayout=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) @@ -361,6 +371,14 @@ for /l %%G in (1, 1, %__NumberOfTestGroups%) do ( set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:__SkipPackageRestore=true set __MSBuildBuildArgs=!__MSBuildBuildArgs! !__NativeBinariesLayoutTypeArg! set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:RuntimeFlavor=!__RuntimeFlavor! + set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:BuildTestProject=!__BuildTestProject! + set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:BuildTestDir=!__BuildTestDir! + set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:BuildTestTree=!__BuildTestTree! + + if "!__BuildTestAll!" == "1" ( + set __MSBuildBuildArgs=!__MSBuildBuildArgs! /t:rebuild + ) + echo Running: msbuild !__MSBuildBuildArgs! !__CommonMSBuildCmdPrefix! !__MSBuildBuildArgs! @@ -558,6 +576,10 @@ echo -priority=^ : specify a set of tests that will be built and run, with p echo 0: Build only priority 0 cases as essential testcases (default) echo 1: Build all tests with priority 0 and 1 echo 666: Build all tests with priority 0, 1 ... 666 +echo test ^: Only build test project ^ ^(relative or absolute project path under src\tests^) +echo dir ^: Build all test projects in the folder ^ ^(relative or absolute folder under src\tests^) +echo tree ^: Build all test projects in the subtree ^ ^(relative or absolute folder under src\tests^) +echo all: Clean-rebuild all selected tests ^(don't use incremental build^) echo allTargets: Build managed tests for all target platforms. echo -verbose: enables detailed file logging for the msbuild tasks into the msbuild log file. exit /b 1 diff --git a/src/tests/build.sh b/src/tests/build.sh index ada962503ad62a..e37bbbff32c88f 100755 --- a/src/tests/build.sh +++ b/src/tests/build.sh @@ -370,6 +370,13 @@ build_MSBuild_projects() buildArgs+=("\"/p:CopyNativeProjectBinaries=${__CopyNativeProjectsAfterCombinedTestBuild}\""); buildArgs+=("/p:__SkipPackageRestore=true"); buildArgs+=("/bl:${__RepoRootDir}/artifacts/log/${__BuildType}/build_managed_tests_${testGroupToBuild}.binlog"); + buildArgs+=("/p:BuildTestProject=${__BuildTestProject}"); + buildArgs+=("/p:BuildTestDir=${__BuildTestDir}"); + buildArgs+=("/p:BuildTestTree=${__BuildTestTree}"); + + if [[ "$__BuildTestAll" -ne 0 ]]; then + buildArgs+=("/t:rebuild"); + fi # Disable warnAsError - coreclr issue 19922 nextCommand="\"$__RepoRootDir/eng/common/msbuild.sh\" $__ArcadeScriptArgs --warnAsError false ${buildArgs[@]}" @@ -432,6 +439,11 @@ usage_list+=("-buildtestwrappersonly: only build the test wrappers.") usage_list+=("-copynativeonly: Only copy the native test binaries to the managed output. Do not build the native or managed tests.") usage_list+=("-generatelayoutonly: only pull down dependencies and build coreroot.") +usage_list+=("-test:xxx - only build a single test project"); +usage_list+=("-dir:xxx - build all tests in a given directory"); +usage_list+=("-tree:xxx - build all tests in a given subtree"); +usage_list+=("-all:xxx - rebuild all the specified tests"); + usage_list+=("-crossgen2: Precompiles the framework managed assemblies in coreroot using the Crossgen2 compiler.") usage_list+=("-priority1: include priority=1 tests in the build.") usage_list+=("-allTargets: Build managed tests for all target platforms.") @@ -492,6 +504,28 @@ handle_arguments_local() { __RebuildTests=1 ;; + test*|-test*) + local arg="$1" + local parts=(${arg//:/ }) + __BuildTestProject=${parts[1]} + ;; + + dir*|-dir*) + local arg="$1" + local parts=(${arg//:/ }) + __BuildTestDir=${parts[1]} + ;; + + tree*|-tree*) + local arg="$1" + local parts=(${arg//:/ }) + __BuildTestTree=${parts[1]} + ;; + + all|-all) + __BuildTestAll=1 + ;; + runtests|-runtests) __RunTests=1 ;; @@ -541,6 +575,10 @@ __DistroRid="" __DoCrossgen2=0 __CompositeBuildMode=0 __TestBuildMode= +__BuildTestProject="" +__BuildTestDir="" +__BuildTestTree="" +__BuildTestAll=0 __DotNetCli="$__RepoRootDir/dotnet.sh" __GenerateLayoutOnly= __IsMSBuildOnNETCoreSupported=0 From 28830f93b3c4eb32ca909ffa491bc89fe2882bab Mon Sep 17 00:00:00 2001 From: Tomas Date: Tue, 10 Aug 2021 22:14:46 +0200 Subject: [PATCH 2/9] Allow multiple specifications of 'test', 'dir' and 'tree' --- src/tests/Common/dirs.proj | 28 +++++++++++++++++----------- src/tests/build.cmd | 12 ++++++------ src/tests/build.sh | 6 +++--- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/tests/Common/dirs.proj b/src/tests/Common/dirs.proj index 1b9b915b307f79..68d0ff14095d8a 100644 --- a/src/tests/Common/dirs.proj +++ b/src/tests/Common/dirs.proj @@ -19,23 +19,29 @@ - - + + + + + + + + - - - - + + + + - - - - + + + + - + diff --git a/src/tests/build.cmd b/src/tests/build.cmd index 166a6a7c08472a..5960b95c193de2 100644 --- a/src/tests/build.cmd +++ b/src/tests/build.cmd @@ -41,9 +41,9 @@ set processedArgs= set __UnprocessedBuildArgs= set __CommonMSBuildArgs= -set __BuildTestProject= -set __BuildTestDir= -set __BuildTestTree= +set __BuildTestProject=%%3B +set __BuildTestDir=%%3B +set __BuildTestTree=%%3B set __BuildTestAll= set __SkipRestorePackages= @@ -100,9 +100,9 @@ if /i "%1" == "skipnative" (set __SkipNative=1&set __CopyNativeProjec if /i "%1" == "skiptestwrappers" (set __SkipTestWrappers=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "skipgeneratelayout" (set __SkipGenerateLayout=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "test" (set __BuildTestProject=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "dir" (set __BuildTestDir=%2&shift&shift&goto Arg_Loop) -if /i "%1" == "tree" (set __BuildTestTree=%2&shift&shift&goto Arg_Loop) +if /i "%1" == "test" (set __BuildTestProject=!__BuildTestProject!%2%%3B&shift&shift&goto Arg_Loop) +if /i "%1" == "dir" (set __BuildTestDir=!__BuildTestDir!%2%%3B&shift&shift&goto Arg_Loop) +if /i "%1" == "tree" (set __BuildTestTree=!__BuildTestTree!%2%%3B&shift&shift&goto Arg_Loop) if /i "%1" == "all" (set __BuildTestAll=1&shift&goto Arg_Loop) if /i "%1" == "copynativeonly" (set __CopyNativeTestBinaries=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set __SkipGenerateLayout=1&set __SkipTestWrappers=1&set __SkipCrossgenFramework=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) diff --git a/src/tests/build.sh b/src/tests/build.sh index e37bbbff32c88f..460099a54b03eb 100755 --- a/src/tests/build.sh +++ b/src/tests/build.sh @@ -507,19 +507,19 @@ handle_arguments_local() { test*|-test*) local arg="$1" local parts=(${arg//:/ }) - __BuildTestProject=${parts[1]} + __BuildTestProject="$__BuildTestProject;${parts[1]}" ;; dir*|-dir*) local arg="$1" local parts=(${arg//:/ }) - __BuildTestDir=${parts[1]} + __BuildTestDir="$__BuildTestDir;${parts[1]}" ;; tree*|-tree*) local arg="$1" local parts=(${arg//:/ }) - __BuildTestTree=${parts[1]} + __BuildTestTree="$__BuildTestTree;${parts[1]}" ;; all|-all) From 59768be55a5df57cac044f49eeeb190fd40be533 Mon Sep 17 00:00:00 2001 From: Tomas Rylek Date: Tue, 10 Aug 2021 22:26:55 +0200 Subject: [PATCH 3/9] Fix Unix version of the script --- src/tests/build.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tests/build.sh b/src/tests/build.sh index 460099a54b03eb..ba2f34b41911d2 100755 --- a/src/tests/build.sh +++ b/src/tests/build.sh @@ -507,19 +507,19 @@ handle_arguments_local() { test*|-test*) local arg="$1" local parts=(${arg//:/ }) - __BuildTestProject="$__BuildTestProject;${parts[1]}" + __BuildTestProject="$__BuildTestProject${parts[1]}%3B" ;; dir*|-dir*) local arg="$1" local parts=(${arg//:/ }) - __BuildTestDir="$__BuildTestDir;${parts[1]}" + __BuildTestDir="$__BuildTestDir${parts[1]}%3B" ;; tree*|-tree*) local arg="$1" local parts=(${arg//:/ }) - __BuildTestTree="$__BuildTestTree;${parts[1]}" + __BuildTestTree="$__BuildTestTree${parts[1]}%3B" ;; all|-all) @@ -575,9 +575,9 @@ __DistroRid="" __DoCrossgen2=0 __CompositeBuildMode=0 __TestBuildMode= -__BuildTestProject="" -__BuildTestDir="" -__BuildTestTree="" +__BuildTestProject="%3B" +__BuildTestDir="%3B" +__BuildTestTree="%3B" __BuildTestAll=0 __DotNetCli="$__RepoRootDir/dotnet.sh" __GenerateLayoutOnly= From 7f22d8601f6a77ff175412d50de186023f8b7200 Mon Sep 17 00:00:00 2001 From: Tomas Date: Tue, 10 Aug 2021 23:52:46 +0200 Subject: [PATCH 4/9] Fix copy & paste bug in help string per Anton's PR feedback --- src/tests/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/build.sh b/src/tests/build.sh index ba2f34b41911d2..48b4d9933f7684 100755 --- a/src/tests/build.sh +++ b/src/tests/build.sh @@ -442,7 +442,7 @@ usage_list+=("-generatelayoutonly: only pull down dependencies and build coreroo usage_list+=("-test:xxx - only build a single test project"); usage_list+=("-dir:xxx - build all tests in a given directory"); usage_list+=("-tree:xxx - build all tests in a given subtree"); -usage_list+=("-all:xxx - rebuild all the specified tests"); +usage_list+=("-all - rebuild all the specified tests"); usage_list+=("-crossgen2: Precompiles the framework managed assemblies in coreroot using the Crossgen2 compiler.") usage_list+=("-priority1: include priority=1 tests in the build.") From d8a69c61ff7d2de4b422a947daf6e6389c3bcb1c Mon Sep 17 00:00:00 2001 From: Tomas Date: Wed, 11 Aug 2021 02:14:20 +0200 Subject: [PATCH 5/9] Remove the 'all' option and implement 'rebuild' in cmd per Anton's PR feedback It also turns out that the rebuild cleanup was in the wrong place in the build.sh script - it was done as part of generate_layout i.e. after the native and managed test components have been built i.o.w. using it ended up building the tests and deleting them afterwards. Thanks Tomas --- src/tests/build.cmd | 20 +++++++++++--------- src/tests/build.sh | 25 +++++++------------------ 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/tests/build.cmd b/src/tests/build.cmd index 5960b95c193de2..96d209aa3f585a 100644 --- a/src/tests/build.cmd +++ b/src/tests/build.cmd @@ -41,10 +41,10 @@ set processedArgs= set __UnprocessedBuildArgs= set __CommonMSBuildArgs= +set __RebuildTests=0 set __BuildTestProject=%%3B set __BuildTestDir=%%3B set __BuildTestTree=%%3B -set __BuildTestAll= set __SkipRestorePackages= set __SkipManaged= @@ -100,10 +100,11 @@ if /i "%1" == "skipnative" (set __SkipNative=1&set __CopyNativeProjec if /i "%1" == "skiptestwrappers" (set __SkipTestWrappers=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "skipgeneratelayout" (set __SkipGenerateLayout=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "test" (set __BuildTestProject=!__BuildTestProject!%2%%3B&shift&shift&goto Arg_Loop) -if /i "%1" == "dir" (set __BuildTestDir=!__BuildTestDir!%2%%3B&shift&shift&goto Arg_Loop) -if /i "%1" == "tree" (set __BuildTestTree=!__BuildTestTree!%2%%3B&shift&shift&goto Arg_Loop) -if /i "%1" == "all" (set __BuildTestAll=1&shift&goto Arg_Loop) +if /i "%1" == "rebuild" (set __RebuildTests=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) + +if /i "%1" == "test" (set __BuildTestProject=!__BuildTestProject!%2%%3B&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) +if /i "%1" == "dir" (set __BuildTestDir=!__BuildTestDir!%2%%3B&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) +if /i "%1" == "tree" (set __BuildTestTree=!__BuildTestTree!%2%%3B&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) if /i "%1" == "copynativeonly" (set __CopyNativeTestBinaries=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set __SkipGenerateLayout=1&set __SkipTestWrappers=1&set __SkipCrossgenFramework=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "generatelayoutonly" (set __SkipManaged=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) @@ -166,6 +167,11 @@ set "__TestRootDir=%__RootBinDir%\tests\coreclr" set "__TestBinDir=%__TestRootDir%\%__OSPlatformConfig%" set "__TestIntermediatesDir=%__TestRootDir%\obj\%__OSPlatformConfig%" +if "%__RebuildTests%" == "1" ( + echo Removing tests build dir^: !__TestBinDir! + rmdir /s /q !__TestBinDir! +) + if not defined XunitTestBinBase set XunitTestBinBase=%__TestBinDir%\ set "CORE_ROOT=%XunitTestBinBase%\Tests\Core_Root" @@ -375,10 +381,6 @@ for /l %%G in (1, 1, %__NumberOfTestGroups%) do ( set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:BuildTestDir=!__BuildTestDir! set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:BuildTestTree=!__BuildTestTree! - if "!__BuildTestAll!" == "1" ( - set __MSBuildBuildArgs=!__MSBuildBuildArgs! /t:rebuild - ) - echo Running: msbuild !__MSBuildBuildArgs! !__CommonMSBuildCmdPrefix! !__MSBuildBuildArgs! diff --git a/src/tests/build.sh b/src/tests/build.sh index 48b4d9933f7684..8fc6b5fb7c5543 100755 --- a/src/tests/build.sh +++ b/src/tests/build.sh @@ -64,14 +64,6 @@ generate_layout() __ProjectFilesDir="$__TestDir" __TestBinDir="$__TestWorkingDir" - - if [[ "$__RebuildTests" -ne 0 ]]; then - if [[ -d "${__TestBinDir}" ]]; then - echo "Removing tests build dir: ${__TestBinDir}" - rm -rf "$__TestBinDir" - fi - fi - __CMakeBinDir="${__TestBinDir}" if [[ -z "$__TestIntermediateDir" ]]; then @@ -374,10 +366,6 @@ build_MSBuild_projects() buildArgs+=("/p:BuildTestDir=${__BuildTestDir}"); buildArgs+=("/p:BuildTestTree=${__BuildTestTree}"); - if [[ "$__BuildTestAll" -ne 0 ]]; then - buildArgs+=("/t:rebuild"); - fi - # Disable warnAsError - coreclr issue 19922 nextCommand="\"$__RepoRootDir/eng/common/msbuild.sh\" $__ArcadeScriptArgs --warnAsError false ${buildArgs[@]}" echo "Building step '$stepName' testGroupToBuild=$testGroupToBuild via $nextCommand" @@ -442,7 +430,6 @@ usage_list+=("-generatelayoutonly: only pull down dependencies and build coreroo usage_list+=("-test:xxx - only build a single test project"); usage_list+=("-dir:xxx - build all tests in a given directory"); usage_list+=("-tree:xxx - build all tests in a given subtree"); -usage_list+=("-all - rebuild all the specified tests"); usage_list+=("-crossgen2: Precompiles the framework managed assemblies in coreroot using the Crossgen2 compiler.") usage_list+=("-priority1: include priority=1 tests in the build.") @@ -522,10 +509,6 @@ handle_arguments_local() { __BuildTestTree="$__BuildTestTree${parts[1]}%3B" ;; - all|-all) - __BuildTestAll=1 - ;; - runtests|-runtests) __RunTests=1 ;; @@ -578,7 +561,6 @@ __TestBuildMode= __BuildTestProject="%3B" __BuildTestDir="%3B" __BuildTestTree="%3B" -__BuildTestAll=0 __DotNetCli="$__RepoRootDir/dotnet.sh" __GenerateLayoutOnly= __IsMSBuildOnNETCoreSupported=0 @@ -649,6 +631,13 @@ if [[ -z "$HOME" ]]; then echo "HOME not defined; setting it to $HOME" fi +if [[ "$__RebuildTests" -ne 0 ]]; then + if [[ -d "${__TestWorkingDir}" ]]; then + echo "Removing tests build dir: ${__TestWorkingDir}" + rm -rf "__TestWorkingDir" + fi +fi + if [[ (-z "$__GenerateLayoutOnly") && (-z "$__BuildTestWrappersOnly") && ("$__MonoAot" -eq 0) ]]; then build_Tests elif [[ ! -z "$__BuildTestWrappersOnly" ]]; then From df04d2c980a4e3c375c79f599ce517ae7d7e5446 Mon Sep 17 00:00:00 2001 From: Tomas Date: Wed, 11 Aug 2021 02:22:27 +0200 Subject: [PATCH 6/9] Replace the 'all' option with 'rebuild' in build.cmd help text --- src/tests/build.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/build.cmd b/src/tests/build.cmd index 96d209aa3f585a..7b4b10989df1a4 100644 --- a/src/tests/build.cmd +++ b/src/tests/build.cmd @@ -581,7 +581,7 @@ echo 666: Build all tests with priority 0, 1 ... 666 echo test ^: Only build test project ^ ^(relative or absolute project path under src\tests^) echo dir ^: Build all test projects in the folder ^ ^(relative or absolute folder under src\tests^) echo tree ^: Build all test projects in the subtree ^ ^(relative or absolute folder under src\tests^) -echo all: Clean-rebuild all selected tests ^(don't use incremental build^) +echo rebuild: Clean up all test artifacts prior to building tests echo allTargets: Build managed tests for all target platforms. echo -verbose: enables detailed file logging for the msbuild tasks into the msbuild log file. exit /b 1 From 11c0ccabc3cfe1392c596be7b6f9d07318f3d0ad Mon Sep 17 00:00:00 2001 From: Tomas Date: Wed, 11 Aug 2021 02:24:05 +0200 Subject: [PATCH 7/9] Fix overlooked $ sign in build.sh --- src/tests/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/build.sh b/src/tests/build.sh index 8fc6b5fb7c5543..00dee1ba2c2e7c 100755 --- a/src/tests/build.sh +++ b/src/tests/build.sh @@ -634,7 +634,7 @@ fi if [[ "$__RebuildTests" -ne 0 ]]; then if [[ -d "${__TestWorkingDir}" ]]; then echo "Removing tests build dir: ${__TestWorkingDir}" - rm -rf "__TestWorkingDir" + rm -rf "${__TestWorkingDir}" fi fi From 9b73df3d3d24653d6880095c715a8c794e395951 Mon Sep 17 00:00:00 2001 From: Tomas Date: Thu, 12 Aug 2021 01:05:18 +0200 Subject: [PATCH 8/9] Describe the new options in test workflow docs per Fan's PR feedback --- .../testing/coreclr/unix-test-instructions.md | 29 ++++++++++++++++++ .../coreclr/windows-test-instructions.md | 30 +++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/docs/workflow/testing/coreclr/unix-test-instructions.md b/docs/workflow/testing/coreclr/unix-test-instructions.md index 18842af2100bc3..70e0ae2c12ee9e 100644 --- a/docs/workflow/testing/coreclr/unix-test-instructions.md +++ b/docs/workflow/testing/coreclr/unix-test-instructions.md @@ -40,6 +40,35 @@ The `src/tests/build.sh` script generates the Core_Root folder, which contains t The output will be at `/artifacts/tests/coreclr/../Tests/Core_Root`. +## Building Test Subsets + +The `src/tests/build.sh` script supports three options that let you limit the set of tests to build; +when none of these is specified, the entire test tree (under `src/tests`) gets built but that can be +lengthy (especially in `-priority1` mode) and unnecessary when working on a particular test. + +1) `-test:` - build a particular test project specified by its project file path, +either absolute or relative to `src/tests`. The option can be specified multiple times on the command +line to request building several individual projects. + +**Example**: `src/tests/build.sh -test:JIT/Methodical/divrem/div/i4div_cs_do.csproj` + +2) `-dir:` - build all test projects within a given directory path, either absolute +or relative to `src/tests`. The option can be specified multiple times on the command line to request +building projects in several folders. + +**Example**: `src/tests/build.sh -dir:JIT/Methodical/Arrays/huge` + +3) `-tree:` - build all test projects within the subtree specified by its root path, +either absolute or relative to `src/tests`. The option can be specified multiple times on the command +line to request building projects in several subtrees. + +**Example**: `src/tests/build.sh -tree:baseservices/exceptions` + +**Please note** that priority filtering is orthogonal to specifying test subsets; even when you request +building a particular test and the test is Pri1, you need to specify `-priority1` in the command line, +otherwise the test build will get skipped. While somewhat unintuitive, 'fixing' this ad hoc would likely +create more harm than good and we're hoping to ultimately get rid of the test priorities in the long term +anyway. ## Building Individual Tests diff --git a/docs/workflow/testing/coreclr/windows-test-instructions.md b/docs/workflow/testing/coreclr/windows-test-instructions.md index dccf41f9b86bc7..808e94f71e96fe 100644 --- a/docs/workflow/testing/coreclr/windows-test-instructions.md +++ b/docs/workflow/testing/coreclr/windows-test-instructions.md @@ -77,6 +77,36 @@ For additional supported parameters use the following: src\tests\build.cmd -? ``` +## Building Test Subsets + +The `src\tests\build.cmd` script supports three options that let you limit the set of tests to build; +when none of these is specified, the entire test tree (under `src\tests`) gets built but that can be +lengthy (especially in `-priority=1` mode) and unnecessary when working on a particular test. + +1) `test ` - build a particular test project specified by its project file path, +either absolute or relative to `src\tests`. The option can be specified multiple times on the command +line to request building several individual projects. + +**Example**: `src\tests\build.cmd test JIT/Methodical/divrem/div/i4div_cs_do.csproj` + +2) `dir ` - build all test projects within a given directory path, either absolute +or relative to `src\tests`. The option can be specified multiple times on the command line to request +building projects in several folders. + +**Example**: `src\tests\build.cmd dir JIT/Methodical/Arrays/huge` + +3) `tree ` - build all test projects within the subtree specified by its root path, +either absolute or relative to `src\tests`. The option can be specified multiple times on the command +line to request building projects in several subtrees. + +**Example**: `src\tests\build.cmd tree baseservices/exceptions` + +**Please note** that priority filtering is orthogonal to specifying test subsets; even when you request +building a particular test and the test is Pri1, you need to specify `-priority=1` in the command line, +otherwise the test build will get skipped. While somewhat unintuitive, 'fixing' this ad hoc would likely +create more harm than good and we're hoping to ultimately get rid of the test priorities in the long term +anyway. + ## Building Individual Tests **Note:** `build.cmd skipmanaged [Any additional flags]` needs to be run at least once if the individual test has native assets. From 99e0cf907c0b0543e9b4c98813c9c0a0a87b9da4 Mon Sep 17 00:00:00 2001 From: Tomas Date: Thu, 12 Aug 2021 02:53:59 +0200 Subject: [PATCH 9/9] Further expand documentation per Fan's PR feedback --- .../testing/coreclr/unix-test-instructions.md | 15 +++++++++------ .../testing/coreclr/windows-test-instructions.md | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/docs/workflow/testing/coreclr/unix-test-instructions.md b/docs/workflow/testing/coreclr/unix-test-instructions.md index 70e0ae2c12ee9e..981ce5a87fe986 100644 --- a/docs/workflow/testing/coreclr/unix-test-instructions.md +++ b/docs/workflow/testing/coreclr/unix-test-instructions.md @@ -48,21 +48,24 @@ lengthy (especially in `-priority1` mode) and unnecessary when working on a part 1) `-test:` - build a particular test project specified by its project file path, either absolute or relative to `src/tests`. The option can be specified multiple times on the command -line to request building several individual projects. +line to request building several individual projects; alternatively, a single occurrence of the option +can represent several project paths separated by semicolons. -**Example**: `src/tests/build.sh -test:JIT/Methodical/divrem/div/i4div_cs_do.csproj` +**Example**: `src/tests/build.sh -test:JIT/Methodical/divrem/div/i4div_cs_do.csproj;JIT/Methodical/divrem/div/i8div_cs_do.csproj` 2) `-dir:` - build all test projects within a given directory path, either absolute or relative to `src/tests`. The option can be specified multiple times on the command line to request -building projects in several folders. +building projects in several folders; alternatively, a single occurrence of this option can represent +several project folders separated by semicolons. -**Example**: `src/tests/build.sh -dir:JIT/Methodical/Arrays/huge` +**Example**: `src/tests/build.sh -dir:JIT/Methodical/Arrays/huge;JIT/Methodical/divrem/div` 3) `-tree:` - build all test projects within the subtree specified by its root path, either absolute or relative to `src/tests`. The option can be specified multiple times on the command -line to request building projects in several subtrees. +line to request building projects in several subtrees; alternatively, a single instance of the option +can represent several project subtree root folder paths separated by semicolons. -**Example**: `src/tests/build.sh -tree:baseservices/exceptions` +**Example**: `src/tests/build.sh -tree:baseservices/exceptions;JIT/Methodical` **Please note** that priority filtering is orthogonal to specifying test subsets; even when you request building a particular test and the test is Pri1, you need to specify `-priority1` in the command line, diff --git a/docs/workflow/testing/coreclr/windows-test-instructions.md b/docs/workflow/testing/coreclr/windows-test-instructions.md index 808e94f71e96fe..18e22aefa58939 100644 --- a/docs/workflow/testing/coreclr/windows-test-instructions.md +++ b/docs/workflow/testing/coreclr/windows-test-instructions.md @@ -85,21 +85,24 @@ lengthy (especially in `-priority=1` mode) and unnecessary when working on a par 1) `test ` - build a particular test project specified by its project file path, either absolute or relative to `src\tests`. The option can be specified multiple times on the command -line to request building several individual projects. +line to request building several individual projects; alternatively, a single occurrence of the option +can represent several project paths separated by semicolons. -**Example**: `src\tests\build.cmd test JIT/Methodical/divrem/div/i4div_cs_do.csproj` +**Example**: `src\tests\build.cmd test JIT/Methodical/divrem/div/i4div_cs_do.csproj;JIT/Methodical/divrem/div/i8div_cs_do.csproj` 2) `dir ` - build all test projects within a given directory path, either absolute or relative to `src\tests`. The option can be specified multiple times on the command line to request -building projects in several folders. +building projects in several folders; alternatively, a single instance of the option +can represent several project folders separated by semicolons. -**Example**: `src\tests\build.cmd dir JIT/Methodical/Arrays/huge` +**Example**: `src\tests\build.cmd dir JIT/Methodical/Arrays/huge;JIT/Methodical/divrem/div` 3) `tree ` - build all test projects within the subtree specified by its root path, either absolute or relative to `src\tests`. The option can be specified multiple times on the command -line to request building projects in several subtrees. +line to request building projects in several subtrees; alternatively, a single instance of the option +can represent several project subtree root folder paths separated by semicolons. -**Example**: `src\tests\build.cmd tree baseservices/exceptions` +**Example**: `src\tests\build.cmd tree baseservices/exceptions;JIT/Methodical` **Please note** that priority filtering is orthogonal to specifying test subsets; even when you request building a particular test and the test is Pri1, you need to specify `-priority=1` in the command line,