diff options
Diffstat (limited to 'linker/Tests/Mono.Linker.Tests.Cases')
10 files changed, 71 insertions, 10 deletions
diff --git a/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs b/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs index 498c88378..a46a6deb5 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs @@ -4,7 +4,8 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.CoreLink { - [CoreLink ("copy")] + [SetupLinkerCoreAction ("copy")] + [KeptAssembly ("mscorlib.dll")] // These types are normally removed when the core libraries are linked [KeptTypeInAssembly ("mscorlib.dll", typeof (ConsoleKeyInfo))] diff --git a/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs b/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs index 5f2db3ddb..5a39b04aa 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs @@ -6,7 +6,7 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.CoreLink { - [CoreLink ("link")] + [SetupLinkerCoreAction ("link")] [KeptAssembly ("mscorlib.dll")] [KeptMemberInAssembly ("mscorlib.dll", typeof (Stack), ".ctor(System.Int32)", "Pop()", "Push(System.Object)")] diff --git a/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs b/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs index b7edac39e..9a0d90f53 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs @@ -4,7 +4,7 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.CoreLink { - [CoreLink ("link")] + [SetupLinkerCoreAction ("link")] [Reference("System.dll")] [KeptAssembly ("mscorlib.dll")] diff --git a/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj b/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj index 9601bca40..b293bb5fb 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj +++ b/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj @@ -138,6 +138,8 @@ <Compile Include="VirtualMethods\TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod.cs" /> <Compile Include="VirtualMethods\VirtualMethodGetsPerservedIfBaseMethodGetsInvoked.cs" /> <Compile Include="VirtualMethods\VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs" /> + <Compile Include="TypeForwarding\MissingTargetReference.cs" /> + <None Include="TypeForwarding\Dependencies\TypeForwarderMissingReference.il" /> </ItemGroup> <ItemGroup> <Content Include="LinkXml\TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.xml" /> diff --git a/linker/Tests/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs index d54ba5c21..f0a7a3f03 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs @@ -3,7 +3,7 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.References { - [CoreLink ("link")] + [SetupLinkerCoreAction ("link")] // Il8n & the blacklist step pollute the results with extra stuff that didn't need to be // preserved for this test case so we need to disable them [Il8n ("none")] diff --git a/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs b/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs index f26aaa3b5..35c2252f4 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs @@ -1,8 +1,10 @@ using System; +using System.Reflection; using Mono.Linker.Tests.Cases.Expectations.Metadata; +[assembly: AssemblyVersion ("2.0")] + namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies { - [NotATestCase] public class ImplementationLibrary { public string GetSomeValue () { diff --git a/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/TypeForwarderMissingReference.il b/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/TypeForwarderMissingReference.il new file mode 100644 index 000000000..0f8a1e93d --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/TypeForwarderMissingReference.il @@ -0,0 +1,37 @@ +.assembly extern mscorlib +{ +} +.assembly extern 'missing-reference' +{ + .ver 0:0:0:0 +} + +.assembly 'TypeForwarderMissingReference' +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} + +.class extern forwarder C +{ + .assembly extern 'missing-reference' +} +.class extern forwarder G`1 +{ + .assembly extern 'missing-reference' +} + +.module 'TypeForwarderMissingReference.dll' + + +.class public auto ansi beforefieldinit DummyClass + extends [mscorlib]System.Object +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } +}
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs b/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs new file mode 100644 index 000000000..07f43ef32 --- /dev/null +++ b/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs @@ -0,0 +1,23 @@ +using System; +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; + +namespace Mono.Linker.Tests.Cases.TypeForwarding +{ + [Define ("IL_ASSEMBLY_AVAILABLE")] + [SetupCompileBefore ("TypeForwarderMissingReference.dll", new [] { "Dependencies/TypeForwarderMissingReference.il" })] + [SetupLinkerAction ("link", "TypeForwarderMissingReference.dll")] + + [KeptMemberInAssembly ("TypeForwarderMissingReference.dll", "DummyClass", ".ctor()")] + [RemovedForwarder ("TypeForwarderMissingReference.dll", "C")] + [RemovedForwarder ("TypeForwarderMissingReference.dll", "G<>")] + public class MissingTargetReference + { + public static void Main () + { +#if IL_ASSEMBLY_AVAILABLE + Console.WriteLine (new DummyClass ()); +#endif + } + } +} diff --git a/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs b/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs index e986def6a..e8a41a259 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs @@ -13,13 +13,11 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding { [SetupCompileAfter ("Implementation.dll", new[] { "Dependencies/ImplementationLibrary.cs" })] [SetupCompileAfter ("Forwarder.dll", new[] { "Dependencies/ForwarderLibrary.cs" }, references: new[] { "Implementation.dll" })] - [KeptAssembly ("Library.dll")] - [KeptAssembly ("Implementation.dll")] [KeptAssembly ("Forwarder.dll")] [KeptMemberInAssembly ("Library.dll", typeof (LibraryUsingForwarder), "GetValueFromOtherAssembly()")] [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary), "GetSomeValue()")] public class TypeForwarderOnlyAssembliesKept { - static void Main () + public static void Main () { Console.WriteLine (new ImplementationLibrary ().GetSomeValue ()); Console.WriteLine (new LibraryUsingForwarder ().GetValueFromOtherAssembly ()); diff --git a/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesRemoved.cs b/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesRemoved.cs index 78c7fc571..91ddd58ee 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesRemoved.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesRemoved.cs @@ -14,8 +14,6 @@ namespace Mono.Linker.Tests.Cases.TypeForwarding [SetupCompileAfter ("Implementation.dll", new[] { "Dependencies/ImplementationLibrary.cs" })] [SetupCompileAfter ("Forwarder.dll", new[] { "Dependencies/ForwarderLibrary.cs" }, references: new[] { "Implementation.dll" })] - [KeptAssembly ("Library.dll")] - [KeptAssembly ("Implementation.dll")] [RemovedAssembly ("Forwarder.dll")] [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary), "GetSomeValue()")] [KeptMemberInAssembly ("Library.dll", typeof (LibraryUsingForwarder), "GetValueFromOtherAssembly()")] |