diff --git a/docs/workflow/testing/libraries/testing.md b/docs/workflow/testing/libraries/testing.md
index cb17c48b6cc7a..374b6eee8f159 100644
--- a/docs/workflow/testing/libraries/testing.md
+++ b/docs/workflow/testing/libraries/testing.md
@@ -101,4 +101,21 @@ dotnet build /t:Test /p:Outerloop=true
### Running tests on a different target framework
-Each test project can potentially have multiple target frameworks. There are some tests that might be OS-specific, or might be testing an API that is available only on some target frameworks, so the `TargetFrameworks` property specifies the valid target frameworks.
\ No newline at end of file
+Each test project can potentially have multiple target frameworks. There are some tests that might be OS-specific, or might be testing an API that is available only on some target frameworks, so the `TargetFrameworks` property specifies the valid target frameworks.
+
+### Running tests in custom compilation modes
+
+There are several custom compilation modes for tests. These are enabled by setting a switch during the config.
+
+| Mode | Description | Prerequisites
+| --- | --- | --- |
+| TestSingleFile | Test compilation using the single file compilation mode | libs+clr |
+| TestNativeAot | Test by compiling the test using NativeAOT | libs+clr.aot |
+| TestReadyToRun | Test compilation of the test/libraries into R2R binaries | libs+clr |
+
+To run a test in specific mode, simply build the tests after building the prerequisite subsets, and specify the test mode on a command line such as:
+```cmd
+dotnet build /t:Test /p:Configuration=Release /p:TestReadyToRun=true
+```
+
+These tests do not use the standard XUnit test runner, instead they use [SingleFileTestRunner.cs](../../../../src/libraries/Common/tests/SingleFileTestRunner/SingleFileTestRunner.cs). The set of available command line options is limited to `-xml`, `-notrait`, `-class`, `-class-`, `-noclass`, `-method`, `-method-`, `-nomethod`, `-namespace`, `-namespace-`, `-nonamespace`, and `-parallel`.
diff --git a/eng/testing/tests.props b/eng/testing/tests.props
index 7ed95b94326e3..fbff925bd613a 100644
--- a/eng/testing/tests.props
+++ b/eng/testing/tests.props
@@ -8,6 +8,7 @@
true
$(MSBuildThisFileDirectory)ILLinkDescriptors\
true
+ true
diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets
index d307e837e6235..86f7277aae032 100644
--- a/eng/testing/tests.singlefile.targets
+++ b/eng/testing/tests.singlefile.targets
@@ -2,8 +2,6 @@
Exe
- $(DefineConstants);SINGLE_FILE_TEST_RUNNER
-
$([MSBuild]::NormalizeDirectory('$(OutDir)', 'publish'))
$([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)'))
$(PackageRID)
@@ -18,6 +16,11 @@
true
+
+ true
+ false
+
+
$(CoreCLRILCompilerDir)
$(CoreCLRCrossILCompilerDir)
@@ -35,6 +38,10 @@
true
+
+ $(DefineConstants);SINGLE_FILE_TEST_RUNNER
+
+
@@ -83,6 +90,20 @@
+
+
+ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','crossgen2'))crossgen2$(ExeSuffix)
+
+
+
+
+
+
+
+
+
+
+
());
}
values.Add(traitKeyValue[1]);
+ i++;
}
if (args[i].Equals("-xml", StringComparison.OrdinalIgnoreCase))
{
xmlResultFileName=args[i + 1].Trim();
+ i++;
+ }
+ if (args[i].Equals("-class", StringComparison.OrdinalIgnoreCase))
+ {
+ filters.IncludedClasses.Add(args[i + 1].Trim());
+ i++;
+ }
+ if (args[i].Equals("-noclass", StringComparison.OrdinalIgnoreCase) || args[i].Equals("-class-", StringComparison.OrdinalIgnoreCase))
+ {
+ filters.ExcludedClasses.Add(args[i + 1].Trim());
+ i++;
+ }
+ if (args[i].Equals("-method", StringComparison.OrdinalIgnoreCase))
+ {
+ filters.IncludedMethods.Add(args[i + 1].Trim());
+ i++;
+ }
+ if (args[i].Equals("-nomethod", StringComparison.OrdinalIgnoreCase) || args[i].Equals("-method-", StringComparison.OrdinalIgnoreCase))
+ {
+ filters.ExcludedMethods.Add(args[i + 1].Trim());
+ i++;
+ }
+ if (args[i].Equals("-namespace", StringComparison.OrdinalIgnoreCase))
+ {
+ filters.IncludedNamespaces.Add(args[i + 1].Trim());
+ i++;
+ }
+ if (args[i].Equals("-nonamespace", StringComparison.OrdinalIgnoreCase) || args[i].Equals("-namespace-", StringComparison.OrdinalIgnoreCase))
+ {
+ filters.ExcludedNamespaces.Add(args[i + 1].Trim());
+ i++;
+ }
+ if (args[i].Equals("-parallel", StringComparison.OrdinalIgnoreCase))
+ {
+ string parallelismArg = args[i + 1].ToLower();
+ var (parallelizeAssemblies, parallelizeTestCollections) = parallelismArg switch
+ {
+ "all" => (true, true),
+ "assemblies" => (true, false),
+ "collections" => (false, true),
+ "none" => (false, false),
+ _ => throw new ArgumentException("unknown parallelism option")
+ };
+
+ assemblyConfig.ParallelizeAssembly = parallelizeAssemblies;
+ assemblyConfig.ParallelizeTestCollections = parallelizeTestCollections;
+ i++;
}
}
diff --git a/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj b/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj
index ba53223e2e8cb..b3283c3101ea3 100644
--- a/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj
+++ b/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj
@@ -50,5 +50,7 @@
PreserveNewest
+
+
diff --git a/src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj b/src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj
index e23bb4a94a71c..d2ff9a91c113a 100644
--- a/src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj
+++ b/src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj
@@ -68,5 +68,7 @@
Content
PreserveNewest
+
+