diff --git a/eng/Subsets.props b/eng/Subsets.props
index 77268ffa7b5d09..41c207ea3477f0 100644
--- a/eng/Subsets.props
+++ b/eng/Subsets.props
@@ -352,7 +352,7 @@
Test="true" Category="clr" Condition="'$(DotNetBuildFromSource)' != 'true'"/>
-
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/Extensions/CecilExtensions.cs b/src/coreclr/tools/aot/ILCompiler.Tests/Extensions/CecilExtensions.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/Extensions/CecilExtensions.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/Extensions/CecilExtensions.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/Extensions/NiceIO.cs b/src/coreclr/tools/aot/ILCompiler.Tests/Extensions/NiceIO.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/Extensions/NiceIO.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/Extensions/NiceIO.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/Mono.Linker.Tests.csproj b/src/coreclr/tools/aot/ILCompiler.Tests/ILCompiler.Tests.csproj
similarity index 79%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/Mono.Linker.Tests.csproj
rename to src/coreclr/tools/aot/ILCompiler.Tests/ILCompiler.Tests.csproj
index f8e77764b9c254..7b7d300b700716 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/Mono.Linker.Tests.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/ILCompiler.Tests.csproj
@@ -19,10 +19,10 @@
-
+
-
-
+
+
@@ -45,8 +45,10 @@
$(ArtifactsBinDir)
- $(RepoRoot)/src/tools/illink/test/
+ $(ToolsProjectRoot)illink/test/
+
+
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestCase.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCases/TestCase.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestCase.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCases/TestCase.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestDatabase.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCases/TestDatabase.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestDatabase.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCases/TestDatabase.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestSuites.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCases/TestSuites.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCases/TestSuites.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCases/TestSuites.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/AssemblyChecker.cs
similarity index 99%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/AssemblyChecker.cs
index 7280796f5abc4e..bd97ca18500f7d 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/AssemblyChecker.cs
@@ -40,7 +40,7 @@ class LinkedMethodEntity : LinkedEntity
private readonly BaseAssemblyResolver originalsResolver;
private readonly ReaderParameters originalReaderParameters;
private readonly AssemblyDefinition originalAssembly;
- private readonly ILCompilerTestCaseResult testResult;
+ private readonly TrimmedTestCaseResult testResult;
private readonly Dictionary linkedMembers;
private readonly HashSet verifiedGeneratedFields = new HashSet ();
@@ -67,7 +67,7 @@ public AssemblyChecker (
BaseAssemblyResolver originalsResolver,
ReaderParameters originalReaderParameters,
AssemblyDefinition original,
- ILCompilerTestCaseResult testResult)
+ TrimmedTestCaseResult testResult)
{
this.originalsResolver = originalsResolver;
this.originalReaderParameters = originalReaderParameters;
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/AssemblyQualifiedToken.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/AssemblyQualifiedToken.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/AssemblyQualifiedToken.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/AssemblyQualifiedToken.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/BaseMetadataProvider.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/BaseMetadataProvider.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/BaseMetadataProvider.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/BaseMetadataProvider.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/CompilerOptions.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/CompilerOptions.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/CompilerOptions.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/CompilerOptions.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ExpectationsProvider.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ExpectationsProvider.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ExpectationsProvider.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ExpectationsProvider.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/FormattingUtils.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/FormattingUtils.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/FormattingUtils.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/FormattingUtils.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerOptions.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ILCompilerOptions.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerOptions.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ILCompilerOptions.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerTestPInvokePolicy.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ILCompilerTestPInvokePolicy.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerTestPInvokePolicy.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ILCompilerTestPInvokePolicy.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILInputCompiler.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ILInputCompiler.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILInputCompiler.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ILInputCompiler.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ManagedCompilationResult.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ManagedCompilationResult.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ManagedCompilationResult.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ManagedCompilationResult.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/MemberAssertionsCollector.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/MemberAssertionsCollector.cs
similarity index 97%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/MemberAssertionsCollector.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/MemberAssertionsCollector.cs
index 4e59125d7a50bb..6b7958c92c4d89 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/MemberAssertionsCollector.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/MemberAssertionsCollector.cs
@@ -37,7 +37,7 @@ public MemberAssertionsCollector(Type type)
private CompilerTypeSystemContext CreateTypeSystemContext ()
{
- ILCompilerDriver.ComputeDefaultOptions (out var targetOS, out var targetArchitecture);
+ TrimmingDriver.ComputeDefaultOptions (out var targetOS, out var targetArchitecture);
var targetDetails = new TargetDetails (targetArchitecture, targetOS, TargetAbi.NativeAot);
CompilerTypeSystemContext typeSystemContext =
new CompilerTypeSystemContext (targetDetails, SharedGenericsMode.CanonicalReferenceTypes, DelegateFeature.All);
@@ -49,7 +49,7 @@ private CompilerTypeSystemContext CreateTypeSystemContext ()
references.Add (assembly.GetName ().Name!, assembly.Location!);
}
typeSystemContext.ReferenceFilePaths = references;
- typeSystemContext.SetSystemModule (typeSystemContext.GetModuleForSimpleName (ILCompilerDriver.DefaultSystemModule));
+ typeSystemContext.SetSystemModule (typeSystemContext.GetModuleForSimpleName (TrimmingDriver.DefaultSystemModule));
return typeSystemContext;
}
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/NameUtils.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/NameUtils.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/NameUtils.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/NameUtils.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ObjectFactory.cs
similarity index 81%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ObjectFactory.cs
index f99a06ad15062d..ba479510264601 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ObjectFactory.cs
@@ -18,9 +18,9 @@ public virtual TestCaseCompiler CreateCompiler (TestCaseSandbox sandbox, TestCas
return new TestCaseCompiler (sandbox, metadataProvider);
}
- public virtual ILCompilerDriver CreateTrimmer ()
+ public virtual TrimmingDriver CreateTrimmer ()
{
- return new ILCompilerDriver ();
+ return new TrimmingDriver ();
}
public virtual TestCaseMetadataProvider CreateMetadataProvider (TestCase testCase, AssemblyDefinition expectationsAssemblyDefinition)
@@ -33,9 +33,9 @@ public virtual TestCaseCompilationMetadataProvider CreateCompilationMetadataProv
return new TestCaseCompilationMetadataProvider (testCase, fullTestCaseAssemblyDefinition);
}
- public virtual ILCompilerOptionsBuilder CreateTrimmerOptionsBuilder (TestCaseMetadataProvider metadataProvider)
+ public virtual TrimmingArgumentBuilder CreateTrimmingArgumentBuilder (TestCaseMetadataProvider metadataProvider)
{
- return new ILCompilerOptionsBuilder (metadataProvider);
+ return new TrimmingArgumentBuilder (metadataProvider);
}
}
}
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/PathUtilities.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/PathUtilities.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ResultChecker.cs
similarity index 97%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ResultChecker.cs
index a39ebe53305a44..69b446834efe86 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/ResultChecker.cs
@@ -45,7 +45,7 @@ public ResultChecker (BaseAssemblyResolver originalsResolver,
_linkedReaderParameters = linkedReaderParameters;
}
- public virtual void Check (ILCompilerTestCaseResult testResult)
+ public virtual void Check (TrimmedTestCaseResult testResult)
{
InitializeResolvers (testResult);
@@ -85,12 +85,12 @@ bool HasActiveSkipKeptItemsValidationAttribute(ICustomAttributeProvider provider
}
}
- protected virtual AssemblyChecker CreateAssemblyChecker (AssemblyDefinition original, ILCompilerTestCaseResult testResult)
+ protected virtual AssemblyChecker CreateAssemblyChecker (AssemblyDefinition original, TrimmedTestCaseResult testResult)
{
return new AssemblyChecker (_originalsResolver, _originalReaderParameters, original, testResult);
}
- private void InitializeResolvers (ILCompilerTestCaseResult linkedResult)
+ private void InitializeResolvers (TrimmedTestCaseResult linkedResult)
{
_originalsResolver.AddSearchDirectory (linkedResult.ExpectationsAssemblyPath.Parent.ToString ());
}
@@ -103,7 +103,7 @@ protected AssemblyDefinition ResolveOriginalsAssembly (string assemblyName)
return _originalsResolver.Resolve (new AssemblyNameReference (cleanAssemblyName, null), _originalReaderParameters);
}
- private static void PerformOutputAssemblyChecks (AssemblyDefinition original, ILCompilerTestCaseResult testResult)
+ private static void PerformOutputAssemblyChecks (AssemblyDefinition original, TrimmedTestCaseResult testResult)
{
var assembliesToCheck = original.MainModule.Types.SelectMany (t => t.CustomAttributes).Where (ExpectationsProvider.IsAssemblyAssertion);
var actionAssemblies = new HashSet ();
@@ -147,13 +147,13 @@ private static void PerformOutputAssemblyChecks (AssemblyDefinition original, IL
}
#pragma warning disable IDE0060 // Remove unused parameter
- private static void PerformOutputSymbolChecks (AssemblyDefinition original, ILCompilerTestCaseResult testResult)
+ private static void PerformOutputSymbolChecks (AssemblyDefinition original, TrimmedTestCaseResult testResult)
#pragma warning restore IDE0060 // Remove unused parameter
{
// While NativeAOT has symbols, verifying them is rather difficult
}
- protected virtual void AdditionalChecking (ILCompilerTestCaseResult linkResult, AssemblyDefinition original)
+ protected virtual void AdditionalChecking (TrimmedTestCaseResult linkResult, AssemblyDefinition original)
{
bool checkRemainingErrors = !HasAttribute (linkResult.TestCase.FindTypeDefinition (original), nameof (SkipRemainingErrorsValidationAttribute));
VerifyLoggedMessages (original, linkResult.LogWriter, checkRemainingErrors);
@@ -180,12 +180,12 @@ private static IEnumerable GetAttributeProviders (Asse
yield return assembly;
}
- protected virtual void InitialChecking (ILCompilerTestCaseResult testResult, AssemblyDefinition original)
+ protected virtual void InitialChecking (TrimmedTestCaseResult testResult, AssemblyDefinition original)
{
// PE verifier is done here in ILLinker, but that's not possible with NativeAOT
}
- private void VerifyLoggedMessages (AssemblyDefinition original, TestLogWriter logger, bool checkRemainingErrors)
+ private void VerifyLoggedMessages (AssemblyDefinition original, TrimmingTestLogger logger, bool checkRemainingErrors)
{
List loggedMessages = logger.GetLoggedMessages ();
List<(ICustomAttributeProvider, CustomAttribute)> expectedNoWarningsAttributes = new ();
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/SetupCompileInfo.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/SetupCompileInfo.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/SetupCompileInfo.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/SetupCompileInfo.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/SourceAndDestinationPair.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/SourceAndDestinationPair.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/SourceAndDestinationPair.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/SourceAndDestinationPair.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseAssemblyResolver.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseAssemblyResolver.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseAssemblyResolver.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseAssemblyResolver.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseCollector.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseCollector.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseCollector.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseCollector.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseCompilationMetadataProvider.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseCompilationMetadataProvider.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseCompilationMetadataProvider.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseCompilationMetadataProvider.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseCompiler.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseCompiler.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseLinkerOptions.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseLinkerOptions.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseMetadataProvider.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseMetadataProvider.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseSandbox.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestCaseSandbox.cs
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestInfraMultiFileCompilationModuleGroup.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestInfraMultiFileCompilationModuleGroup.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestInfraMultiFileCompilationModuleGroup.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestInfraMultiFileCompilationModuleGroup.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestRunner.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestRunner.cs
new file mode 100644
index 00000000000000..b5ae238303fd7b
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TestRunner.cs
@@ -0,0 +1,55 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Mono.Cecil;
+using Mono.Linker.Tests.Extensions;
+using Mono.Linker.Tests.TestCases;
+using Xunit.Sdk;
+
+namespace Mono.Linker.Tests.TestCasesRunner
+{
+ public partial class TestRunner
+ {
+ partial void IgnoreTest (string reason)
+ {
+ throw new IgnoreTestException (reason);
+ }
+
+ static IEnumerable additionalDefines = new string[] { "NATIVEAOT" };
+ private partial IEnumerable? GetAdditionalDefines () => additionalDefines;
+
+ private static T GetResultOfTaskThatMakesAssertions (Task task)
+ {
+ try {
+ return task.Result;
+ } catch (AggregateException e) {
+ if (e.InnerException != null) {
+ if (e.InnerException is XunitException)
+ throw e.InnerException;
+ }
+
+ throw;
+ }
+ }
+
+ protected partial TrimmingCustomizations? CustomizeLinker (TrimmingDriver linker, TestCaseMetadataProvider metadataProvider)
+ => null;
+
+ static partial void AddOutputDirectory (TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TrimmingArgumentBuilder builder)
+ {
+ builder.AddOutputDirectory (sandbox.OutputDirectory.Combine (compilationResult.InputAssemblyPath.FileNameWithoutExtension + ".obj"));
+ }
+
+ static partial void AddInputReference (NPath inputReference, TrimmingArgumentBuilder builder)
+ {
+ // It's important to add all assemblies as "link" assemblies since the default configuration
+ // is to run the compiler in multi-file mode which will not process anything which is just in the reference set.
+ builder.AddLinkAssembly (inputReference);
+ builder.AddReference (inputReference);
+ }
+ }
+}
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerTestCaseResult.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmedTestCaseResult.cs
similarity index 57%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerTestCaseResult.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmedTestCaseResult.cs
index 5229431b282e6e..162323570f4595 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerTestCaseResult.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmedTestCaseResult.cs
@@ -7,7 +7,7 @@
namespace Mono.Linker.Tests.TestCasesRunner
{
- public class ILCompilerTestCaseResult
+ public class TrimmedTestCaseResult
{
public readonly TestCase TestCase;
public readonly NPath InputAssemblyPath;
@@ -15,19 +15,31 @@ public class ILCompilerTestCaseResult
public readonly TestCaseSandbox Sandbox;
public readonly TestCaseMetadataProvider MetadataProvider;
public readonly ManagedCompilationResult CompilationResult;
+ public readonly TrimmingTestLogger LogWriter;
public readonly ILScanResults TrimmingResults;
- public readonly TestLogWriter LogWriter;
- public ILCompilerTestCaseResult (TestCase testCase, NPath inputAssemblyPath, NPath expectationsAssemblyPath, TestCaseSandbox sandbox, TestCaseMetadataProvider metadataProvider, ManagedCompilationResult compilationResult, ILScanResults trimmingResults, TestLogWriter logWriter)
+ public TrimmedTestCaseResult (
+ TestCase testCase,
+ NPath inputAssemblyPath,
+ NPath outputAssemblyPath,
+ NPath expectationsAssemblyPath,
+ TestCaseSandbox sandbox,
+ TestCaseMetadataProvider metadataProvider,
+ ManagedCompilationResult compilationResult,
+ TrimmingTestLogger logWriter,
+ TrimmingCustomizations? customizations,
+ ILScanResults trimmingResults)
{
+ // Ignore outputAssemblyPath because ILCompiler trimming tests don't write output assemblies.
+ // Ignore TrimmingCustomizatoins which are not used by ILCompiler trimming tests.
TestCase = testCase;
InputAssemblyPath = inputAssemblyPath;
ExpectationsAssemblyPath = expectationsAssemblyPath;
Sandbox = sandbox;
MetadataProvider = metadataProvider;
- CompilationResult = compilationResult;
- TrimmingResults = trimmingResults;
+ CompilationResult = compilationResult;
LogWriter = logWriter;
+ TrimmingResults = trimmingResults;
}
}
}
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerOptionsBuilder.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmingArgumentBuilder.cs
similarity index 94%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerOptionsBuilder.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmingArgumentBuilder.cs
index 196fd5fec3a2a0..b32391dad4b178 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerOptionsBuilder.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmingArgumentBuilder.cs
@@ -8,16 +8,16 @@
namespace Mono.Linker.Tests.TestCasesRunner
{
- public class ILCompilerOptionsBuilder
+ public class TrimmingArgumentBuilder
{
- //public TrimmerOptions Options { get; } = new();
private readonly TestCaseMetadataProvider _metadataProvider;
- public readonly ILCompilerOptions Options;
+ private ILCompilerOptions? _options;
+ private ILCompilerOptions Options => _options ?? throw new InvalidOperationException ("Invalid state: Build() was already called");
- public ILCompilerOptionsBuilder (TestCaseMetadataProvider metadataProvider)
+ public TrimmingArgumentBuilder (TestCaseMetadataProvider metadataProvider)
{
- Options = new ILCompilerOptions ();
+ _options = new ILCompilerOptions ();
_metadataProvider = metadataProvider;
string runtimeBinDir = (string) AppContext.GetData ("Mono.Linker.Tests.RuntimeBinDirectory")!;
@@ -260,5 +260,12 @@ private static void AppendExpandedPaths (Dictionary dictionary,
throw new Exception ("No files matching " + pattern);
}
}
+
+ public ILCompilerOptions Build ()
+ {
+ var options = Options;
+ _options = null;
+ return options;
+ }
}
}
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerDriver.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmingDriver.cs
similarity index 98%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerDriver.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmingDriver.cs
index 275d035c66843e..3c04578d393c90 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerDriver.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmingDriver.cs
@@ -16,11 +16,11 @@
namespace Mono.Linker.Tests.TestCasesRunner
{
- public class ILCompilerDriver
+ public class TrimmingDriver
{
internal const string DefaultSystemModule = "System.Private.CoreLib";
- public ILScanResults Trim (ILCompilerOptions options, ILogWriter logWriter)
+ public ILScanResults Trim (ILCompilerOptions options, TrimmingCustomizations? customizations, ILogWriter logWriter)
{
ComputeDefaultOptions (out var targetOS, out var targetArchitecture);
var targetDetails = new TargetDetails (targetArchitecture, targetOS, TargetAbi.NativeAot);
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestLogWriter.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmingTestLogger.cs
similarity index 93%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestLogWriter.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmingTestLogger.cs
index 0ef6c8fb995a7f..9e1bec7a057093 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestLogWriter.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/TestCasesRunner/TrimmingTestLogger.cs
@@ -8,14 +8,14 @@
namespace Mono.Linker.Tests.TestCasesRunner
{
- public class TestLogWriter : ILogWriter
+ public class TrimmingTestLogger : ILogWriter
{
private readonly StringWriter _infoStringWriter;
private readonly TextWriter _infoWriter;
private readonly List _messageContainers;
- public TestLogWriter ()
+ public TrimmingTestLogger ()
{
_infoStringWriter = new StringWriter ();
_infoWriter = TextWriter.Synchronized (_infoStringWriter);
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/Tests/DocumentationSignatureParserTests.cs b/src/coreclr/tools/aot/ILCompiler.Tests/Tests/DocumentationSignatureParserTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/Tests/DocumentationSignatureParserTests.cs
rename to src/coreclr/tools/aot/ILCompiler.Tests/Tests/DocumentationSignatureParserTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.Tests/TrimmingCustomizations.cs b/src/coreclr/tools/aot/ILCompiler.Tests/TrimmingCustomizations.cs
new file mode 100644
index 00000000000000..f6ef0009a701f2
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler.Tests/TrimmingCustomizations.cs
@@ -0,0 +1,11 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+
+namespace Mono.Linker.Tests.TestCasesRunner
+{
+ public class TrimmingCustomizations
+ {
+ }
+}
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/IgnoreTestException.cs b/src/tools/illink/test/Mono.Linker.Tests.Shared/IgnoreTestException.cs
similarity index 100%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/IgnoreTestException.cs
rename to src/tools/illink/test/Mono.Linker.Tests.Shared/IgnoreTestException.cs
diff --git a/src/tools/illink/test/Mono.Linker.Tests.Shared/Mono.Linker.Tests.Shared.projitems b/src/tools/illink/test/Mono.Linker.Tests.Shared/Mono.Linker.Tests.Shared.projitems
new file mode 100644
index 00000000000000..8212fc2500288f
--- /dev/null
+++ b/src/tools/illink/test/Mono.Linker.Tests.Shared/Mono.Linker.Tests.Shared.projitems
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs b/src/tools/illink/test/Mono.Linker.Tests.Shared/TestRunner.cs
similarity index 61%
rename from src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs
rename to src/tools/illink/test/Mono.Linker.Tests.Shared/TestRunner.cs
index 6a9296d55ad57e..cf00f6ea4f5ed2 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests.Shared/TestRunner.cs
@@ -1,17 +1,18 @@
-// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+#nullable enable
using System;
+using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mono.Cecil;
using Mono.Linker.Tests.Extensions;
using Mono.Linker.Tests.TestCases;
-using Xunit.Sdk;
namespace Mono.Linker.Tests.TestCasesRunner
{
- public class TestRunner
+ public partial class TestRunner
{
private readonly ObjectFactory _factory;
@@ -20,14 +21,14 @@ public TestRunner (ObjectFactory factory)
_factory = factory;
}
- public virtual ILCompilerTestCaseResult? Run (TestCase testCase)
+ public virtual TrimmedTestCaseResult? Run (TestCase testCase)
{
try {
using (var fullTestCaseAssemblyDefinition = AssemblyDefinition.ReadAssembly (testCase.OriginalTestCaseAssemblyPath.ToString ())) {
var compilationMetadataProvider = _factory.CreateCompilationMetadataProvider (testCase, fullTestCaseAssemblyDefinition);
if (compilationMetadataProvider.IsIgnored (out string? ignoreReason))
- throw new IgnoreTestException (ignoreReason);
+ IgnoreTest (ignoreReason);
var sandbox = Sandbox (testCase, compilationMetadataProvider);
var compilationResult = Compile (sandbox, compilationMetadataProvider);
@@ -45,7 +46,9 @@ public TestRunner (ObjectFactory factory)
}
}
- public virtual ILCompilerTestCaseResult Relink (ILCompilerTestCaseResult result)
+ partial void IgnoreTest (string reason);
+
+ public virtual TrimmedTestCaseResult Relink (TrimmedTestCaseResult result)
{
PrepForLink (result.Sandbox, result.CompilationResult);
return Link (result.TestCase, result.Sandbox, result.CompilationResult, result.MetadataProvider);
@@ -74,14 +77,36 @@ private ManagedCompilationResult Compile (TestCaseSandbox sandbox, TestCaseCompi
var expectationsCommonReferences = metadataProvider.GetCommonReferencedAssemblies (sandbox.ExpectationsDirectory).ToArray ();
var expectationsMainAssemblyReferences = metadataProvider.GetReferencedAssemblies (sandbox.ExpectationsDirectory).ToArray ();
- var inputTask = Task.Run (() => inputCompiler.CompileTestIn (sandbox.InputDirectory, assemblyName!, sourceFiles, commonReferences, mainAssemblyReferences, new string[] { "NATIVEAOT" }, resources, additionalArguments));
- var expectationsTask = Task.Run (() => expectationsCompiler.CompileTestIn (sandbox.ExpectationsDirectory, assemblyName!, sourceFiles, expectationsCommonReferences, expectationsMainAssemblyReferences, new[] { "INCLUDE_EXPECTATIONS", "NATIVEAOT" }, resources, additionalArguments));
+ var additionalDefines = GetAdditionalDefines ();
+ var inputTask = Task.Run (() => inputCompiler.CompileTestIn (
+ sandbox.InputDirectory,
+ assemblyName,
+ sourceFiles,
+ commonReferences,
+ mainAssemblyReferences,
+ additionalDefines?.ToArray (),
+ resources,
+ additionalArguments));
+
+ var expectationsDefines = new string[] { "INCLUDE_EXPECTATIONS" };
+ if (additionalDefines != null)
+ expectationsDefines = expectationsDefines.Concat (additionalDefines).ToArray ();
+
+ var expectationsTask = Task.Run (() => expectationsCompiler.CompileTestIn (
+ sandbox.ExpectationsDirectory,
+ assemblyName,
+ sourceFiles,
+ expectationsCommonReferences,
+ expectationsMainAssemblyReferences,
+ expectationsDefines,
+ resources,
+ additionalArguments));
NPath? inputAssemblyPath = null;
NPath? expectationsAssemblyPath = null;
try {
- inputAssemblyPath = GetResultOfTaskThatMakesXUnitAssertions (inputTask);
- expectationsAssemblyPath = GetResultOfTaskThatMakesXUnitAssertions (expectationsTask);
+ inputAssemblyPath = GetResultOfTaskThatMakesAssertions (inputTask);
+ expectationsAssemblyPath = GetResultOfTaskThatMakesAssertions (expectationsTask);
} catch (Exception) {
// If completing the input assembly task threw, we need to wait for the expectations task to complete before continuing
// otherwise we could set the next test up for a race condition with the expectations compilation over access to the sandbox directory
@@ -99,41 +124,50 @@ private ManagedCompilationResult Compile (TestCaseSandbox sandbox, TestCaseCompi
return new ManagedCompilationResult (inputAssemblyPath, expectationsAssemblyPath);
}
+ private partial IEnumerable? GetAdditionalDefines();
+
protected virtual void PrepForLink (TestCaseSandbox sandbox, ManagedCompilationResult compilationResult)
{
}
- private ILCompilerTestCaseResult Link (TestCase testCase, TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TestCaseMetadataProvider metadataProvider)
+ private TrimmedTestCaseResult Link (TestCase testCase, TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TestCaseMetadataProvider metadataProvider)
{
var trimmer = _factory.CreateTrimmer ();
-
- var builder = _factory.CreateTrimmerOptionsBuilder (metadataProvider);
-
- AddLinkOptions (sandbox, compilationResult, builder, metadataProvider);
-
- var logWriter = new TestLogWriter ();
- var trimmingResults = trimmer.Trim (builder.Options, logWriter);
-
- return new ILCompilerTestCaseResult (testCase, compilationResult.InputAssemblyPath, compilationResult.ExpectationsAssemblyPath, sandbox, metadataProvider, compilationResult, trimmingResults, logWriter);
+ var trimmingCustomizations = CustomizeLinker (trimmer, metadataProvider);
+
+ var builder = _factory.CreateTrimmingArgumentBuilder (metadataProvider);
+
+ AddTrimmingOptions (sandbox, compilationResult, builder, metadataProvider);
+
+ var logger = new TrimmingTestLogger ();
+ var trimmingResults = trimmer.Trim (builder.Build (), trimmingCustomizations, logger);
+
+ return new TrimmedTestCaseResult (
+ testCase,
+ compilationResult.InputAssemblyPath,
+ sandbox.OutputDirectory.Combine (compilationResult.InputAssemblyPath.FileName),
+ compilationResult.ExpectationsAssemblyPath,
+ sandbox,
+ metadataProvider,
+ compilationResult,
+ logger,
+ trimmingCustomizations,
+ trimmingResults);
}
- protected virtual void AddLinkOptions (TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, ILCompilerOptionsBuilder builder, TestCaseMetadataProvider metadataProvider)
+ protected virtual void AddTrimmingOptions (TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TrimmingArgumentBuilder builder, TestCaseMetadataProvider metadataProvider)
{
var caseDefinedOptions = metadataProvider.GetLinkerOptions (sandbox.InputDirectory);
- builder.AddOutputDirectory (sandbox.OutputDirectory.Combine (compilationResult.InputAssemblyPath.FileNameWithoutExtension + ".obj"));
+ AddOutputDirectory (sandbox, compilationResult, builder);
foreach (var rspFile in sandbox.ResponseFiles)
builder.AddResponseFile (rspFile);
foreach (var inputReference in sandbox.InputDirectory.Files ()) {
var ext = inputReference.ExtensionWithDot;
- if (ext == ".dll" || ext == ".exe") {
- // It's important to add all assemblies as "link" assemblies since the default configuration
- // is to run the compiler in multi-file mode which will not process anything which is just in the reference set.
- builder.AddLinkAssembly (inputReference);
- builder.AddReference (inputReference);
- }
+ if (ext == ".dll" || ext == ".exe")
+ AddInputReference (inputReference, builder);
}
var coreAction = caseDefinedOptions.TrimMode ?? "skip";
foreach (var extraReference in metadataProvider.GetExtraLinkerReferences ()) {
@@ -146,18 +180,10 @@ protected virtual void AddLinkOptions (TestCaseSandbox sandbox, ManagedCompilati
builder.ProcessTestInputAssembly (compilationResult.InputAssemblyPath);
}
- private static T GetResultOfTaskThatMakesXUnitAssertions (Task task)
- {
- try {
- return task.Result;
- } catch (AggregateException e) {
- if (e.InnerException != null) {
- if (e.InnerException is XunitException)
- throw e.InnerException;
- }
+ protected partial TrimmingCustomizations? CustomizeLinker (TrimmingDriver linker, TestCaseMetadataProvider metadataProvider);
- throw;
- }
- }
+ static partial void AddOutputDirectory (TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TrimmingArgumentBuilder builder);
+
+ static partial void AddInputReference (NPath inputReference, TrimmingArgumentBuilder builder);
}
}
diff --git a/src/tools/illink/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj b/src/tools/illink/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
index 109aa2f3a24310..afbdda93f996dd 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
+++ b/src/tools/illink/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
@@ -61,4 +61,6 @@
+
+
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCases/IndividualTests.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCases/IndividualTests.cs
index 7fa976b55c5842..1b6ee0ff116fe5 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCases/IndividualTests.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCases/IndividualTests.cs
@@ -250,12 +250,12 @@ private static TestCase CreateIndividualCase (Type testCaseType)
return TestDatabase.CreateCollector ().CreateIndividualCase (testCaseType);
}
- protected LinkedTestCaseResult Run (TestCase testCase)
+ protected TrimmedTestCaseResult Run (TestCase testCase)
{
return Run (testCase, out _);
}
- protected virtual LinkedTestCaseResult Run (TestCase testCase, out TestRunner runner)
+ protected virtual TrimmedTestCaseResult Run (TestCase testCase, out TestRunner runner)
{
runner = new TestRunner (new ObjectFactory ());
return runner.Run (testCase);
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs
index 95888eaa6a233b..85e779aaff232c 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs
@@ -18,7 +18,7 @@ namespace Mono.Linker.Tests.TestCasesRunner
public class AssemblyChecker
{
readonly AssemblyDefinition originalAssembly, linkedAssembly;
- readonly LinkedTestCaseResult linkedTestCase;
+ readonly TrimmedTestCaseResult linkedTestCase;
HashSet linkedMembers;
readonly HashSet verifiedGeneratedFields = new HashSet ();
@@ -26,7 +26,7 @@ public class AssemblyChecker
readonly HashSet verifiedGeneratedTypes = new HashSet ();
bool checkNames;
- public AssemblyChecker (AssemblyDefinition original, AssemblyDefinition linked, LinkedTestCaseResult linkedTestCase)
+ public AssemblyChecker (AssemblyDefinition original, AssemblyDefinition linked, TrimmedTestCaseResult linkedTestCase)
{
this.originalAssembly = original;
this.linkedAssembly = linked;
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILChecker.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILChecker.cs
index 50397b2c690dd8..dbced87b9c84ec 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILChecker.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILChecker.cs
@@ -15,7 +15,7 @@ namespace Mono.Linker.Tests.TestCasesRunner.ILVerification;
public class ILChecker
{
- public virtual void Check (LinkedTestCaseResult linkResult, AssemblyDefinition original)
+ public virtual void Check (TrimmedTestCaseResult linkResult, AssemblyDefinition original)
{
ProcessSkipAttributes (linkResult, original, out bool skipCheckEntirely, out HashSet assembliesToSkip);
@@ -78,14 +78,14 @@ public virtual void Check (LinkedTestCaseResult linkResult, AssemblyDefinition o
}
}
- private static bool DisableILDiffing (LinkedTestCaseResult linkResult, AssemblyDefinition original)
+ private static bool DisableILDiffing (TrimmedTestCaseResult linkResult, AssemblyDefinition original)
{
return linkResult.TestCase.FindTypeDefinition (original)
.CustomAttributes
.FirstOrDefault (attr => attr.AttributeType.Name == nameof(DisableILVerifyDiffingAttribute)) != null;
}
- private static void ProcessExpectILFailures (LinkedTestCaseResult linkResult, AssemblyDefinition original, out bool expectILFailures, out List failureMessages)
+ private static void ProcessExpectILFailures (TrimmedTestCaseResult linkResult, AssemblyDefinition original, out bool expectILFailures, out List failureMessages)
{
var attrs = linkResult.TestCase.FindTypeDefinition (original).CustomAttributes.Where (attr => attr.AttributeType.Name == nameof(ExpectILFailureAttribute)).ToArray ();
expectILFailures = attrs.Length > 0;
@@ -96,7 +96,7 @@ private static void ProcessExpectILFailures (LinkedTestCaseResult linkResult, As
}
}
- private void ProcessSkipAttributes (LinkedTestCaseResult linkResult, AssemblyDefinition original, out bool skipCheckEntirely, out HashSet assembliesToSkip)
+ private void ProcessSkipAttributes (TrimmedTestCaseResult linkResult, AssemblyDefinition original, out bool skipCheckEntirely, out HashSet assembliesToSkip)
{
var attrs = linkResult.TestCase.FindTypeDefinition (original).CustomAttributes.Where (attr => attr.AttributeType.Name == nameof(SkipILVerifyAttribute));
skipCheckEntirely = false;
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs
index 46f7ee36298dc0..c21582c3556c64 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ObjectFactory.cs
@@ -18,9 +18,9 @@ public virtual TestCaseCompiler CreateCompiler (TestCaseSandbox sandbox, TestCas
return new TestCaseCompiler (sandbox, metadataProvider);
}
- public virtual LinkerDriver CreateLinker ()
+ public virtual TrimmingDriver CreateTrimmer ()
{
- return new LinkerDriver ();
+ return new TrimmingDriver ();
}
public virtual TestCaseMetadataProvider CreateMetadataProvider (TestCase testCase, AssemblyDefinition expectationsAssemblyDefinition)
@@ -33,9 +33,9 @@ public virtual TestCaseCompilationMetadataProvider CreateCompilationMetadataProv
return new TestCaseCompilationMetadataProvider (testCase, fullTestCaseAssemblyDefinition);
}
- public virtual LinkerArgumentBuilder CreateLinkerArgumentBuilder (TestCaseMetadataProvider metadataProvider)
+ public virtual TrimmingArgumentBuilder CreateTrimmingArgumentBuilder (TestCaseMetadataProvider metadataProvider)
{
- return new LinkerArgumentBuilder (metadataProvider);
+ return new TrimmingArgumentBuilder (metadataProvider);
}
}
}
\ No newline at end of file
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs
index c5bfcd9efdb2b1..88bfcd26a519dc 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs
@@ -79,7 +79,7 @@ protected static void ValidateTypeRefsHaveValidAssemblyRefs (AssemblyDefinition
}
}
- public virtual void Check (LinkedTestCaseResult linkResult)
+ public virtual void Check (TrimmedTestCaseResult linkResult)
{
InitializeResolvers (linkResult);
@@ -122,7 +122,7 @@ bool HasActiveSkipKeptItemsValidationAttribute (ICustomAttributeProvider provide
}
}
- void VerifyILOfOtherAssemblies (LinkedTestCaseResult linkResult)
+ void VerifyILOfOtherAssemblies (TrimmedTestCaseResult linkResult)
{
foreach (var linkedAssemblyPath in linkResult.Sandbox.OutputDirectory.Files ("*.dll")) {
if (linkedAssemblyPath == linkResult.OutputAssemblyPath)
@@ -135,12 +135,12 @@ void VerifyILOfOtherAssemblies (LinkedTestCaseResult linkResult)
protected virtual ILChecker CreateILChecker () => new ();
- protected virtual AssemblyChecker CreateAssemblyChecker (AssemblyDefinition original, AssemblyDefinition linked, LinkedTestCaseResult linkedTestCase)
+ protected virtual AssemblyChecker CreateAssemblyChecker (AssemblyDefinition original, AssemblyDefinition linked, TrimmedTestCaseResult linkedTestCase)
{
return new AssemblyChecker (original, linked, linkedTestCase);
}
- void InitializeResolvers (LinkedTestCaseResult linkedResult)
+ void InitializeResolvers (TrimmedTestCaseResult linkedResult)
{
_originalsResolver.AddSearchDirectory (linkedResult.ExpectationsAssemblyPath.Parent.ToString ());
_linkedResolver.AddSearchDirectory (linkedResult.OutputAssemblyPath.Parent.ToString ());
@@ -215,7 +215,7 @@ void PerformOutputSymbolChecks (AssemblyDefinition original, NPath outputDirecto
}
}
- void VerifyExitCode (LinkedTestCaseResult linkResult, AssemblyDefinition original)
+ void VerifyExitCode (TrimmedTestCaseResult linkResult, AssemblyDefinition original)
{
if (TryGetCustomAttribute (original, nameof(ExpectNonZeroExitCodeAttribute), out var attr)) {
var expectedExitCode = (int) attr.ConstructorArguments[0].Value;
@@ -270,14 +270,14 @@ void VerifyRemovedSymbols (CustomAttribute symbolsAttribute, NPath outputDirecto
}
}
- protected virtual void AdditionalChecking (LinkedTestCaseResult linkResult, AssemblyDefinition original)
+ protected virtual void AdditionalChecking (TrimmedTestCaseResult linkResult, AssemblyDefinition original)
{
bool checkRemainingErrors = !HasAttribute (linkResult.TestCase.FindTypeDefinition (original), nameof (SkipRemainingErrorsValidationAttribute));
VerifyLoggedMessages (original, linkResult.Logger, checkRemainingErrors);
VerifyRecordedDependencies (original, linkResult.Customizations.DependencyRecorder);
}
- protected virtual void InitialChecking (LinkedTestCaseResult linkResult, AssemblyDefinition original, AssemblyDefinition linked)
+ protected virtual void InitialChecking (TrimmedTestCaseResult linkResult, AssemblyDefinition original, AssemblyDefinition linked)
{
CreateILChecker ().Check(linkResult, original);
ValidateTypeRefsHaveValidAssemblyRefs (linked);
@@ -753,7 +753,7 @@ static IEnumerable GetAttributeProviders (AssemblyDefi
yield return assembly;
}
- void VerifyLoggedMessages (AssemblyDefinition original, LinkerTestLogger logger, bool checkRemainingErrors)
+ void VerifyLoggedMessages (AssemblyDefinition original, TrimmingTestLogger logger, bool checkRemainingErrors)
{
List loggedMessages = logger.GetLoggedMessages ();
List<(ICustomAttributeProvider, CustomAttribute)> expectedNoWarningsAttributes = new ();
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs
index c9004af0a25733..435fd3c994afec 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs
@@ -86,7 +86,7 @@ public virtual TestCaseLinkerOptions GetLinkerOptions (NPath inputPath)
return tclo;
}
- public virtual void CustomizeLinker (LinkerDriver linker, LinkerCustomizations customizations)
+ public virtual void CustomizeLinker (TrimmingDriver linker, TrimmingCustomizations customizations)
{
if (!_testCaseTypeDefinition.CustomAttributes.Any (a => a.AttributeType.IsTypeOf ())
|| _testCaseTypeDefinition.CustomAttributes.Any (attr =>
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs
index 52a91c049e6e67..230b1a1e38ba7f 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestRunner.cs
@@ -1,168 +1,58 @@
-// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+#nullable enable
using System;
-using System.Linq;
+using System.Collections.Generic;
using System.Threading.Tasks;
-using Mono.Cecil;
-using Mono.Linker.Tests.Extensions;
-using Mono.Linker.Tests.TestCases;
using NUnit.Framework;
+using Mono.Linker.Tests.Extensions;
namespace Mono.Linker.Tests.TestCasesRunner
{
- public class TestRunner
+ partial class TestRunner
{
- private readonly ObjectFactory _factory;
-
- public TestRunner (ObjectFactory factory)
+ partial void IgnoreTest (string reason)
{
- _factory = factory;
+ Assert.Ignore (reason);
}
- public virtual LinkedTestCaseResult Run (TestCase testCase)
- {
- using (var fullTestCaseAssemblyDefinition = AssemblyDefinition.ReadAssembly (testCase.OriginalTestCaseAssemblyPath.ToString ())) {
- var compilationMetadataProvider = _factory.CreateCompilationMetadataProvider (testCase, fullTestCaseAssemblyDefinition);
-
- if (compilationMetadataProvider.IsIgnored (out string ignoreReason))
- Assert.Ignore (ignoreReason);
-
- var sandbox = Sandbox (testCase, compilationMetadataProvider);
- var compilationResult = Compile (sandbox, compilationMetadataProvider);
- using (var expectationsAssemblyDefinition = AssemblyDefinition.ReadAssembly (compilationResult.ExpectationsAssemblyPath.ToString ())) {
- var metadataProvider = _factory.CreateMetadataProvider (testCase, expectationsAssemblyDefinition);
-
- sandbox.PopulateFromExpectations (metadataProvider);
-
- PrepForLink (sandbox, compilationResult);
- return Link (testCase, sandbox, compilationResult, metadataProvider);
- }
- }
- }
-
- public virtual LinkedTestCaseResult Relink (LinkedTestCaseResult result)
- {
- PrepForLink (result.Sandbox, result.CompilationResult);
- return Link (result.TestCase, result.Sandbox, result.CompilationResult, result.MetadataProvider);
- }
-
- private TestCaseSandbox Sandbox (TestCase testCase, TestCaseCompilationMetadataProvider metadataProvider)
- {
- var sandbox = _factory.CreateSandbox (testCase);
- sandbox.Populate (metadataProvider);
- return sandbox;
- }
+ private partial IEnumerable? GetAdditionalDefines() => null;
- private ManagedCompilationResult Compile (TestCaseSandbox sandbox, TestCaseCompilationMetadataProvider metadataProvider)
+ private static T GetResultOfTaskThatMakesAssertions (Task task)
{
- var inputCompiler = _factory.CreateCompiler (sandbox, metadataProvider);
- var expectationsCompiler = _factory.CreateCompiler (sandbox, metadataProvider);
- var sourceFiles = sandbox.SourceFiles.Select (s => s.ToString ()).ToArray ();
-
- var assemblyName = metadataProvider.GetAssemblyName ();
-
- var commonReferences = metadataProvider.GetCommonReferencedAssemblies (sandbox.InputDirectory).ToArray ();
- var mainAssemblyReferences = metadataProvider.GetReferencedAssemblies (sandbox.InputDirectory).ToArray ();
- var resources = sandbox.ResourceFiles.ToArray ();
- var additionalArguments = metadataProvider.GetSetupCompilerArguments ().ToArray ();
-
- var expectationsCommonReferences = metadataProvider.GetCommonReferencedAssemblies (sandbox.ExpectationsDirectory).ToArray ();
- var expectationsMainAssemblyReferences = metadataProvider.GetReferencedAssemblies (sandbox.ExpectationsDirectory).ToArray ();
-
- var inputTask = Task.Run (() => inputCompiler.CompileTestIn (sandbox.InputDirectory, assemblyName, sourceFiles, commonReferences, mainAssemblyReferences, null, resources, additionalArguments));
- var expectationsTask = Task.Run (() => expectationsCompiler.CompileTestIn (sandbox.ExpectationsDirectory, assemblyName, sourceFiles, expectationsCommonReferences, expectationsMainAssemblyReferences, new[] { "INCLUDE_EXPECTATIONS" }, resources, additionalArguments));
-
- NPath inputAssemblyPath = null;
- NPath expectationsAssemblyPath = null;
try {
- inputAssemblyPath = GetResultOfTaskThatMakesNUnitAssertions (inputTask);
- expectationsAssemblyPath = GetResultOfTaskThatMakesNUnitAssertions (expectationsTask);
- } catch (Exception) {
- // If completing the input assembly task threw, we need to wait for the expectations task to complete before continuing
- // otherwise we could set the next test up for a race condition with the expectations compilation over access to the sandbox directory
- if (inputAssemblyPath == null && expectationsAssemblyPath == null) {
- try {
- expectationsTask.Wait ();
- } catch (Exception) {
- // Don't care, we want to throw the first exception
- }
+ return task.Result;
+ } catch (AggregateException e) {
+ if (e.InnerException != null) {
+ if (e.InnerException is AssertionException
+ || e.InnerException is SuccessException
+ || e.InnerException is IgnoreException
+ || e.InnerException is InconclusiveException)
+ throw e.InnerException;
}
throw;
}
-
- return new ManagedCompilationResult (inputAssemblyPath, expectationsAssemblyPath);
}
- protected virtual void PrepForLink (TestCaseSandbox sandbox, ManagedCompilationResult compilationResult)
+ protected partial TrimmingCustomizations? CustomizeLinker (TrimmingDriver linker, TestCaseMetadataProvider metadataProvider)
{
- }
+ TrimmingCustomizations customizations = new TrimmingCustomizations ();
- private LinkedTestCaseResult Link (TestCase testCase, TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TestCaseMetadataProvider metadataProvider)
- {
- var linker = _factory.CreateLinker ();
- var linkerCustomizations = CustomizeLinker (linker, metadataProvider);
-
- var builder = _factory.CreateLinkerArgumentBuilder (metadataProvider);
-
- AddLinkOptions (sandbox, compilationResult, builder, metadataProvider);
-
- LinkerTestLogger logger = new LinkerTestLogger ();
- var exitCode = linker.Link (builder.ToArgs (), linkerCustomizations, logger);
+ metadataProvider.CustomizeLinker (linker, customizations);
- return new LinkedTestCaseResult (testCase, compilationResult.InputAssemblyPath, sandbox.OutputDirectory.Combine (compilationResult.InputAssemblyPath.FileName), compilationResult.ExpectationsAssemblyPath, sandbox, metadataProvider, compilationResult, logger, linkerCustomizations, exitCode);
+ return customizations;
}
- protected virtual void AddLinkOptions (TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, LinkerArgumentBuilder builder, TestCaseMetadataProvider metadataProvider)
+ static partial void AddOutputDirectory (TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TrimmingArgumentBuilder builder)
{
- var caseDefinedOptions = metadataProvider.GetLinkerOptions (sandbox.InputDirectory);
-
builder.AddOutputDirectory (sandbox.OutputDirectory);
-
- foreach (var rspFile in sandbox.ResponseFiles)
- builder.AddResponseFile (rspFile);
-
- foreach (var inputReference in sandbox.InputDirectory.Files ()) {
- var ext = inputReference.ExtensionWithDot;
- if (ext == ".dll" || ext == ".exe")
- builder.AddReference (inputReference);
- }
- var coreAction = caseDefinedOptions.TrimMode ?? "skip";
- foreach (var extraReference in metadataProvider.GetExtraLinkerReferences ()) {
- builder.AddReference (extraReference);
- builder.AddAssemblyAction (coreAction, extraReference.FileNameWithoutExtension);
- }
-
- builder.ProcessOptions (caseDefinedOptions);
-
- builder.ProcessTestInputAssembly (compilationResult.InputAssemblyPath);
- }
-
- protected virtual LinkerCustomizations CustomizeLinker (LinkerDriver linker, TestCaseMetadataProvider metadataProvider)
- {
- LinkerCustomizations customizations = new LinkerCustomizations ();
-
- metadataProvider.CustomizeLinker (linker, customizations);
-
- return customizations;
}
- private static T GetResultOfTaskThatMakesNUnitAssertions (Task task)
+ static partial void AddInputReference (NPath inputReference, TrimmingArgumentBuilder builder)
{
- try {
- return task.Result;
- } catch (AggregateException e) {
- if (e.InnerException != null) {
- if (e.InnerException is AssertionException
- || e.InnerException is SuccessException
- || e.InnerException is IgnoreException
- || e.InnerException is InconclusiveException)
- throw e.InnerException;
- }
-
- throw;
- }
+ builder.AddReference (inputReference);
}
}
}
\ No newline at end of file
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkedTestCaseResult.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmedTestCaseResult.cs
similarity index 58%
rename from src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkedTestCaseResult.cs
rename to src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmedTestCaseResult.cs
index 430225aa688518..7cffd98a124c92 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkedTestCaseResult.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmedTestCaseResult.cs
@@ -1,12 +1,14 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+#nullable enable
+using System;
using Mono.Linker.Tests.Extensions;
using Mono.Linker.Tests.TestCases;
namespace Mono.Linker.Tests.TestCasesRunner
{
- public class LinkedTestCaseResult
+ public class TrimmedTestCaseResult
{
public readonly TestCase TestCase;
public readonly NPath InputAssemblyPath;
@@ -15,11 +17,21 @@ public class LinkedTestCaseResult
public readonly TestCaseSandbox Sandbox;
public readonly TestCaseMetadataProvider MetadataProvider;
public readonly ManagedCompilationResult CompilationResult;
- public readonly LinkerTestLogger Logger;
- public readonly LinkerCustomizations Customizations;
+ public readonly TrimmingTestLogger Logger;
+ public readonly TrimmingCustomizations Customizations;
public readonly int ExitCode;
- public LinkedTestCaseResult (TestCase testCase, NPath inputAssemblyPath, NPath outputAssemblyPath, NPath expectationsAssemblyPath, TestCaseSandbox sandbox, TestCaseMetadataProvider metadataProvider, ManagedCompilationResult compilationResult, LinkerTestLogger logger, LinkerCustomizations customizations, int exitCode)
+ public TrimmedTestCaseResult (
+ TestCase testCase,
+ NPath inputAssemblyPath,
+ NPath outputAssemblyPath,
+ NPath expectationsAssemblyPath,
+ TestCaseSandbox sandbox,
+ TestCaseMetadataProvider metadataProvider,
+ ManagedCompilationResult compilationResult,
+ TrimmingTestLogger logger,
+ TrimmingCustomizations? customizations,
+ TrimmingResults trimmingResults)
{
TestCase = testCase;
InputAssemblyPath = inputAssemblyPath;
@@ -29,8 +41,8 @@ public LinkedTestCaseResult (TestCase testCase, NPath inputAssemblyPath, NPath o
MetadataProvider = metadataProvider;
CompilationResult = compilationResult;
Logger = logger;
- Customizations = customizations;
- ExitCode = exitCode;
+ Customizations = customizations ?? throw new InvalidOperationException ("Customizations must be provided");
+ ExitCode = trimmingResults.ExitCode;
}
}
}
\ No newline at end of file
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingArgumentBuilder.cs
similarity index 97%
rename from src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs
rename to src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingArgumentBuilder.cs
index 3164478220714c..dfcc508e08a376 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingArgumentBuilder.cs
@@ -6,12 +6,12 @@
namespace Mono.Linker.Tests.TestCasesRunner
{
- public class LinkerArgumentBuilder
+ public class TrimmingArgumentBuilder
{
private readonly List _arguments = new List ();
private readonly TestCaseMetadataProvider _metadataProvider;
- public LinkerArgumentBuilder (TestCaseMetadataProvider metadataProvider)
+ public TrimmingArgumentBuilder (TestCaseMetadataProvider metadataProvider)
{
_metadataProvider = metadataProvider;
}
@@ -157,7 +157,7 @@ public virtual void AddLinkAttributes (string file)
Append (file);
}
- public string[] ToArgs ()
+ public string[] Build ()
{
return _arguments.ToArray ();
}
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerCustomizations.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingCustomizations.cs
similarity index 94%
rename from src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerCustomizations.cs
rename to src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingCustomizations.cs
index 7de365dcf26572..600084cbfd5f02 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerCustomizations.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingCustomizations.cs
@@ -9,7 +9,7 @@ namespace Mono.Linker.Tests.TestCasesRunner
/// Stores various customizations which can be added to ILLink at runtime,
/// for example test implementations of certain interfaces.
///
- public class LinkerCustomizations
+ public class TrimmingCustomizations
{
public TestDependencyRecorder DependencyRecorder { get; set; }
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerDriver.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingDriver.cs
similarity index 68%
rename from src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerDriver.cs
rename to src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingDriver.cs
index c47c5e8a062bf9..d6f0e9aadb1e87 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerDriver.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingDriver.cs
@@ -5,13 +5,13 @@
namespace Mono.Linker.Tests.TestCasesRunner
{
- public class LinkerDriver
+ public class TrimmingDriver
{
protected class TestDriver : Driver
{
- readonly LinkerCustomizations _customization;
+ readonly TrimmingCustomizations _customization;
- public TestDriver (Queue args, LinkerCustomizations customizations) : base (args)
+ public TestDriver (Queue args, TrimmingCustomizations customizations) : base (args)
{
_customization = customizations;
}
@@ -24,11 +24,11 @@ protected override LinkContext GetDefaultContext (Pipeline pipeline, ILogger log
}
}
- public virtual int Link (string[] args, LinkerCustomizations customizations, ILogger logger)
+ public virtual TrimmingResults Trim (string[] args, TrimmingCustomizations customizations, ILogger logger)
{
Driver.ProcessResponseFile (args, out var queue);
using (var driver = new TestDriver (queue, customizations)) {
- return driver.Run (logger);
+ return new TrimmingResults (driver.Run (logger));
}
}
}
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerTestLogger.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingTestLogger.cs
similarity index 91%
rename from src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerTestLogger.cs
rename to src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingTestLogger.cs
index 98feb829f2d5ff..f3b3213848e13b 100644
--- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerTestLogger.cs
+++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingTestLogger.cs
@@ -5,11 +5,11 @@
namespace Mono.Linker.Tests.TestCasesRunner
{
- public class LinkerTestLogger : ILogger
+ public class TrimmingTestLogger : ILogger
{
readonly List MessageContainers;
- public LinkerTestLogger ()
+ public TrimmingTestLogger ()
{
MessageContainers = new List ();
}
diff --git a/src/tools/illink/test/Mono.Linker.Tests/TrimmingResults.cs b/src/tools/illink/test/Mono.Linker.Tests/TrimmingResults.cs
new file mode 100644
index 00000000000000..d5b3f52d2dd118
--- /dev/null
+++ b/src/tools/illink/test/Mono.Linker.Tests/TrimmingResults.cs
@@ -0,0 +1,11 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace Mono.Linker.Tests.TestCasesRunner
+{
+ public struct TrimmingResults
+ {
+ public int ExitCode { get; }
+ public TrimmingResults(int exitCode) => ExitCode = exitCode;
+ }
+}