Skip to content

Commit

Permalink
Clean up debugger attributes tests.
Browse files Browse the repository at this point in the history
* Remove `SetupLinkerKeepDebugMembersAttribute`.  This isn't supported anymore by the linker.

* Remove NETCOREAPP behavior difference in debugger attribute removal tests

* Move `DebuggerDisplayAttributeOnTypeWithNonExistentMethod` to the `KeepDebugMembers` folder since that is the scenario this test is testing
  • Loading branch information
mrvoorhe committed Jul 18, 2023
1 parent dedaf46 commit e38c157
Show file tree
Hide file tree
Showing 25 changed files with 35 additions and 210 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ public virtual void AddLinkSymbols (string value)
{
}

public virtual void AddKeepDebugMembers (string value)
{
}

public virtual void AddAssemblyAction (string action, string assembly)
{
switch (action) {
Expand Down Expand Up @@ -208,9 +204,6 @@ public virtual void ProcessOptions (TestCaseLinkerOptions options)
if (!string.IsNullOrEmpty (options.LinkSymbols))
AddLinkSymbols (options.LinkSymbols);

if (!string.IsNullOrEmpty (options.KeepDebugMembers))
AddKeepDebugMembers (options.KeepDebugMembers);

AddSkipUnresolved (options.SkipUnresolved);

AddStripDescriptors (options.StripDescriptors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class TestCaseLinkerOptions
public bool IgnoreSubstitutions;
public bool IgnoreLinkAttributes;
public string KeepTypeForwarderOnlyAssemblies;
public string KeepDebugMembers;
public string LinkSymbols;
public bool SkipUnresolved;
public bool StripDescriptors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public virtual TestCaseLinkerOptions GetLinkerOptions (NPath inputPath)
IgnoreSubstitutions = GetOptionAttributeValue (nameof (IgnoreSubstitutionsAttribute), true),
IgnoreLinkAttributes = GetOptionAttributeValue (nameof (IgnoreLinkAttributesAttribute), true),
KeepTypeForwarderOnlyAssemblies = GetOptionAttributeValue (nameof (KeepTypeForwarderOnlyAssembliesAttribute), string.Empty),
KeepDebugMembers = GetOptionAttributeValue (nameof (SetupLinkerKeepDebugMembersAttribute), string.Empty),
LinkSymbols = GetOptionAttributeValue (nameof (SetupLinkerLinkSymbolsAttribute), string.Empty),
TrimMode = GetOptionAttributeValue<string> (nameof (SetupLinkerTrimModeAttribute), null),
DefaultAssembliesAction = GetOptionAttributeValue<string> (nameof (SetupLinkerDefaultActionAttribute), null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public Task DebuggerDisplayAttributeOnTypeThatIsNotUsed ()
return RunTest (allowMissingWarnings: true);
}

[Fact]
public Task DebuggerDisplayAttributeOnTypeWithNonExistentMethod ()
{
return RunTest (allowMissingWarnings: true);
}

[Fact]
public Task DebuggerDisplayOnTypeWithCallToExtensionMethodOnFieldType ()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ public Task DebuggerDisplayAttributeOnTypeThatIsNotUsed ()
return RunTest (allowMissingWarnings: true);
}

[Fact]
public Task DebuggerDisplayAttributeOnTypeWithNonExistentMethod ()
{
return RunTest (allowMissingWarnings: true);
}

[Fact]
public Task DebuggerTypeProxyAttributeOnAssemblyUsingTarget ()
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,11 @@
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;

#if !NETCOREAPP
[assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))]
#endif

[assembly: DebuggerDisplay ("{Property}", Target = typeof (DebuggerDisplayAttributeOnAssemblyUsingTarget.Foo))]

namespace Mono.Linker.Tests.Cases.Attributes.Debugger
{
#if NETCOREAPP
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
#else
[SetupLinkerTrimMode ("link")]
[SetupLinkerKeepDebugMembers ("false")]

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]

[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_Target(System.Type)")]
#endif
public class DebuggerDisplayAttributeOnAssemblyUsingTarget
{
public static void Main ()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
using System.Diagnostics;
using Mono.Linker.Tests.Cases.Attributes.Debugger;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;

[assembly: DebuggerDisplay ("{Property}", Target = typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.Foo))]

namespace Mono.Linker.Tests.Cases.Attributes.Debugger
{
#if NETCOREAPP
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
#else
[SetupLinkerTrimMode ("link")]
[SetupLinkerKeepDebugMembers ("false")]

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]

[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
#endif
public class DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType
{
public static void Main ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,12 @@
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;

#if !NETCOREAPP
[assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))]
#endif

[assembly: DebuggerDisplay ("{Property}", TargetTypeName = "Mono.Linker.Tests.Cases.Attributes.Debugger.Dependencies.DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib, library")]

namespace Mono.Linker.Tests.Cases.Attributes.Debugger
{
[SetupCompileBefore ("library.dll", new[] { typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib) })]

#if NETCOREAPP
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
#else
[SetupLinkerTrimMode ("link")]
[SetupLinkerKeepDebugMembers ("false")]

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]

[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")]
#endif

[RemovedMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib), "get_Property()")]
[KeptMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib), "set_Property(System.Int32)")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@

namespace Mono.Linker.Tests.Cases.Attributes.Debugger
{
#if NETCOREAPP
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
#else
[SetupLinkerTrimMode ("link")]
[SetupLinkerKeepDebugMembers ("false")]

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]

[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
#endif
public class DebuggerDisplayAttributeOnType
{
public static void Main ()
Expand All @@ -26,9 +16,6 @@ public static void Main ()

[Kept]
[KeptMember (".ctor()")]
#if !NETCOREAPP
[KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))]
#endif
[DebuggerDisplay ("{Property}")]
class Foo
{
Expand All @@ -37,9 +24,6 @@ class Foo

[Kept]
[KeptMember (".ctor()")]
#if !NETCOREAPP
[KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))]
#endif
[DebuggerDisplay ("{Method()}")]
class Bar
{
Expand All @@ -51,9 +35,6 @@ public int Method ()

[Kept]
[KeptMember (".ctor()")]
#if !NETCOREAPP
[KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))]
#endif
[DebuggerDisplay (null)]
class Baz
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
using System.Diagnostics;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;

namespace Mono.Linker.Tests.Cases.Attributes.Debugger
{
#if NETCOREAPP
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
#else
[SetupLinkerTrimMode ("link")]
[SetupLinkerKeepDebugMembers ("false")]

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
#endif
public class DebuggerDisplayAttributeOnTypeThatIsNotUsed
{
public static void Main ()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,11 @@
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;

#if !NETCOREAPP
[assembly: KeptAttributeAttribute (typeof (DebuggerTypeProxyAttribute))]
#endif

[assembly: DebuggerTypeProxy (typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo.FooDebugView), Target = typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo))]

namespace Mono.Linker.Tests.Cases.Attributes.Debugger
{
#if NETCOREAPP
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
#else
[SetupLinkerTrimMode ("link")]
[SetupLinkerKeepDebugMembers ("false")]

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]

[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")]
#endif
public class DebuggerTypeProxyAttributeOnAssemblyUsingTarget
{
public static void Main ()
Expand All @@ -38,9 +24,6 @@ public class Foo
[KeptBackingField]
public int Property { get; [Kept] set; }

#if !NETCOREAPP
[Kept]
#endif
internal class FooDebugView
{
private Foo _foo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@

namespace Mono.Linker.Tests.Cases.Attributes.Debugger
{
#if NETCOREAPP
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
#else
[SetupLinkerTrimMode ("link")]
[SetupLinkerKeepDebugMembers ("false")]

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]

[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")]
#endif
public class DebuggerTypeProxyAttributeOnType
{
public static void Main ()
Expand All @@ -24,17 +14,11 @@ public static void Main ()

[Kept]
[KeptMember (".ctor()")]
#if !NETCOREAPP
[KeptAttributeAttribute (typeof (DebuggerTypeProxyAttribute))]
#endif
[DebuggerTypeProxy (typeof (FooDebugView))]
class Foo
{
}

#if !NETCOREAPP
[Kept]
#endif
class FooDebugView
{
public FooDebugView (Foo foo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
{
[SetupLinkerTrimMode ("link")]
#if !NETCOREAPP
[SetupLinkerKeepDebugMembers ("true")]
#endif

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
{
[SetupLinkerTrimMode ("link")]
#if !NETCOREAPP
[SetupLinkerKeepDebugMembers ("true")]
#endif
[SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })]

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
{
[SetupLinkerTrimMode ("link")]
#if !NETCOREAPP
[SetupLinkerKeepDebugMembers ("true")]
#endif
[SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })]

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using System.Diagnostics;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;

namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
{
#if !NETCOREAPP
[SetupLinkerKeepDebugMembers ("true")]
#endif

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
public class DebuggerDisplayAttributeOnGenerics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
{
[SetupLinkerTrimMode ("link")]
#if !NETCOREAPP
[SetupLinkerKeepDebugMembers ("true")]
#endif

// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]

Expand Down
Loading

0 comments on commit e38c157

Please sign in to comment.