From 383abcdbb2185a21d076b6daec029a39f8d7fe6c Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Fri, 10 May 2024 22:28:40 +0000 Subject: [PATCH] Fix Mono.Linker.Tests build And ensure changes to ProjectReferences trigger linker tests --- eng/pipelines/common/evaluate-default-paths.yml | 2 ++ .../TestCasesRunner/ILVerification/ILVerifier.cs | 6 +++--- .../test/Mono.Linker.Tests/TestCasesRunner/ILVerifier.cs | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/eng/pipelines/common/evaluate-default-paths.yml b/eng/pipelines/common/evaluate-default-paths.yml index 975c18eb69d46..5d9373ea3cb07 100644 --- a/eng/pipelines/common/evaluate-default-paths.yml +++ b/eng/pipelines/common/evaluate-default-paths.yml @@ -162,6 +162,8 @@ jobs: - subset: tools_illink include: - src/tools/illink/* + - src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/* + - src/coreclr/tools/ILVerification/* - global.json - subset: tools_cdacreader diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILVerifier.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILVerifier.cs index 37b6c8b50bb4b..2f5da68b9e4c8 100644 --- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILVerifier.cs +++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILVerifier.cs @@ -33,7 +33,7 @@ public ILVerifier (NPath[] searchDirectories, string systemModuleName) IncludeMetadataTokensInErrorMessages = true }); - _verifier.SetSystemModuleName (new AssemblyName (systemModuleName)); + _verifier.SetSystemModuleName (new AssemblyNameInfo (systemModuleName)); } public ILVerifierResult[] VerifyByName (string assemblyName) @@ -132,10 +132,10 @@ bool TryLoadAssemblyFromFolder (string assemblyName, NPath folder, [NotNullWhen return null; } - PEReader? IResolver.ResolveAssembly (AssemblyName assemblyName) + PEReader? IResolver.ResolveAssembly (AssemblyNameInfo assemblyName) => Resolve (assemblyName.Name ?? assemblyName.FullName); - PEReader? IResolver.ResolveModule (AssemblyName referencingModule, string fileName) + PEReader? IResolver.ResolveModule (AssemblyNameInfo referencingModule, string fileName) => Resolve (Path.GetFileNameWithoutExtension (fileName)); public void Dispose () diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerifier.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerifier.cs index 1f907e753d1a2..87169314fbb19 100644 --- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerifier.cs +++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerifier.cs @@ -7,6 +7,7 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Reflection.Metadata; using System.Reflection.PortableExecutable; using System.Runtime.Loader; using ILVerify; @@ -42,7 +43,7 @@ public ILVerifier (NPath assemblyPath) SanityChecks = true, IncludeMetadataTokensInErrorMessages = true }); - _verifier.SetSystemModuleName (new AssemblyName ("mscorlib")); + _verifier.SetSystemModuleName (new AssemblyNameInfo ("mscorlib")); var allResults = _verifier.Verify (Resolve (assemblyName)) ?? Enumerable.Empty (); @@ -118,10 +119,10 @@ bool TryLoadAssemblyFromFolder (string assemblyName, NPath folder, [NotNullWhen return null; } - PEReader? ILVerify.IResolver.ResolveAssembly (AssemblyName assemblyName) + PEReader? ILVerify.IResolver.ResolveAssembly (AssemblyNameInfo assemblyName) => Resolve (assemblyName.Name ?? assemblyName.FullName); - PEReader? ILVerify.IResolver.ResolveModule (AssemblyName referencingModule, string fileName) + PEReader? ILVerify.IResolver.ResolveModule (AssemblyNameInfo referencingAssembly, string fileName) => Resolve (Path.GetFileNameWithoutExtension (fileName)); public static string GetErrorMessage (VerificationResult result)