diff options
author | Mike Voorhees <michaelv@unity3d.com> | 2017-05-12 21:03:09 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-05-13 08:43:38 +0300 |
commit | e56adeca46d53d69f846fbffb268ddad1786d2b1 (patch) | |
tree | f3cba2e2c4f037a04f6d9e83ba092e007db35981 /linker/Tests | |
parent | c07e471e1008198eadf833164f46c2ef3b40c4fa (diff) |
More resolution clean up in ResultChecker
Allow multiple [Reference] attributes
Diffstat (limited to 'linker/Tests')
-rw-r--r-- | linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs | 2 | ||||
-rw-r--r-- | linker/Tests/TestCasesRunner/ResultChecker.cs | 22 |
2 files changed, 11 insertions, 13 deletions
diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs index 0a37a2149..044b4a5f8 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs @@ -1,7 +1,7 @@ using System; namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [AttributeUsage (AttributeTargets.Class)] + [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] public class ReferenceAttribute : BaseMetadataAttribute { public readonly string Value; diff --git a/linker/Tests/TestCasesRunner/ResultChecker.cs b/linker/Tests/TestCasesRunner/ResultChecker.cs index c61935ba1..5c556e4f0 100644 --- a/linker/Tests/TestCasesRunner/ResultChecker.cs +++ b/linker/Tests/TestCasesRunner/ResultChecker.cs @@ -32,14 +32,14 @@ namespace Mono.Linker.Tests.TestCasesRunner { try { - var original = ResolveOriginalsAssembly (linkResult.ExpectationsAssemblyPath); + var original = ResolveOriginalsAssembly (linkResult.ExpectationsAssemblyPath.FileNameWithoutExtension); PerformOutputAssemblyChecks (original, linkResult.OutputAssemblyPath.Parent); - var linked = ResolveLinkedAssembly (linkResult.OutputAssemblyPath); + var linked = ResolveLinkedAssembly (linkResult.OutputAssemblyPath.FileNameWithoutExtension); new AssemblyChecker (original, linked).Verify (); - VerifyLinkingOfOtherAssemblies (original, linkResult.OutputAssemblyPath.Parent); + VerifyLinkingOfOtherAssemblies (original); } finally { @@ -54,14 +54,12 @@ namespace Mono.Linker.Tests.TestCasesRunner { _linkedResolver.AddSearchDirectory (linkedResult.OutputAssemblyPath.Parent.ToString ()); } - AssemblyDefinition ResolveLinkedAssembly (NPath assemblyPath) + AssemblyDefinition ResolveLinkedAssembly (string assemblyName) { - return _linkedResolver.Resolve (new AssemblyNameReference (assemblyPath.FileNameWithoutExtension, null)); - } - - AssemblyDefinition ResolveOriginalsAssembly (NPath assemblyPath) - { - return _originalsResolver.Resolve (new AssemblyNameReference (assemblyPath.FileNameWithoutExtension, null)); + var cleanAssemblyName = assemblyName; + if (assemblyName.EndsWith(".exe") || assemblyName.EndsWith(".dll")) + cleanAssemblyName = System.IO.Path.GetFileNameWithoutExtension (assemblyName); + return _linkedResolver.Resolve (new AssemblyNameReference (cleanAssemblyName, null)); } AssemblyDefinition ResolveOriginalsAssembly (string assemblyName) @@ -83,12 +81,12 @@ namespace Mono.Linker.Tests.TestCasesRunner { } } - void VerifyLinkingOfOtherAssemblies (AssemblyDefinition original, NPath outputDirectory) + void VerifyLinkingOfOtherAssemblies (AssemblyDefinition original) { var checks = BuildOtherAssemblyCheckTable (original); foreach (var assemblyName in checks.Keys) { - using (var linkedAssembly = ResolveLinkedAssembly (outputDirectory.Combine (assemblyName))) { + using (var linkedAssembly = ResolveLinkedAssembly (assemblyName)) { foreach (var checkAttrInAssembly in checks [assemblyName]) { var expectedTypeName = checkAttrInAssembly.ConstructorArguments [1].Value.ToString (); var linkedType = linkedAssembly.MainModule.GetType (expectedTypeName); |