Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2017-04-21 12:15:13 +0300
committerMarek Safar <marek.safar@gmail.com>2017-04-21 12:21:26 +0300
commit9b8320a9ed4a9a02d8dbba6ee091fef160e2ff4c (patch)
treeccee82ee40273bbf08f4934f38cb3aba40ac832e /linker/Tests
parent03e35128150715b016f0bbc2d1e3502d91c228f5 (diff)
Revival of existing tests
Diffstat (limited to 'linker/Tests')
-rwxr-xr-xlinker/Tests/Libs/nunit-console-runner.dllbin16384 -> 0 bytes
-rwxr-xr-xlinker/Tests/Libs/nunit-console.exebin3072 -> 0 bytes
-rwxr-xr-xlinker/Tests/Libs/nunit-console.exe.config97
-rwxr-xr-xlinker/Tests/Libs/nunit.core.dllbin86016 -> 0 bytes
-rwxr-xr-xlinker/Tests/Libs/nunit.framework.dllbin45056 -> 0 bytes
-rwxr-xr-xlinker/Tests/Libs/nunit.util.dllbin86016 -> 0 bytes
-rw-r--r--linker/Tests/Makefile21
-rw-r--r--linker/Tests/Mono.Linker.Tests.csproj44
-rw-r--r--linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs68
-rw-r--r--linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs38
-rw-r--r--linker/Tests/Mono.Linker.Tests/LinkingTestFixture.cs (renamed from linker/Tests/Mono.Linker.Tests/AssemblyLinkingTestFixture.cs)16
-rw-r--r--linker/Tests/Mono.Linker.Tests/ResolveLinkedAssemblyStep.cs80
-rw-r--r--linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs33
-rw-r--r--linker/Tests/TestCases/Integration/HelloWorld/Test.cs9
-rwxr-xr-xlinker/Tests/TestCases/Integration/HelloWorld/Test.exebin3072 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/Generics/Library.cs61
-rw-r--r--linker/Tests/TestCases/Linker/Generics/Library.dllbin4096 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/Generics/Makefile4
-rw-r--r--linker/Tests/TestCases/Linker/Generics/desc.xml5
-rw-r--r--linker/Tests/TestCases/Linker/Interface/Library.cs26
-rw-r--r--linker/Tests/TestCases/Linker/Interface/Library.dllbin3072 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/Interface/Makefile4
-rw-r--r--linker/Tests/TestCases/Linker/Interface/desc.xml5
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs23
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/Bar.dllbin3072 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs20
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/Baz.dllbin3072 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs32
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/Foo.dllbin3072 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/Makefile9
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.cs5
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dllbin3072 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/Program.cs34
-rw-r--r--linker/Tests/TestCases/Linker/MultipleReferences/Program.exebin3072 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/NestedNested/Library.cs17
-rw-r--r--linker/Tests/TestCases/Linker/NestedNested/Library.dllbin3584 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/NestedNested/Makefile4
-rw-r--r--linker/Tests/TestCases/Linker/NestedNested/desc.xml5
-rw-r--r--linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.cs34
-rwxr-xr-xlinker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dllbin3584 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/PreserveFieldsRequired/Makefile4
-rw-r--r--linker/Tests/TestCases/Linker/PreserveFieldsRequired/desc.xml7
-rw-r--r--linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.cs23
-rwxr-xr-xlinker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dllbin3072 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.cs71
-rwxr-xr-xlinker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dllbin4096 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/ReferenceInAttributes/desc.xml5
-rw-r--r--linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.cs35
-rw-r--r--linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dllbin3584 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Makefile4
-rw-r--r--linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/desc.xml5
-rw-r--r--linker/Tests/TestCases/Linker/Simple/Library.cs64
-rw-r--r--linker/Tests/TestCases/Linker/Simple/Library.dllbin3584 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/Simple/Makefile5
-rw-r--r--linker/Tests/TestCases/Linker/Simple/Program.cs28
-rw-r--r--linker/Tests/TestCases/Linker/Simple/Program.exebin3072 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/SimpleXml/Library.cs44
-rw-r--r--linker/Tests/TestCases/Linker/SimpleXml/Library.dllbin3584 -> 0 bytes
-rw-r--r--linker/Tests/TestCases/Linker/SimpleXml/Makefile4
-rw-r--r--linker/Tests/TestCases/Linker/VirtualCall/Library.cs48
-rw-r--r--linker/Tests/TestCases/Linker/VirtualCall/Program.cs28
-rwxr-xr-xlinker/Tests/TestCases/Linker/XmlPattern/Library.cs36
-rwxr-xr-xlinker/Tests/TestCases/Linker/XmlPattern/Library.dllbin3584 -> 0 bytes
-rwxr-xr-xlinker/Tests/TestCases/Linker/XmlPattern/Makefile4
-rwxr-xr-xlinker/Tests/TestCases/Linker/XmlPattern/desc.xml7
-rw-r--r--linker/Tests/TestCases/MarkAttribute.cs9
-rw-r--r--linker/Tests/TestCases/NotLinkedAttribute.cs9
-rw-r--r--linker/Tests/TestCases/TestCases.csproj69
-rw-r--r--linker/Tests/TestCases/Xml/Generics/Library.cs61
-rw-r--r--linker/Tests/TestCases/Xml/Generics/desc.xml5
-rw-r--r--linker/Tests/TestCases/Xml/Interface/Library.cs29
-rw-r--r--linker/Tests/TestCases/Xml/Interface/desc.xml5
-rw-r--r--linker/Tests/TestCases/Xml/NestedNested/Library.cs19
-rw-r--r--linker/Tests/TestCases/Xml/NestedNested/desc.xml5
-rw-r--r--linker/Tests/TestCases/Xml/PreserveFieldsRequired/Library.cs35
-rw-r--r--linker/Tests/TestCases/Xml/PreserveFieldsRequired/desc.xml7
-rw-r--r--linker/Tests/TestCases/Xml/ReferenceInAttributes/LibLib.cs23
-rw-r--r--linker/Tests/TestCases/Xml/ReferenceInAttributes/Library.cs81
-rw-r--r--linker/Tests/TestCases/Xml/ReferenceInAttributes/desc.xml5
-rw-r--r--linker/Tests/TestCases/Xml/ReferenceInVirtualMethod/Library.cs37
-rw-r--r--linker/Tests/TestCases/Xml/ReferenceInVirtualMethod/desc.xml5
-rw-r--r--linker/Tests/TestCases/Xml/SimpleXml/Library.cs48
-rw-r--r--linker/Tests/TestCases/Xml/SimpleXml/desc.xml (renamed from linker/Tests/TestCases/Linker/SimpleXml/desc.xml)8
-rwxr-xr-xlinker/Tests/TestCases/Xml/XmlPattern/Library.cs36
-rwxr-xr-xlinker/Tests/TestCases/Xml/XmlPattern/desc.xml7
-rw-r--r--linker/Tests/TestCases/bin/Debug/TestCases.dllbin0 -> 10752 bytes
-rw-r--r--linker/Tests/TestCases/bin/Debug/TestCases.pdbbin0 -> 3888 bytes
-rw-r--r--linker/Tests/TestCases/config.make3
-rw-r--r--linker/Tests/packages.config4
89 files changed, 834 insertions, 792 deletions
diff --git a/linker/Tests/Libs/nunit-console-runner.dll b/linker/Tests/Libs/nunit-console-runner.dll
deleted file mode 100755
index f112e2322..000000000
--- a/linker/Tests/Libs/nunit-console-runner.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/Libs/nunit-console.exe b/linker/Tests/Libs/nunit-console.exe
deleted file mode 100755
index 32ca802e9..000000000
--- a/linker/Tests/Libs/nunit-console.exe
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/Libs/nunit-console.exe.config b/linker/Tests/Libs/nunit-console.exe.config
deleted file mode 100755
index 4926127eb..000000000
--- a/linker/Tests/Libs/nunit-console.exe.config
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<configuration>
- <!--
- Application settings for NUnit-console.exe. Do NOT put settings
- for use by your tests here.
- -->
- <appSettings>
-
- <!--
- Specify the location to be used by .NET for the cache
- -->
- <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" />
-
- </appSettings>
-
- <!--
- The startup section may be used to specify the runtime versions
- supported in the order that they will be used if more than one
- is present. As supplied, this section is commented out, which
- causes nunit-console to use the version of the framework with
- which it was built.
-
- Since .NET 1.0 does not recognize the <supportedRuntime> elements,
- a <requiredRuntime> element is used in case it is the only version
- of the framework that is installed.
- -->
- <!--
- <startup>
- <supportedRuntime version="v2.0.50727" />
- <supportedRuntime version="v2.0.50215" />
- <supportedRuntime version="v2.0.40607" />
- <supportedRuntime version="v1.1.4322" />
- <supportedRuntime version="v1.0.3705" />
-
- <requiredRuntime version="v1.0.3705" />
- </startup>
- -->
-
- <!--
- The following <runtime> section allows running nunit under
- .NET 1.0 by redirecting assemblies. The appliesTo attribute
- causes the section to be ignored except under .NET 1.0version 1
- on a machine with only the .NET version 1.0 runtime installed.
- If application and its tests were built for .NET 1.1 you will
- also need to redirect system assemblies in the test config file.
- -->
-
- <runtime>
-
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
- appliesTo="v1.0.3705">
-
- <dependentAssembly>
- <assemblyIdentity name="System"
- publicKeyToken="b77a5c561934e089"
- culture="neutral"/>
- <bindingRedirect oldVersion="1.0.5000.0"
- newVersion="1.0.3300.0"/>
- </dependentAssembly>
-
- <dependentAssembly>
- <assemblyIdentity name="System.Data"
- publicKeyToken="b77a5c561934e089"
- culture="neutral"/>
- <bindingRedirect oldVersion="1.0.5000.0"
- newVersion="1.0.3300.0"/>
- </dependentAssembly>
-
- <dependentAssembly>
- <assemblyIdentity name="System.Drawing"
- publicKeyToken="b03f5f7f11d50a3a"
- culture="neutral"/>
- <bindingRedirect oldVersion="1.0.5000.0"
- newVersion="1.0.3300.0"/>
- </dependentAssembly>
-
- <dependentAssembly>
- <assemblyIdentity name="System.Windows.Forms"
- publicKeyToken="b77a5c561934e089"
- culture="neutral"/>
- <bindingRedirect oldVersion="1.0.5000.0"
- newVersion="1.0.3300.0"/>
- </dependentAssembly>
-
- <dependentAssembly>
- <assemblyIdentity name="System.Xml"
- publicKeyToken="b77a5c561934e089"
- culture="neutral"/>
- <bindingRedirect oldVersion="1.0.5000.0"
- newVersion="1.0.3300.0"/>
- </dependentAssembly>
-
- </assemblyBinding>
-
- </runtime>
-
-</configuration> \ No newline at end of file
diff --git a/linker/Tests/Libs/nunit.core.dll b/linker/Tests/Libs/nunit.core.dll
deleted file mode 100755
index df7f9051c..000000000
--- a/linker/Tests/Libs/nunit.core.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/Libs/nunit.framework.dll b/linker/Tests/Libs/nunit.framework.dll
deleted file mode 100755
index 5316687ad..000000000
--- a/linker/Tests/Libs/nunit.framework.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/Libs/nunit.util.dll b/linker/Tests/Libs/nunit.util.dll
deleted file mode 100755
index e9e479ebc..000000000
--- a/linker/Tests/Libs/nunit.util.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/Makefile b/linker/Tests/Makefile
deleted file mode 100644
index 769a38ad5..000000000
--- a/linker/Tests/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-MCS = mcs
-
-all: Mono.Linker.Tests.dll
-
-Mono.Cecil.dll:
- cp ../Mono.Cecil.dll .
-
-monolinker.exe:
- cp ../monolinker.exe .
-
-Mono.Linker.Tests.dll.sources:
- find Mono.Linker.Tests -name "*.cs" > Mono.Linker.Tests.dll.sources
-
-Mono.Linker.Tests.dll: Mono.Cecil.dll monolinker.exe Mono.Linker.Tests.dll.sources
- $(MCS) /target:library /out:Mono.Linker.Tests.dll /r:nunitlite.dll /r:Mono.Cecil.dll /r:monolinker.exe @Mono.Linker.Tests.dll.sources
-
-clean:
- rm -rf Mono.Cecil.dll monolinker.exe Mono.Linker.Tests.dll.sources Mono.Linker.Tests.dll
-
-run-test: all
- nunit-console Mono.Linker.Tests.dll
diff --git a/linker/Tests/Mono.Linker.Tests.csproj b/linker/Tests/Mono.Linker.Tests.csproj
index a83021f1e..28069ab18 100644
--- a/linker/Tests/Mono.Linker.Tests.csproj
+++ b/linker/Tests/Mono.Linker.Tests.csproj
@@ -1,16 +1,15 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{400A1561-B6B6-482D-9E4C-3DDAEDE5BD07}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Mono.Linker.Tests</RootNamespace>
<AssemblyName>Mono.Linker.Tests</AssemblyName>
<StartupObject>
</StartupObject>
+ <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -38,32 +37,39 @@
</Target>
-->
<ItemGroup>
- <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>Libs\nunit.framework.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\class\Mono.Cecil\Mono.Cecil.csproj">
- <Project>{D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}</Project>
- <Name>Mono.Cecil</Name>
- </ProjectReference>
- <ProjectReference Include="..\Mono.Linker.csproj">
- <Project>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</Project>
- <Name>Mono.Linker</Name>
- </ProjectReference>
+ <Reference Include="System.Core" />
+ <Reference Include="nunit.framework">
+ <HintPath>packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Mono.Linker.Tests\AbstractLinkingTestFixture.cs" />
<Compile Include="Mono.Linker.Tests\AbstractTestFixture.cs" />
- <Compile Include="Mono.Linker.Tests\AssemblyLinkingTestFixture.cs" />
+ <Compile Include="Mono.Linker.Tests\LinkingTestFixture.cs" />
<Compile Include="Mono.Linker.Tests\AssemblyInfo.cs" />
- <Compile Include="Mono.Linker.Tests\IntegrationTestFixture.cs" />
<Compile Include="Mono.Linker.Tests\XmlLinkingTestFixture.cs" />
+ <Compile Include="Mono.Linker.Tests\ResolveLinkedAssemblyStep.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Mono.Linker.csproj">
+ <Project>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</Project>
+ <Name>Mono.Linker</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\cecil\Mono.Cecil.csproj">
+ <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
+ <Name>Mono.Cecil</Name>
+ </ProjectReference>
+ <ProjectReference Include="TestCases\TestCases.csproj">
+ <Project>{26D857FB-EEE3-4A5B-95BC-DAB39F880A99}</Project>
+ <Name>TestCases</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs b/linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs
index 58dc1a551..d25aeab32 100644
--- a/linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs
+++ b/linker/Tests/Mono.Linker.Tests/AbstractLinkingTestFixture.cs
@@ -1,4 +1,4 @@
-//
+//
// AbstractLinkingTestFixture.cs
//
// Author:
@@ -30,10 +30,14 @@ using System.IO;
using Mono.Cecil;
using Mono.Linker.Steps;
using NUnit.Framework;
+using System.Linq;
+using System.Collections.Generic;
-namespace Mono.Linker.Tests {
+namespace Mono.Linker.Tests
+{
- public abstract class AbstractLinkingTestFixture : AbstractTestFixture {
+ public abstract class AbstractLinkingTestFixture : AbstractTestFixture
+ {
[SetUp]
public override void SetUp ()
@@ -90,39 +94,49 @@ namespace Mono.Linker.Tests {
void Compare ()
{
+ bool compared = false;
foreach (AssemblyDefinition assembly in Context.GetAssemblies ()) {
- if (Annotations.GetAction (assembly) != AssemblyAction.Link)
+ if (Context.Annotations.GetAction (assembly) != AssemblyAction.Link)
continue;
string fileName = GetAssemblyFileName (assembly);
- CompareAssemblies (
- AssemblyFactory.GetAssembly (
- Path.Combine (GetTestCasePath (), fileName)),
- AssemblyFactory.GetAssembly (
- Path.Combine (GetOutputPath (), fileName)));
+ var original = AssemblyDefinition.ReadAssembly (Path.Combine (GetTestCasePath (), fileName));
+ var linked = AssemblyDefinition.ReadAssembly (Path.Combine (GetOutputPath (), fileName));
+ compared = CompareAssemblies (original, linked);
}
+
+ Assert.IsTrue (compared, $"No data compared (are you missing '{TestCase}' namespace for the test case?)");
}
- static void CompareAssemblies (AssemblyDefinition original, AssemblyDefinition linked)
+ bool CompareAssemblies (AssemblyDefinition original, AssemblyDefinition linked)
{
+ bool compared = false;
foreach (TypeDefinition originalType in original.MainModule.Types) {
- TypeDefinition linkedType = linked.MainModule.Types [originalType.FullName];
- if (NotLinked (originalType)) {
- Assert.IsNull (linkedType, string.Format ("Type `{0}' should not have been linked", originalType));
+ if (!originalType.FullName.StartsWith (TestCase, System.StringComparison.Ordinal))
+ continue;
+
+ compared = true;
+
+ TypeDefinition linkedType = linked.MainModule.Types.FirstOrDefault (l => l.FullName == originalType.FullName);
+ if (MustBeLinked (originalType)) {
+ Assert.IsNull (linkedType, string.Format ("Type `{0}' was not linked", originalType));
continue;
}
- Assert.IsNotNull (linkedType, string.Format ("Type `{0}' should have been linked", originalType));
+ Assert.IsNotNull (linkedType, string.Format ("Type `{0}' was linked", originalType));
CompareTypes (originalType, linkedType);
}
+
+ return compared;
}
static void CompareTypes (TypeDefinition type, TypeDefinition linkedType)
{
foreach (FieldDefinition originalField in type.Fields) {
- FieldDefinition linkedField = linkedType.Fields.GetField (originalField.Name);// TODO: also get with the type!
- if (NotLinked (originalField)) {
+ IEnumerable<FieldDefinition> fd = linkedType.Fields;
+ FieldDefinition linkedField = fd.FirstOrDefault (l => l.Name == originalField.Name);// TODO: also get with the type!
+ if (MustBeLinked (originalField)) {
Assert.IsNull (linkedField, string.Format ("Field `{0}' should not have been linked", originalField));
continue;
}
@@ -130,31 +144,21 @@ namespace Mono.Linker.Tests {
Assert.IsNotNull (linkedField, string.Format ("Field `{0}' should have been linked", originalField));
}
- foreach (MethodDefinition originalCtor in type.Constructors) {
- MethodDefinition linkedCtor = linkedType.Constructors.GetConstructor (originalCtor.IsStatic, originalCtor.Parameters);
- if (NotLinked (originalCtor)) {
- Assert.IsNull (linkedCtor, string.Format ("Constructor `{0}' should not have been linked", originalCtor));
- continue;
- }
-
- Assert.IsNotNull (linkedCtor, string.Format ("Constructor `{0}' should have been linked", originalCtor));
- }
-
foreach (MethodDefinition originalMethod in type.Methods) {
- MethodDefinition linkedMethod = linkedType.Methods.GetMethod (originalMethod.Name, originalMethod.Parameters);
- if (NotLinked (originalMethod)) {
- Assert.IsNull (linkedMethod, string.Format ("Method `{0}' should not have been linked", originalMethod));
+ MethodDefinition linkedMethod = linkedType.Methods.FirstOrDefault (l => l.Name == originalMethod.Name && l.Parameters.Count == originalMethod.Parameters.Count); // TODO: lame
+ if (MustBeLinked (originalMethod)) {
+ Assert.IsNull (linkedMethod, string.Format ("Method `{0}' was not linked", originalMethod));
continue;
}
- Assert.IsNotNull (linkedMethod, string.Format ("Method `{0}' should have been linked", originalMethod));
+ Assert.IsNotNull (linkedMethod, string.Format ("Method `{0}' was linked", originalMethod));
}
}
- static bool NotLinked(ICustomAttributeProvider provider)
+ static bool MustBeLinked (ICustomAttributeProvider provider)
{
foreach (CustomAttribute ca in provider.CustomAttributes)
- if (ca.Constructor.DeclaringType.Name == "NotLinkedAttribute")
+ if (ca.Constructor.DeclaringType.Name == "AssertLinkedAttribute")
return true;
return false;
diff --git a/linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs b/linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs
index f4ac2d5a3..1ea047d73 100644
--- a/linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs
+++ b/linker/Tests/Mono.Linker.Tests/AbstractTestFixture.cs
@@ -1,4 +1,4 @@
-//
+//
// AbstractTestFixture.cs
//
// Author:
@@ -26,16 +26,17 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-namespace Mono.Linker.Tests {
+using System.IO;
- using System;
- using System.IO;
+using Mono.Cecil;
- using Mono.Cecil;
+using NUnit.Framework;
- using NUnit.Framework;
+namespace Mono.Linker.Tests
+{
- public abstract class AbstractTestFixture {
+ public abstract class AbstractTestFixture
+ {
string _testCasesRoot;
string _testCase;
@@ -95,18 +96,7 @@ namespace Mono.Linker.Tests {
protected string GetTestCasePath ()
{
- return Path.Combine (
- Path.Combine (
-#if DEBUG
- Path.Combine (Environment.CurrentDirectory,
- Path.Combine ("..", "..")),
-#else
- Environment.CurrentDirectory,
-#endif
- "TestCases"),
- Path.Combine (
- _testCasesRoot,
- _testCase));
+ return Path.GetDirectoryName (GetType ().Assembly.Location);
}
protected virtual void RunTest (string testCase)
@@ -117,18 +107,12 @@ namespace Mono.Linker.Tests {
protected virtual void Run ()
{
- string cd = Environment.CurrentDirectory;
- Environment.CurrentDirectory = GetTestCasePath ();
- try {
- _pipeline.Process (_context);
- } finally {
- Environment.CurrentDirectory = cd;
- }
+ _pipeline.Process (_context);
}
protected static string GetAssemblyFileName (AssemblyDefinition asm)
{
- return asm.Name.Name + (asm.Kind == AssemblyKind.Dll ? ".dll" : ".exe");
+ return asm.Name.Name + (asm.MainModule.Kind == ModuleKind.Dll ? ".dll" : ".exe");
}
}
}
diff --git a/linker/Tests/Mono.Linker.Tests/AssemblyLinkingTestFixture.cs b/linker/Tests/Mono.Linker.Tests/LinkingTestFixture.cs
index 4810cd1b7..6201f4885 100644
--- a/linker/Tests/Mono.Linker.Tests/AssemblyLinkingTestFixture.cs
+++ b/linker/Tests/Mono.Linker.Tests/LinkingTestFixture.cs
@@ -1,4 +1,4 @@
-//
+//
// AssemblyLinkingTestFixture.cs
//
// Author:
@@ -27,14 +27,12 @@
//
using System.IO;
-
-using Mono.Linker.Steps;
using NUnit.Framework;
namespace Mono.Linker.Tests {
[TestFixture]
- public class AssemblyLinkingTestFixture : AbstractLinkingTestFixture {
+ public class LinkingTestFixture : AbstractLinkingTestFixture {
[Test]
public void TestSimple ()
@@ -56,10 +54,12 @@ namespace Mono.Linker.Tests {
protected override void RunTest (string testCase)
{
- base.RunTest (testCase);
- Pipeline.PrependStep (
- new ResolveFromAssemblyStep (
- Path.Combine (GetTestCasePath (), "Program.exe")));
+ var fullTestCaseName = "TestCases.Linker." + testCase;
+ base.RunTest (fullTestCaseName);
+
+ var step = new ResolveLinkedAssemblyStep (fullTestCaseName, Path.Combine (GetTestCasePath (), "TestCases.dll"));
+
+ Pipeline.PrependStep (step);
Run ();
}
diff --git a/linker/Tests/Mono.Linker.Tests/ResolveLinkedAssemblyStep.cs b/linker/Tests/Mono.Linker.Tests/ResolveLinkedAssemblyStep.cs
new file mode 100644
index 000000000..7610288a2
--- /dev/null
+++ b/linker/Tests/Mono.Linker.Tests/ResolveLinkedAssemblyStep.cs
@@ -0,0 +1,80 @@
+using Mono.Linker.Steps;
+using Mono.Cecil;
+using System.Linq;
+using Mono.Collections.Generic;
+
+namespace Mono.Linker.Tests
+{
+ class ResolveLinkedAssemblyStep : ResolveFromAssemblyStep
+ {
+ string testCase;
+
+ public ResolveLinkedAssemblyStep (string testCase, string assembly)
+ : base (assembly)
+ {
+ this.testCase = testCase;
+ }
+
+ protected override void ProcessLibrary (AssemblyDefinition assembly)
+ {
+ SetAction (Context, assembly, AssemblyAction.Link);
+
+ Annotations.Push (assembly);
+
+ foreach (TypeDefinition type in assembly.MainModule.Types)
+ MarkType (type);
+
+ Annotations.Pop ();
+ }
+
+ static bool MarkMember (ICustomAttributeProvider member)
+ {
+ if (!member.HasCustomAttributes)
+ return false;
+
+ return member.CustomAttributes.Any (l => l.AttributeType.FullName == "TestCases.MarkAttribute");
+ }
+
+ void MarkType (TypeDefinition type)
+ {
+ if (type.Namespace != testCase)
+ return;
+
+ if (MarkMember (type))
+ Annotations.Mark (type);
+
+ Annotations.Push (type);
+
+ if (type.HasFields)
+ MarkFields (type.Fields);
+ if (type.HasMethods)
+ MarkMethods (type.Methods);
+ if (type.HasNestedTypes)
+ foreach (var nested in type.NestedTypes)
+ MarkType (nested);
+
+ Annotations.Pop ();
+ }
+
+ void MarkFields (Collection<FieldDefinition> fields)
+ {
+ foreach (var field in fields) {
+ if (MarkMember (field)) {
+ Annotations.Mark (field.DeclaringType);
+ Annotations.Mark (field);
+ }
+ }
+ }
+
+ void MarkMethods (Collection<MethodDefinition> methods)
+ {
+ foreach (MethodDefinition method in methods) {
+ if (MarkMember(method)) {
+ Annotations.Mark (method.DeclaringType);
+ Annotations.Mark (method);
+ Annotations.SetAction (method, MethodAction.Parse);
+ }
+ }
+ }
+ }
+}
diff --git a/linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs b/linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs
index 1e89290ef..c87b05f3b 100644
--- a/linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs
+++ b/linker/Tests/Mono.Linker.Tests/XmlLinkingTestFixture.cs
@@ -1,4 +1,4 @@
-//
+//
// XmlLinkingTestFixture.cs
//
// Author:
@@ -26,13 +26,13 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System;
using System.IO;
using System.Xml.XPath;
using Mono.Linker.Steps;
using NUnit.Framework;
-
namespace Mono.Linker.Tests {
[TestFixture]
@@ -88,12 +88,31 @@ namespace Mono.Linker.Tests {
protected override void RunTest (string testCase)
{
- base.RunTest (testCase);
- Pipeline.PrependStep (
- new ResolveFromXmlStep (
- new XPathDocument (Path.Combine (GetTestCasePath (), "desc.xml"))));
+ var fullTestCaseName = "TestCases.Xml." + testCase;
+ string resourceName = fullTestCaseName + ".desc.xml";
+
+ var ms = new MemoryStream ();
+ var assembly = typeof (TestCases.AssertLinkedAttribute).Assembly;
+ using (Stream stream = assembly.GetManifestResourceStream (resourceName)) {
+ Assert.IsNotNull (stream, "Missing embedded desc.xml");
+ using (StreamReader reader = new StreamReader (stream)) {
+ stream.CopyTo (ms);
+ }
+ }
+
+ ms.Seek (0, SeekOrigin.Begin);
+
+ base.RunTest (fullTestCaseName);
+
+ Pipeline.PrependStep (new ResolveFromXmlStep (new XPathDocument (ms)));
- Run ();
+ string cd = Environment.CurrentDirectory;
+ Environment.CurrentDirectory = GetTestCasePath ();
+ try {
+ Run ();
+ } finally {
+ Environment.CurrentDirectory = cd;
+ }
}
}
}
diff --git a/linker/Tests/TestCases/Integration/HelloWorld/Test.cs b/linker/Tests/TestCases/Integration/HelloWorld/Test.cs
deleted file mode 100644
index 4a65b4401..000000000
--- a/linker/Tests/TestCases/Integration/HelloWorld/Test.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System;
-
-class Test {
-
- static void Main ()
- {
- Console.WriteLine ("Hello world!");
- }
-}
diff --git a/linker/Tests/TestCases/Integration/HelloWorld/Test.exe b/linker/Tests/TestCases/Integration/HelloWorld/Test.exe
deleted file mode 100755
index 2f4f4c9dc..000000000
--- a/linker/Tests/TestCases/Integration/HelloWorld/Test.exe
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/Generics/Library.cs b/linker/Tests/TestCases/Linker/Generics/Library.cs
deleted file mode 100644
index 75fe1ed36..000000000
--- a/linker/Tests/TestCases/Linker/Generics/Library.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-
-public class Foo {
-
- void Bar ()
- {
- int i = 42;
- string s = "hey";
-
- Baz<int> bi = new Baz<int> (i);
- bi.Gazonk ();
- bi.Bat<string>(i, s);
-
- Baz<string> bs = new Baz<string> (s);
- bs.Gazonk ();
- bs.Bat<int>(s, i);
- bs.BiroBiro ();
-
- bs.Blam<Bang> ();
- }
-}
-
-public class Baz<T> {
-
- T _t;
-
- public Baz (T t)
- {
- _t = t;
- }
-
- public void Gazonk ()
- {
- Console.WriteLine (_t);
- }
-
- public void Bat<M> (T t, M m)
- {
- Console.WriteLine ("{0}{1}", t, m);
- }
-
- public void Blam<M> ()
- {
- }
-
- public T [] BiroBiro ()
- {
- return new T [0];
- }
-}
-
-class Bang {
-
- [NotLinked] public Bang ()
- {
- }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/linker/Tests/TestCases/Linker/Generics/Library.dll b/linker/Tests/TestCases/Linker/Generics/Library.dll
deleted file mode 100644
index fe5cab177..000000000
--- a/linker/Tests/TestCases/Linker/Generics/Library.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/Generics/Makefile b/linker/Tests/TestCases/Linker/Generics/Makefile
deleted file mode 100644
index 2e5bf5bcf..000000000
--- a/linker/Tests/TestCases/Linker/Generics/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
diff --git a/linker/Tests/TestCases/Linker/Generics/desc.xml b/linker/Tests/TestCases/Linker/Generics/desc.xml
deleted file mode 100644
index 0dd61b9b3..000000000
--- a/linker/Tests/TestCases/Linker/Generics/desc.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- </assembly>
-</linker>
diff --git a/linker/Tests/TestCases/Linker/Interface/Library.cs b/linker/Tests/TestCases/Linker/Interface/Library.cs
deleted file mode 100644
index 7aa939469..000000000
--- a/linker/Tests/TestCases/Linker/Interface/Library.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-
-public class Foo : IFoo {
-
- public void Gazonk ()
- {
- }
-}
-
-public interface IFoo : IBar {
-}
-
-public interface IBar {
-
- void Gazonk ();
-}
-
-[NotLinked] public class Baz : IBaz {
-}
-
-[NotLinked] public interface IBaz {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/linker/Tests/TestCases/Linker/Interface/Library.dll b/linker/Tests/TestCases/Linker/Interface/Library.dll
deleted file mode 100644
index 2ae8b9239..000000000
--- a/linker/Tests/TestCases/Linker/Interface/Library.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/Interface/Makefile b/linker/Tests/TestCases/Linker/Interface/Makefile
deleted file mode 100644
index 2e5bf5bcf..000000000
--- a/linker/Tests/TestCases/Linker/Interface/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
diff --git a/linker/Tests/TestCases/Linker/Interface/desc.xml b/linker/Tests/TestCases/Linker/Interface/desc.xml
deleted file mode 100644
index 0dd61b9b3..000000000
--- a/linker/Tests/TestCases/Linker/Interface/desc.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- </assembly>
-</linker>
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs b/linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs
index c2f0df4fd..371d7e109 100644
--- a/linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs
+++ b/linker/Tests/TestCases/Linker/MultipleReferences/Bar.cs
@@ -1,15 +1,18 @@
-using System;
+using System;
-public class Bar {
-
- string bang = "bang !";
-
- public Bar ()
+namespace TestCases.Linker.MultipleReferences
+{
+ public class Bar
{
- }
+ string bang = "bang !";
- public void Bang ()
- {
- Console.WriteLine (bang);
+ public Bar ()
+ {
+ }
+
+ public void Bang ()
+ {
+ Console.WriteLine (bang);
+ }
}
}
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll b/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll
deleted file mode 100644
index 159106da8..000000000
--- a/linker/Tests/TestCases/Linker/MultipleReferences/Bar.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs b/linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs
index ab5241ccf..8dc3ad8b5 100644
--- a/linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs
+++ b/linker/Tests/TestCases/Linker/MultipleReferences/Baz.cs
@@ -1,13 +1,15 @@
-using System;
-
-public class Baz {
-
- public void Chain (Foo f)
+namespace TestCases.Linker.MultipleReferences
+{
+ public class Baz
{
- f.b.Bang ();
- }
+ public void Chain (Foo f)
+ {
+ f.b.Bang ();
+ }
- [NotLinked] public void Lurman ()
- {
+ [AssertLinked]
+ public void Lurman ()
+ {
+ }
}
}
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll b/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll
deleted file mode 100644
index 977b20f02..000000000
--- a/linker/Tests/TestCases/Linker/MultipleReferences/Baz.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs b/linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs
index 746a2b26f..78eaddd45 100644
--- a/linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs
+++ b/linker/Tests/TestCases/Linker/MultipleReferences/Foo.cs
@@ -1,20 +1,22 @@
-using System;
-
-public class Foo {
-
- public Bar b;
-
- public Foo (Bar b)
+namespace TestCases.Linker.MultipleReferences
+{
+ public class Foo
{
- this.b = b;
- }
+ public Bar b;
- public void UseBar ()
- {
- b.Bang ();
- }
+ public Foo (Bar b)
+ {
+ this.b = b;
+ }
- [NotLinked] public void Blam ()
- {
+ public void UseBar ()
+ {
+ b.Bang ();
+ }
+
+ [AssertLinked]
+ public void Blam ()
+ {
+ }
}
}
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll b/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll
deleted file mode 100644
index 54e10fe53..000000000
--- a/linker/Tests/TestCases/Linker/MultipleReferences/Foo.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/Makefile b/linker/Tests/TestCases/Linker/MultipleReferences/Makefile
deleted file mode 100644
index 9f56e6ea3..000000000
--- a/linker/Tests/TestCases/Linker/MultipleReferences/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-include ../../config.make
-
-all:
- MCS /t:library NotLinkedAttribute.cs
- MCS /t:library Bar.cs
- MCS /t:library /r:Bar.dll /r:NotLinkedAttribute.dll Foo.cs
- MCS /t:library /r:Foo.dll /r:Bar.dll /r:NotLinkedAttribute.dll Baz.cs
- MCS /t:library /r:Foo.dll /r:Bar.dll /r:NotLinkedAttribute.dll Baz.cs
- MCS /r:Foo.dll /r:Bar.dll /r:Baz.dll /r:NotLinkedAttribute Program.cs
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.cs b/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.cs
deleted file mode 100644
index 52903442d..000000000
--- a/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-using System;
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll b/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll
deleted file mode 100644
index 06929d0b9..000000000
--- a/linker/Tests/TestCases/Linker/MultipleReferences/NotLinkedAttribute.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/Program.cs b/linker/Tests/TestCases/Linker/MultipleReferences/Program.cs
index 4e1debd9d..2b4be8d27 100644
--- a/linker/Tests/TestCases/Linker/MultipleReferences/Program.cs
+++ b/linker/Tests/TestCases/Linker/MultipleReferences/Program.cs
@@ -1,21 +1,23 @@
-using System;
-
-public class Program {
-
- public static int Main ()
+namespace TestCases.Linker.MultipleReferences
+{
+ public class Program
{
- Program p = new Program ();
- p.Run ();
+ [Mark]
+ public static int Main ()
+ {
+ Program p = new Program ();
+ p.Run ();
- return 0;
- }
+ return 0;
+ }
- void Run ()
- {
- Foo f = new Foo (new Bar ());
- f.UseBar ();
+ void Run ()
+ {
+ Foo f = new Foo (new Bar ());
+ f.UseBar ();
- Baz b = new Baz ();
- b.Chain (f);
+ Baz b = new Baz ();
+ b.Chain (f);
+ }
}
-}
+} \ No newline at end of file
diff --git a/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe b/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe
deleted file mode 100644
index c8e7597a1..000000000
--- a/linker/Tests/TestCases/Linker/MultipleReferences/Program.exe
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/NestedNested/Library.cs b/linker/Tests/TestCases/Linker/NestedNested/Library.cs
deleted file mode 100644
index 139116244..000000000
--- a/linker/Tests/TestCases/Linker/NestedNested/Library.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-
-public class Foo {
-}
-
-[NotLinked] public class Bar {
-
- [NotLinked] public class Baz {
-
- [NotLinked] public class Gazonk {
- }
- }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/linker/Tests/TestCases/Linker/NestedNested/Library.dll b/linker/Tests/TestCases/Linker/NestedNested/Library.dll
deleted file mode 100644
index 49151f106..000000000
--- a/linker/Tests/TestCases/Linker/NestedNested/Library.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/NestedNested/Makefile b/linker/Tests/TestCases/Linker/NestedNested/Makefile
deleted file mode 100644
index 2e5bf5bcf..000000000
--- a/linker/Tests/TestCases/Linker/NestedNested/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
diff --git a/linker/Tests/TestCases/Linker/NestedNested/desc.xml b/linker/Tests/TestCases/Linker/NestedNested/desc.xml
deleted file mode 100644
index 0dd61b9b3..000000000
--- a/linker/Tests/TestCases/Linker/NestedNested/desc.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- </assembly>
-</linker>
diff --git a/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.cs b/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.cs
deleted file mode 100644
index 63a5ee7e2..000000000
--- a/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-
-public class Foo {
-
- public Foo ()
- {
- new NotRequiredButUsedNotPreserved ();
- new NotRequiredButUsedAndFieldsPreserved ();
- }
-}
-
-public class NotRequiredButUsedNotPreserved {
-
- [NotLinked] public int foo;
- [NotLinked] public int bar;
-}
-
-public class NotRequiredButUsedAndFieldsPreserved {
-
- public int foo;
- public int bar;
-
- [NotLinked] public int FooBar ()
- {
- return foo + bar;
- }
-}
-
-[NotLinked] public class NotRequiredAndNotUsed {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll b/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll
deleted file mode 100755
index 941d6c39d..000000000
--- a/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Library.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Makefile b/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Makefile
deleted file mode 100644
index 2e5bf5bcf..000000000
--- a/linker/Tests/TestCases/Linker/PreserveFieldsRequired/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
diff --git a/linker/Tests/TestCases/Linker/PreserveFieldsRequired/desc.xml b/linker/Tests/TestCases/Linker/PreserveFieldsRequired/desc.xml
deleted file mode 100644
index 979d4e05c..000000000
--- a/linker/Tests/TestCases/Linker/PreserveFieldsRequired/desc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- <type fullname="NotRequiredButUsedNotPreserved" preserve="nothing" required="false" />
- <type fullname="NotRequiredButUsedAndFieldsPreserved" preserve="fields" required="false" />
- </assembly>
-</linker>
diff --git a/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.cs b/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.cs
deleted file mode 100644
index 6ca5a7f13..000000000
--- a/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-
-namespace LibLib {
-
- public class LibLibAttribute : Attribute {
-
- public Type LibLibType {
- [NotLinked] get { return null; }
- set {}
- }
- }
-
- public class BilBil {
-
- [NotLinked] public BilBil ()
- {
- }
- }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-class NotLinkedAttribute : Attribute {
-}
diff --git a/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll b/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll
deleted file mode 100755
index 2f1e45788..000000000
--- a/linker/Tests/TestCases/Linker/ReferenceInAttributes/LibLib.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.cs b/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.cs
deleted file mode 100644
index cb3903f3c..000000000
--- a/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using LibLib;
-
-public class BarAttribute : Attribute {
-
- public BarAttribute ()
- {
- }
-
- public BarAttribute (Type type)
- {
- }
-
- public Type FieldType;
-
- public Type PropertyType {
- [NotLinked] get { return null; }
- set {}
- }
-}
-
-[Bar (typeof (Guy_A))]
-public class Foo {
-
- [Bar (FieldType = typeof (Guy_B))]
- public Foo a;
-
- [Bar (PropertyType = typeof (Guy_C))]
- public Foo b;
-
- [LibLib (LibLibType = typeof (BilBil))]
- public Foo c;
-
- [LibLib (LibLibType = typeof (Guy_D))]
- public Foo d;
-}
-
-public class Guy_A {
-
- [NotLinked] public Guy_A ()
- {
- }
-}
-
-public class Guy_B {
-
- [NotLinked] public Guy_B ()
- {
- }
-}
-
-public class Guy_C {
-
- [NotLinked] public Guy_C ()
- {
- }
-}
-
-public class Guy_D {
-
- [NotLinked] public Guy_D ()
- {
- }
-}
-
-[NotLinked] public class Baz {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-class NotLinkedAttribute : Attribute {
-}
diff --git a/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll b/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll
deleted file mode 100755
index 7c5b99700..000000000
--- a/linker/Tests/TestCases/Linker/ReferenceInAttributes/Library.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/ReferenceInAttributes/desc.xml b/linker/Tests/TestCases/Linker/ReferenceInAttributes/desc.xml
deleted file mode 100644
index 0dd61b9b3..000000000
--- a/linker/Tests/TestCases/Linker/ReferenceInAttributes/desc.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- </assembly>
-</linker>
diff --git a/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.cs b/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.cs
deleted file mode 100644
index 8b840b4cc..000000000
--- a/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-
-using System;
-
-public class Foo {
-
- public void Do ()
- {
- Bar b = new Baz ();
- b.Bang ();
- }
-}
-
-public class Bar {
-
- public virtual void Bang ()
- {
- }
-}
-
-public class Baz : Bar {
-
- private string _hey;
-
- public string Hey {
- [NotLinked] get { return _hey; }
- [NotLinked] set { _hey = value; }
- }
-
- public override void Bang ()
- {
- Console.WriteLine (_hey);
- }
-}
-
-[NotLinked] public class NotLinkedAttribute : Attribute {} \ No newline at end of file
diff --git a/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll b/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll
deleted file mode 100644
index b56fa604f..000000000
--- a/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Library.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Makefile b/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Makefile
deleted file mode 100644
index 2e5bf5bcf..000000000
--- a/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
diff --git a/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/desc.xml b/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/desc.xml
deleted file mode 100644
index 0dd61b9b3..000000000
--- a/linker/Tests/TestCases/Linker/ReferenceInVirtualMethod/desc.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo" />
- </assembly>
-</linker>
diff --git a/linker/Tests/TestCases/Linker/Simple/Library.cs b/linker/Tests/TestCases/Linker/Simple/Library.cs
index 538205a7c..69f171375 100644
--- a/linker/Tests/TestCases/Linker/Simple/Library.cs
+++ b/linker/Tests/TestCases/Linker/Simple/Library.cs
@@ -1,37 +1,39 @@
-using System;
+using System;
-public class Library {
-
- private int _pouet;
- [NotLinked] private int _hey;
-
- public Library ()
- {
- _pouet = 1;
- }
-
- [NotLinked] public Library (int pouet)
+namespace TestCases.Linker.Simple
+{
+ public class Library
{
- _pouet = pouet;
+ private int _pouet;
+ [AssertLinked] private int _hey;
+
+ public Library ()
+ {
+ _pouet = 1;
+ }
+
+ [AssertLinked]
+ public Library (int pouet)
+ {
+ _pouet = pouet;
+ }
+
+ public int Hello ()
+ {
+ Console.WriteLine ("Hello");
+ return _pouet;
+ }
+
+ [AssertLinked]
+ public void Hey (int hey)
+ {
+ _hey = hey;
+ Console.WriteLine (_hey);
+ }
}
- public int Hello ()
+ [AssertLinked]
+ public class Toy
{
- Console.WriteLine ("Hello");
- return _pouet;
}
-
- [NotLinked] public void Hey (int hey)
- {
- _hey = hey;
- Console.WriteLine (_hey);
- }
-}
-
-
-[NotLinked] public class Toy {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+} \ No newline at end of file
diff --git a/linker/Tests/TestCases/Linker/Simple/Library.dll b/linker/Tests/TestCases/Linker/Simple/Library.dll
deleted file mode 100644
index 5225e8868..000000000
--- a/linker/Tests/TestCases/Linker/Simple/Library.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/Simple/Makefile b/linker/Tests/TestCases/Linker/Simple/Makefile
deleted file mode 100644
index 356b52945..000000000
--- a/linker/Tests/TestCases/Linker/Simple/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
- MCS /r:Library.dll Program.cs
diff --git a/linker/Tests/TestCases/Linker/Simple/Program.cs b/linker/Tests/TestCases/Linker/Simple/Program.cs
index 6d3adb749..9e5c67e58 100644
--- a/linker/Tests/TestCases/Linker/Simple/Program.cs
+++ b/linker/Tests/TestCases/Linker/Simple/Program.cs
@@ -1,16 +1,18 @@
-using System;
-
-public class Program {
-
- public static int Main ()
+namespace TestCases.Linker.Simple
+{
+ public class Program
{
- Program p = new Program ();
- return p.Run ();
- }
+ [Mark]
+ public static int Test ()
+ {
+ Program p = new Program ();
+ return p.Run ();
+ }
- int Run ()
- {
- Library lib = new Library ();
- return lib.Hello ();
+ int Run ()
+ {
+ Library lib = new Library ();
+ return lib.Hello ();
+ }
}
-}
+} \ No newline at end of file
diff --git a/linker/Tests/TestCases/Linker/Simple/Program.exe b/linker/Tests/TestCases/Linker/Simple/Program.exe
deleted file mode 100644
index 1605ce0ba..000000000
--- a/linker/Tests/TestCases/Linker/Simple/Program.exe
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/SimpleXml/Library.cs b/linker/Tests/TestCases/Linker/SimpleXml/Library.cs
deleted file mode 100644
index 4e81b428a..000000000
--- a/linker/Tests/TestCases/Linker/SimpleXml/Library.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-
-public class Foo {
-
- int _baz;
- [NotLinked] int _shebang;
-
- public Foo ()
- {
- _baz = 42;
- }
-
- public int Baz ()
- {
- return _baz;
- }
-
- [NotLinked] public int Shebang (int bang)
- {
- return _shebang = bang * 2;
- }
-}
-
-public class Bar {
-
- int _truc;
-
- public Bar ()
- {
- _truc = 12;
- }
-
- public int Truc ()
- {
- return _truc;
- }
-}
-
-[NotLinked] public class Gazonk {
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/linker/Tests/TestCases/Linker/SimpleXml/Library.dll b/linker/Tests/TestCases/Linker/SimpleXml/Library.dll
deleted file mode 100644
index c37c05985..000000000
--- a/linker/Tests/TestCases/Linker/SimpleXml/Library.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/SimpleXml/Makefile b/linker/Tests/TestCases/Linker/SimpleXml/Makefile
deleted file mode 100644
index 2e5bf5bcf..000000000
--- a/linker/Tests/TestCases/Linker/SimpleXml/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
diff --git a/linker/Tests/TestCases/Linker/VirtualCall/Library.cs b/linker/Tests/TestCases/Linker/VirtualCall/Library.cs
index b9c3f02f1..c2dae1f81 100644
--- a/linker/Tests/TestCases/Linker/VirtualCall/Library.cs
+++ b/linker/Tests/TestCases/Linker/VirtualCall/Library.cs
@@ -1,31 +1,27 @@
-using System;
-
-public class Library {
-
- public Library ()
- {
- }
-
- public int Shebang ()
+namespace TestCases.Linker.VirtualCall
+{
+ public class Library
{
- return Bang ();
+ public Library ()
+ {
+ }
+
+ public int Shebang ()
+ {
+ return Bang ();
+ }
+
+ protected virtual int Bang ()
+ {
+ return 1;
+ }
}
- protected virtual int Bang ()
+ public class PowerFulLibrary : Library
{
- return 1;
+ protected override int Bang ()
+ {
+ return 0;
+ }
}
-}
-
-
-public class PowerFulLibrary : Library {
-
- protected override int Bang ()
- {
- return 0;
- }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
+} \ No newline at end of file
diff --git a/linker/Tests/TestCases/Linker/VirtualCall/Program.cs b/linker/Tests/TestCases/Linker/VirtualCall/Program.cs
index 1d4a64d5e..49c041698 100644
--- a/linker/Tests/TestCases/Linker/VirtualCall/Program.cs
+++ b/linker/Tests/TestCases/Linker/VirtualCall/Program.cs
@@ -1,16 +1,20 @@
-using System;
+using System;
-public class Program {
-
- public static int Main ()
+namespace TestCases.Linker.VirtualCall
+{
+ public class Program
{
- Program p = new Program ();
- return p.Run ();
- }
+ [Mark]
+ public static int Test ()
+ {
+ Program p = new Program ();
+ return p.Run ();
+ }
- int Run ()
- {
- Library lib = new PowerFulLibrary ();
- return lib.Shebang ();
+ int Run ()
+ {
+ Library lib = new PowerFulLibrary ();
+ return lib.Shebang ();
+ }
}
-}
+} \ No newline at end of file
diff --git a/linker/Tests/TestCases/Linker/XmlPattern/Library.cs b/linker/Tests/TestCases/Linker/XmlPattern/Library.cs
deleted file mode 100755
index 7f14865aa..000000000
--- a/linker/Tests/TestCases/Linker/XmlPattern/Library.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-
-namespace Foo {
-
- [NotLinked] public class BarBar {
- }
-
- public class FooBaz {
-
- public FooBaz ()
- {
- }
-
- [NotLinked] public void BarBaz ()
- {
- }
- }
-
- public class TrucBaz {
-
- public TrucBaz ()
- {
- }
- }
-
- public class BazBaz {
-
- public BazBaz ()
- {
- }
- }
-}
-
-[NotLinked, AttributeUsage (AttributeTargets.All)]
-public class NotLinkedAttribute : Attribute {
-}
diff --git a/linker/Tests/TestCases/Linker/XmlPattern/Library.dll b/linker/Tests/TestCases/Linker/XmlPattern/Library.dll
deleted file mode 100755
index 80e7ef34e..000000000
--- a/linker/Tests/TestCases/Linker/XmlPattern/Library.dll
+++ /dev/null
Binary files differ
diff --git a/linker/Tests/TestCases/Linker/XmlPattern/Makefile b/linker/Tests/TestCases/Linker/XmlPattern/Makefile
deleted file mode 100755
index 2e5bf5bcf..000000000
--- a/linker/Tests/TestCases/Linker/XmlPattern/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../config.make
-
-all:
- MCS /t:library Library.cs
diff --git a/linker/Tests/TestCases/Linker/XmlPattern/desc.xml b/linker/Tests/TestCases/Linker/XmlPattern/desc.xml
deleted file mode 100755
index c8e1e2383..000000000
--- a/linker/Tests/TestCases/Linker/XmlPattern/desc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo.*Baz">
- <method signature="System.Void .ctor()" />
- </type>
- </assembly>
-</linker>
diff --git a/linker/Tests/TestCases/MarkAttribute.cs b/linker/Tests/TestCases/MarkAttribute.cs
new file mode 100644
index 000000000..7f73bc147
--- /dev/null
+++ b/linker/Tests/TestCases/MarkAttribute.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace TestCases
+{
+ [AttributeUsage (AttributeTargets.Method | AttributeTargets.Field)]
+ public class MarkAttribute : Attribute
+ {
+ }
+} \ No newline at end of file
diff --git a/linker/Tests/TestCases/NotLinkedAttribute.cs b/linker/Tests/TestCases/NotLinkedAttribute.cs
new file mode 100644
index 000000000..82bd1ea68
--- /dev/null
+++ b/linker/Tests/TestCases/NotLinkedAttribute.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace TestCases
+{
+ [AttributeUsage (AttributeTargets.All)]
+ public class AssertLinkedAttribute : Attribute
+ {
+ }
+} \ No newline at end of file
diff --git a/linker/Tests/TestCases/TestCases.csproj b/linker/Tests/TestCases/TestCases.csproj
new file mode 100644
index 000000000..451fe7952
--- /dev/null
+++ b/linker/Tests/TestCases/TestCases.csproj
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{26D857FB-EEE3-4A5B-95BC-DAB39F880A99}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>TestCases</RootNamespace>
+ <AssemblyName>TestCases</AssemblyName>
+ <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="NotLinkedAttribute.cs" />
+ <Compile Include="Linker\Simple\Library.cs" />
+ <Compile Include="Linker\Simple\Program.cs" />
+ <Compile Include="MarkAttribute.cs" />
+ <Compile Include="Linker\VirtualCall\Library.cs" />
+ <Compile Include="Linker\VirtualCall\Program.cs" />
+ <Compile Include="Linker\MultipleReferences\Bar.cs" />
+ <Compile Include="Linker\MultipleReferences\Baz.cs" />
+ <Compile Include="Linker\MultipleReferences\Foo.cs" />
+ <Compile Include="Linker\MultipleReferences\Program.cs" />
+ <Compile Include="Xml\Generics\Library.cs" />
+ <Compile Include="Xml\SimpleXml\Library.cs" />
+ <Compile Include="Xml\Interface\Library.cs" />
+ <Compile Include="Xml\PreserveFieldsRequired\Library.cs" />
+ <Compile Include="Xml\NestedNested\Library.cs" />
+ <Compile Include="Xml\ReferenceInVirtualMethod\Library.cs" />
+ <Compile Include="Xml\XmlPattern\Library.cs" />
+ <Compile Include="Xml\ReferenceInAttributes\LibLib.cs" />
+ <Compile Include="Xml\ReferenceInAttributes\Library.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Xml\" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Xml\Generics\desc.xml" />
+ <EmbeddedResource Include="Xml\SimpleXml\desc.xml" />
+ <EmbeddedResource Include="Xml\Interface\desc.xml" />
+ <EmbeddedResource Include="Xml\PreserveFieldsRequired\desc.xml" />
+ <EmbeddedResource Include="Xml\NestedNested\desc.xml" />
+ <EmbeddedResource Include="Xml\ReferenceInVirtualMethod\desc.xml" />
+ <EmbeddedResource Include="Xml\XmlPattern\desc.xml" />
+ <EmbeddedResource Include="Xml\ReferenceInAttributes\desc.xml" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/linker/Tests/TestCases/Xml/Generics/Library.cs b/linker/Tests/TestCases/Xml/Generics/Library.cs
new file mode 100644
index 000000000..9505cb2f9
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/Generics/Library.cs
@@ -0,0 +1,61 @@
+using System;
+
+namespace TestCases.Xml.Generics
+{
+ public class Foo
+ {
+ void Bar ()
+ {
+ int i = 42;
+ string s = "hey";
+
+ Baz<int> bi = new Baz<int> (i);
+ bi.Gazonk ();
+ bi.Bat<string> (i, s);
+
+ Baz<string> bs = new Baz<string> (s);
+ bs.Gazonk ();
+ bs.Bat<int> (s, i);
+ bs.BiroBiro ();
+
+ bs.Blam<Bang> ();
+ }
+ }
+
+ public class Baz<T>
+ {
+ T _t;
+
+ public Baz (T t)
+ {
+ _t = t;
+ }
+
+ public void Gazonk ()
+ {
+ Console.WriteLine (_t);
+ }
+
+ public void Bat<M> (T t, M m)
+ {
+ Console.WriteLine ("{0}{1}", t, m);
+ }
+
+ public void Blam<M> ()
+ {
+ }
+
+ public T [] BiroBiro ()
+ {
+ return new T [0];
+ }
+ }
+
+ class Bang
+ {
+ [AssertLinked]
+ public Bang ()
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/linker/Tests/TestCases/Xml/Generics/desc.xml b/linker/Tests/TestCases/Xml/Generics/desc.xml
new file mode 100644
index 000000000..d84422937
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/Generics/desc.xml
@@ -0,0 +1,5 @@
+<linker>
+ <assembly fullname="TestCases">
+ <type fullname="TestCases.Xml.Generics.Foo" />
+ </assembly>
+</linker>
diff --git a/linker/Tests/TestCases/Xml/Interface/Library.cs b/linker/Tests/TestCases/Xml/Interface/Library.cs
new file mode 100644
index 000000000..4bbedd4ba
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/Interface/Library.cs
@@ -0,0 +1,29 @@
+namespace TestCases.Xml.Interface
+{
+ public class Foo : IFoo
+ {
+ public void Gazonk ()
+ {
+ }
+ }
+
+ public interface IFoo : IBar
+ {
+ }
+
+ public interface IBar
+ {
+ [AssertLinked]
+ void Gazonk ();
+ }
+
+ [AssertLinked]
+ public class Baz : IBaz
+ {
+ }
+
+ [AssertLinked]
+ public interface IBaz
+ {
+ }
+}
diff --git a/linker/Tests/TestCases/Xml/Interface/desc.xml b/linker/Tests/TestCases/Xml/Interface/desc.xml
new file mode 100644
index 000000000..2cba1a23d
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/Interface/desc.xml
@@ -0,0 +1,5 @@
+<linker>
+ <assembly fullname="TestCases">
+ <type fullname="TestCases.Xml.Interface.Foo" />
+ </assembly>
+</linker>
diff --git a/linker/Tests/TestCases/Xml/NestedNested/Library.cs b/linker/Tests/TestCases/Xml/NestedNested/Library.cs
new file mode 100644
index 000000000..5e024ab6c
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/NestedNested/Library.cs
@@ -0,0 +1,19 @@
+namespace TestCases.Xml.NestedNested
+{
+ public class Foo
+ {
+ }
+
+ [AssertLinked]
+ public class Bar
+ {
+ [AssertLinked]
+ public class Baz
+ {
+ [AssertLinked]
+ public class Gazonk
+ {
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/linker/Tests/TestCases/Xml/NestedNested/desc.xml b/linker/Tests/TestCases/Xml/NestedNested/desc.xml
new file mode 100644
index 000000000..28a21adde
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/NestedNested/desc.xml
@@ -0,0 +1,5 @@
+<linker>
+ <assembly fullname="TestCases">
+ <type fullname="TestCases.Xml.NestedNested.Foo" />
+ </assembly>
+</linker>
diff --git a/linker/Tests/TestCases/Xml/PreserveFieldsRequired/Library.cs b/linker/Tests/TestCases/Xml/PreserveFieldsRequired/Library.cs
new file mode 100644
index 000000000..edf9e340c
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/PreserveFieldsRequired/Library.cs
@@ -0,0 +1,35 @@
+namespace TestCases.Xml.PreserveFieldsRequired
+{
+ public class Foo
+ {
+ public Foo ()
+ {
+ new NotRequiredButUsedNotPreserved ();
+ new NotRequiredButUsedAndFieldsPreserved ();
+ }
+ }
+
+ public class NotRequiredButUsedNotPreserved
+ {
+
+ [AssertLinked] public int foo;
+ [AssertLinked] public int bar;
+ }
+
+ public class NotRequiredButUsedAndFieldsPreserved
+ {
+ public int foo;
+ public int bar;
+
+ [AssertLinked]
+ public int FooBar ()
+ {
+ return foo + bar;
+ }
+ }
+
+ [AssertLinked]
+ public class NotRequiredAndNotUsed
+ {
+ }
+}
diff --git a/linker/Tests/TestCases/Xml/PreserveFieldsRequired/desc.xml b/linker/Tests/TestCases/Xml/PreserveFieldsRequired/desc.xml
new file mode 100644
index 000000000..e7f7d5c53
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/PreserveFieldsRequired/desc.xml
@@ -0,0 +1,7 @@
+<linker>
+ <assembly fullname="TestCases">
+ <type fullname="TestCases.Xml.PreserveFieldsRequired.Foo" />
+ <type fullname="TestCases.Xml.PreserveFieldsRequired.NotRequiredButUsedNotPreserved" preserve="nothing" required="false" />
+ <type fullname="TestCases.Xml.PreserveFieldsRequired.NotRequiredButUsedAndFieldsPreserved" preserve="fields" required="false" />
+ </assembly>
+</linker>
diff --git a/linker/Tests/TestCases/Xml/ReferenceInAttributes/LibLib.cs b/linker/Tests/TestCases/Xml/ReferenceInAttributes/LibLib.cs
new file mode 100644
index 000000000..c42523e6e
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/ReferenceInAttributes/LibLib.cs
@@ -0,0 +1,23 @@
+using System;
+
+namespace TestCases.Xml.ReferenceInAttributes
+{
+ public class LibLibAttribute : Attribute
+ {
+ public Type LibLibType {
+ [AssertLinked]
+ get { return null; }
+ set { }
+ }
+ }
+
+ public class BilBil
+ {
+
+ [AssertLinked]
+ public BilBil ()
+ {
+ }
+ }
+}
+
diff --git a/linker/Tests/TestCases/Xml/ReferenceInAttributes/Library.cs b/linker/Tests/TestCases/Xml/ReferenceInAttributes/Library.cs
new file mode 100644
index 000000000..4d2c4ba28
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/ReferenceInAttributes/Library.cs
@@ -0,0 +1,81 @@
+using System;
+
+namespace TestCases.Xml.ReferenceInAttributes
+{
+ public class BarAttribute : Attribute
+ {
+ public BarAttribute ()
+ {
+ }
+
+ public BarAttribute (Type type)
+ {
+ }
+
+ public Type FieldType;
+
+ public Type PropertyType {
+ [AssertLinked]
+ get { return null; }
+ set { }
+ }
+ }
+
+ [Bar (typeof (Guy_A))]
+ public class Foo
+ {
+
+ [Bar (FieldType = typeof (Guy_B))]
+ public Foo a;
+
+ [Bar (PropertyType = typeof (Guy_C))]
+ public Foo b;
+
+ [LibLib (LibLibType = typeof (BilBil))]
+ public Foo c;
+
+ [LibLib (LibLibType = typeof (Guy_D))]
+ public Foo d;
+ }
+
+ public class Guy_A
+ {
+
+ [AssertLinked]
+ public Guy_A ()
+ {
+ }
+ }
+
+ public class Guy_B
+ {
+
+ [AssertLinked]
+ public Guy_B ()
+ {
+ }
+ }
+
+ public class Guy_C
+ {
+
+ [AssertLinked]
+ public Guy_C ()
+ {
+ }
+ }
+
+ public class Guy_D
+ {
+
+ [AssertLinked]
+ public Guy_D ()
+ {
+ }
+ }
+
+ [AssertLinked]
+ public class Baz
+ {
+ }
+}
diff --git a/linker/Tests/TestCases/Xml/ReferenceInAttributes/desc.xml b/linker/Tests/TestCases/Xml/ReferenceInAttributes/desc.xml
new file mode 100644
index 000000000..927ba58e6
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/ReferenceInAttributes/desc.xml
@@ -0,0 +1,5 @@
+<linker>
+ <assembly fullname="TestCases">
+ <type fullname="TestCases.Xml.ReferenceInAttributes.Foo" />
+ </assembly>
+</linker>
diff --git a/linker/Tests/TestCases/Xml/ReferenceInVirtualMethod/Library.cs b/linker/Tests/TestCases/Xml/ReferenceInVirtualMethod/Library.cs
new file mode 100644
index 000000000..8c0ee9c98
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/ReferenceInVirtualMethod/Library.cs
@@ -0,0 +1,37 @@
+using System;
+
+namespace TestCases.Xml.ReferenceInVirtualMethod
+{
+ public class Foo
+ {
+ public void Do ()
+ {
+ Bar b = new Baz ();
+ b.Bang ();
+ }
+ }
+
+ public class Bar
+ {
+ public virtual void Bang ()
+ {
+ }
+ }
+
+ public class Baz : Bar
+ {
+ private string _hey;
+
+ public string Hey {
+ [AssertLinked]
+ get { return _hey; }
+ [AssertLinked]
+ set { _hey = value; }
+ }
+
+ public override void Bang ()
+ {
+ Console.WriteLine (_hey);
+ }
+ }
+}
diff --git a/linker/Tests/TestCases/Xml/ReferenceInVirtualMethod/desc.xml b/linker/Tests/TestCases/Xml/ReferenceInVirtualMethod/desc.xml
new file mode 100644
index 000000000..1372a44b9
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/ReferenceInVirtualMethod/desc.xml
@@ -0,0 +1,5 @@
+<linker>
+ <assembly fullname="TestCases">
+ <type fullname="TestCases.Xml.ReferenceInVirtualMethod.Foo" />
+ </assembly>
+</linker>
diff --git a/linker/Tests/TestCases/Xml/SimpleXml/Library.cs b/linker/Tests/TestCases/Xml/SimpleXml/Library.cs
new file mode 100644
index 000000000..f36710f8a
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/SimpleXml/Library.cs
@@ -0,0 +1,48 @@
+using System;
+
+namespace TestCases.Xml.SimpleXml
+{
+ public class Foo
+ {
+
+ int _baz;
+ [AssertLinked] int _shebang;
+
+ public Foo ()
+ {
+ _baz = 42;
+ }
+
+ public int Baz ()
+ {
+ return _baz;
+ }
+
+ [AssertLinked]
+ public int Shebang (int bang)
+ {
+ return _shebang = bang * 2;
+ }
+ }
+
+ public class Bar
+ {
+
+ int _truc;
+
+ public Bar ()
+ {
+ _truc = 12;
+ }
+
+ public int Truc ()
+ {
+ return _truc;
+ }
+ }
+
+ [AssertLinked]
+ public class Gazonk
+ {
+ }
+}
diff --git a/linker/Tests/TestCases/Linker/SimpleXml/desc.xml b/linker/Tests/TestCases/Xml/SimpleXml/desc.xml
index 2a20ed324..552a4a326 100644
--- a/linker/Tests/TestCases/Linker/SimpleXml/desc.xml
+++ b/linker/Tests/TestCases/Xml/SimpleXml/desc.xml
@@ -1,10 +1,10 @@
-<linker>
- <assembly fullname="Library">
- <type fullname="Foo">
+<linker>
+ <assembly fullname="TestCases">
+ <type fullname="TestCases.Xml.SimpleXml.Foo">
<field signature="System.Int32 _baz" />
<method signature="System.Void .ctor()" />
<method signature="System.Int32 Baz()" />
</type>
- <type fullname="Bar" />
+ <type fullname="TestCases.Xml.SimpleXml.Bar" />
</assembly>
</linker>
diff --git a/linker/Tests/TestCases/Xml/XmlPattern/Library.cs b/linker/Tests/TestCases/Xml/XmlPattern/Library.cs
new file mode 100755
index 000000000..eb40b473f
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/XmlPattern/Library.cs
@@ -0,0 +1,36 @@
+namespace TestCases.Xml.XmlPattern
+{
+ [AssertLinked]
+ public class BarBar
+ {
+ }
+
+ public class FooBaz
+ {
+
+ public FooBaz ()
+ {
+ }
+
+ [AssertLinked]
+ public void BarBaz ()
+ {
+ }
+ }
+
+ public class TrucBaz
+ {
+
+ public TrucBaz ()
+ {
+ }
+ }
+
+ public class BazBaz
+ {
+
+ public BazBaz ()
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/linker/Tests/TestCases/Xml/XmlPattern/desc.xml b/linker/Tests/TestCases/Xml/XmlPattern/desc.xml
new file mode 100755
index 000000000..19ca58298
--- /dev/null
+++ b/linker/Tests/TestCases/Xml/XmlPattern/desc.xml
@@ -0,0 +1,7 @@
+<linker>
+ <assembly fullname="TestCases">
+ <type fullname="TestCases.Xml.XmlPattern.*Baz">
+ <method signature="System.Void .ctor()" />
+ </type>
+ </assembly>
+</linker>
diff --git a/linker/Tests/TestCases/bin/Debug/TestCases.dll b/linker/Tests/TestCases/bin/Debug/TestCases.dll
new file mode 100644
index 000000000..d64057723
--- /dev/null
+++ b/linker/Tests/TestCases/bin/Debug/TestCases.dll
Binary files differ
diff --git a/linker/Tests/TestCases/bin/Debug/TestCases.pdb b/linker/Tests/TestCases/bin/Debug/TestCases.pdb
new file mode 100644
index 000000000..c8128a6f1
--- /dev/null
+++ b/linker/Tests/TestCases/bin/Debug/TestCases.pdb
Binary files differ
diff --git a/linker/Tests/TestCases/config.make b/linker/Tests/TestCases/config.make
deleted file mode 100644
index 8323eb2a8..000000000
--- a/linker/Tests/TestCases/config.make
+++ /dev/null
@@ -1,3 +0,0 @@
-
-MCS = mcs
-
diff --git a/linker/Tests/packages.config b/linker/Tests/packages.config
new file mode 100644
index 000000000..4b26cc066
--- /dev/null
+++ b/linker/Tests/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="NUnit" version="3.6.1" targetFramework="net461" />
+</packages> \ No newline at end of file