diff options
author | Sven Boemer <sbomer@gmail.com> | 2019-04-09 11:14:59 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2019-04-09 11:14:59 +0300 |
commit | 84a5611fff0b01ebd014e86904b6ff2240f1314e (patch) | |
tree | 727c6077a84d8581356dbf66e90ac9af2703698e | |
parent | 744804f0a48fe92ebad54eff7d581c9d4af7860d (diff) |
Fix IL Compilation tests on .NET Core (#517)
* Fix MissingTargetReference on .NET Core
The test was failing because TypeForwarderMissingReference.il depends
on mscorlib without a version, and roslyn was looking for Object in
mscorlib, Version=0.0.0.0 as a result. This doesn't happen when using
csc from the command line because csc uses a different assembly
identity comparer by default: DesktopAssemblyIdentityComparer (even on
.NET Core).
* Also enable CanCompileILAssembly
* Also enable UnusedAttributeOnReturnTypeIsRemoved
4 files changed, 2 insertions, 10 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs index 2eaf17fec..1bab0b53f 100644 --- a/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs +++ b/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs @@ -2,9 +2,6 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { -#if NETCOREAPP - [IgnoreTestCase ("Needs investigation")] -#endif [SetupLinkerArgument ("--used-attrs-only", "true")] [Define ("IL_ASSEMBLY_AVAILABLE")] [SetupCompileBefore ("library.dll", new [] { "Dependencies/AssemblyWithUnusedAttributeOnReturnParameterDefinition.il" })] diff --git a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs index c3ec14bf0..73388f592 100644 --- a/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs +++ b/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs @@ -3,9 +3,6 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.TestFramework { -#if NETCOREAPP - [IgnoreTestCase ("Needs investigation")] -#endif [Define ("IL_ASSEMBLY_AVAILABLE")] [SetupCompileBefore ("ILAssembly.dll", new [] { "Dependencies/ILAssemblySample.il" })] [KeptMemberInAssembly ("ILAssembly.dll", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.ILAssemblySample", "GiveMeAValue()")] diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs index 4a937c446..a0731064f 100644 --- a/test/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs @@ -3,9 +3,6 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.TypeForwarding { -#if NETCOREAPP - [IgnoreTestCase ("Needs investigation")] -#endif [SkipUnresolved (true)] [Define ("IL_ASSEMBLY_AVAILABLE")] [SetupCompileBefore ("TypeForwarderMissingReference.dll", new [] { "Dependencies/TypeForwarderMissingReference.il" })] diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs index 75eb965ce..d40db5766 100644 --- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs +++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompiler.cs @@ -203,7 +203,8 @@ namespace Mono.Linker.Tests.TestCasesRunner { { var parseOptions = new CSharpParseOptions (preprocessorSymbols: options.Defines); var compilationOptions = new CSharpCompilationOptions ( - outputKind: options.OutputPath.FileName.EndsWith (".exe") ? OutputKind.ConsoleApplication : OutputKind.DynamicallyLinkedLibrary + outputKind: options.OutputPath.FileName.EndsWith (".exe") ? OutputKind.ConsoleApplication : OutputKind.DynamicallyLinkedLibrary, + assemblyIdentityComparer: DesktopAssemblyIdentityComparer.Default ); // Default debug info format for the current platform. DebugInformationFormat debugType = RuntimeInformation.IsOSPlatform (OSPlatform.Windows) ? DebugInformationFormat.Pdb : DebugInformationFormat.PortablePdb; |