-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert all tests under baseservices to the merged test infrastructure (
#91560) * Remove unused args parameter from the Main method in 349379.cs * Convert stackoverflowtester Main to individual test entrypoints * Don't complain about Exe type for test components Some tests have exe components - if these aren't marked with the CLRTestKind BuildAndRun, we shouldn't complain about them. Thanks Tomas * Make dynamicmethodliveness and ParallelCrash merge-friendly * Adjust the Tier1StackTrace test to be tolerant to merged wrappers * Convert baseservices/exceptions to merged mode * Remove constant return value 100 from the test test448035 * Make UnsafeAccessorTests owner class public * Make methods in RuntimeConfiguration/TestConfig public * Make TieredCompilation/BasicTest public * Remove unused exit code of runmoduleconstructor * Remove unused exit code of RuntimeHelperTests * Fix visibility in multidimarray/enum test * Fix visibility in TestCallingConventions test * Fix visibility in CriticalFinalizer test * Simplify RuntimeConfiguration/TestConfig * Clean up TieredCompilation tests * Convert istypeequivalent to use ConditionalFact clauses * Fix visibility in RuntimeHelpersTests * Add CoreCLRTestLibrary as a dependency of istypeequivalent * Fix merged behavior of test448035 * Fix entrypoint in 305155 * Modify TestConfig to use a separate TestConfigTester app * Additional fixes to TestConfig / TestConfigTester * Mechanically merge all remaining tests under baseservices * Fix BasicTestWithMcj, address initial Mark's PR feedback * Remove superfluous OutputType=Library annotations per Marks' PR feedback * Fix the baseservices/exceptions/unhandled test * Fix stackoverflow3 and unhandled exception tests * Remove unnecessary check from Directory.Build.targets * Fix stackoverflowtester per Mark's PR feedback
- Loading branch information
Showing
373 changed files
with
1,343 additions
and
856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Merged.props', $(MSBuildThisFileDirectory)..))" /> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', $(MSBuildThisFileDirectory)..))" /> | ||
|
||
<PropertyGroup> | ||
<RunAnalyzers>true</RunAnalyzers> | ||
<NoWarn>$(NoWarn);xUnit1013</NoWarn> | ||
<EnableNETAnalyzers>false</EnableNETAnalyzers> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 4 additions & 8 deletions
12
src/tests/baseservices/RuntimeConfiguration/TestConfig.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<!-- This test provides no interesting scenarios for GCStress --> | ||
<GCStressIncompatible>true</GCStressIncompatible> | ||
<UnloadabilityIncompatible>true</UnloadabilityIncompatible> | ||
<DisableProjectBuild Condition="'$(RuntimeFlavor)' == 'Mono'">true</DisableProjectBuild> | ||
<!-- This is a separate app launched by the actual test in TestConfigTester.csproj --> | ||
<RequiresProcessIsolation>true</RequiresProcessIsolation> | ||
<ReferenceXUnitWrapperGenerator>false</ReferenceXUnitWrapperGenerator> | ||
<CLRTestKind>BuildOnly</CLRTestKind> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="TestConfig.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> | ||
</ItemGroup> | ||
</Project> |
83 changes: 83 additions & 0 deletions
83
src/tests/baseservices/RuntimeConfiguration/TestConfigTester.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime; | ||
using System.Text; | ||
|
||
using Xunit; | ||
|
||
public class TestConfigTester | ||
{ | ||
[Fact] | ||
public static void RunTests() | ||
{ | ||
// clear some environment variables that we will set during the test run | ||
Environment.SetEnvironmentVariable("DOTNET_gcServer", null); | ||
|
||
string testConfigApp = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestConfig.dll"); | ||
|
||
MethodInfo[] infos = typeof(TestConfig).GetMethods(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); | ||
|
||
string corerunPath = GetCorerunPath(); | ||
foreach (var mi in infos) | ||
{ | ||
var configProperties = mi.GetCustomAttributes(typeof(TestConfig.ConfigPropertyAttribute)); | ||
var envVariables = mi.GetCustomAttributes(typeof(TestConfig.EnvVarAttribute)); | ||
|
||
if (configProperties.Count() == 0 && envVariables.Count() == 0) | ||
{ | ||
continue; | ||
} | ||
|
||
using Process process = new(); | ||
|
||
StringBuilder arguments = new(); | ||
|
||
foreach (Attribute cp in configProperties) | ||
{ | ||
TestConfig.ConfigPropertyAttribute configProp = (TestConfig.ConfigPropertyAttribute)cp; | ||
arguments.Append($"-p {configProp.Name}={configProp.Value} "); | ||
} | ||
|
||
arguments.Append($"\"{testConfigApp}\" {mi.Name}"); | ||
|
||
process.StartInfo.FileName = corerunPath; | ||
process.StartInfo.Arguments = arguments.ToString(); | ||
|
||
foreach (string key in Environment.GetEnvironmentVariables().Keys) | ||
{ | ||
process.StartInfo.EnvironmentVariables[key] = Environment.GetEnvironmentVariable(key); | ||
} | ||
|
||
Console.WriteLine($"Running: {process.StartInfo.Arguments}"); | ||
foreach (Attribute ev in envVariables) | ||
{ | ||
TestConfig.EnvVarAttribute envVar = (TestConfig.EnvVarAttribute)ev; | ||
process.StartInfo.EnvironmentVariables[envVar.Name] = envVar.Value; | ||
Console.WriteLine($" set {envVar.Name}={envVar.Value}"); | ||
} | ||
|
||
process.Start(); | ||
process.WaitForExit(); | ||
if (process.ExitCode != TestConfig.Success) | ||
{ | ||
throw new Exception($"Failed: {mi.Name}: exit code = {process.ExitCode}"); | ||
} | ||
} | ||
} | ||
|
||
static string GetCorerunPath() | ||
{ | ||
string corerunName = "corerun"; | ||
if (TestLibrary.Utilities.IsWindows) | ||
{ | ||
corerunName += ".exe"; | ||
} | ||
return Path.Combine(Environment.GetEnvironmentVariable("CORE_ROOT"), corerunName); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/tests/baseservices/RuntimeConfiguration/TestConfigTester.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<!-- This test provides no interesting scenarios for GCStress --> | ||
<GCStressIncompatible>true</GCStressIncompatible> | ||
<UnloadabilityIncompatible>true</UnloadabilityIncompatible> | ||
<DisableProjectBuild Condition="'$(RuntimeFlavor)' == 'Mono'">true</DisableProjectBuild> | ||
<DefineConstants>$(DefineConstants);IS_TESTER_APP</DefineConstants> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
<Compile Include="TestConfig.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> | ||
<ProjectReference Include="$(MSBuildThisFileDirectory)TestConfig.csproj"> | ||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
<OutputItemType>Content</OutputItemType> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</ProjectReference> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/tests/baseservices/TieredCompilation/BasicTestWithMcj.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/tests/baseservices/TieredCompilation/BasicTest_DefaultMode.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/tests/baseservices/TieredCompilation/BasicTest_DefaultMode_R2r.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.