Remove etw --exclude-feature tests. (#89107)
authorMike Voorhees <mrvoorhe@users.noreply.github.com>
Fri, 21 Jul 2023 19:04:23 +0000 (15:04 -0400)
committerGitHub <noreply@github.com>
Fri, 21 Jul 2023 19:04:23 +0000 (12:04 -0700)
`--exclude-feature` logic was removed.  If there is no intent to support this with coreclr bcl then we won't worry about it either.

While we do need UnityLinker to continue to handle mono class libraries for awhile longer, the `--exclude-feature` functionality is a niche thing we can drop now.

src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/BCLFeatures.ETWTests.g.cs
src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSource.cs [deleted file]
src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSourceEmptyBody.cs [deleted file]
src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSourceNonVoidReturn.cs [deleted file]
src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/Excluded.cs [deleted file]
src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/LocalsOfModifiedMethodAreRemoved.cs [deleted file]
src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/NonEventWithLog.cs [deleted file]
src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/StubbedMethodWithExceptionHandlers.cs [deleted file]

index d2168dd..e471fff 100644 (file)
@@ -10,24 +10,6 @@ namespace ILLink.RoslynAnalyzer.Tests.BCLFeatures
                protected override string TestSuiteName => "BCLFeatures.ETW";
 
                [Fact]
-               public Task BaseRemovedEventSource ()
-               {
-                       return RunTest (allowMissingWarnings: true);
-               }
-
-               [Fact]
-               public Task BaseRemovedEventSourceEmptyBody ()
-               {
-                       return RunTest (allowMissingWarnings: true);
-               }
-
-               [Fact]
-               public Task BaseRemovedEventSourceNonVoidReturn ()
-               {
-                       return RunTest (allowMissingWarnings: true);
-               }
-
-               [Fact]
                public Task CustomEventSource ()
                {
                        return RunTest (allowMissingWarnings: true);
@@ -39,29 +21,5 @@ namespace ILLink.RoslynAnalyzer.Tests.BCLFeatures
                        return RunTest (allowMissingWarnings: true);
                }
 
-               [Fact]
-               public Task Excluded ()
-               {
-                       return RunTest (allowMissingWarnings: true);
-               }
-
-               [Fact]
-               public Task LocalsOfModifiedMethodAreRemoved ()
-               {
-                       return RunTest (allowMissingWarnings: true);
-               }
-
-               [Fact]
-               public Task NonEventWithLog ()
-               {
-                       return RunTest (allowMissingWarnings: true);
-               }
-
-               [Fact]
-               public Task StubbedMethodWithExceptionHandlers ()
-               {
-                       return RunTest (allowMissingWarnings: true);
-               }
-
        }
 }
\ No newline at end of file
diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSource.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSource.cs
deleted file mode 100644 (file)
index c5a613b..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
-       [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
-       [SetupLinkerArgument ("--exclude-feature", "etw")]
-       // Keep framework code that calls EventSource methods like OnEventCommand
-       [SetupLinkerTrimMode ("skip")]
-       public class BaseRemovedEventSource
-       {
-               public static void Main ()
-               {
-                       var b = CustomCtorEventSource.Log.IsEnabled ();
-                       if (b)
-                               CustomCtorEventSource.Log.SomeMethod ();
-               }
-       }
-
-       [Kept]
-       [KeptBaseType (typeof (EventSource))]
-       [KeptMember (".ctor()")]
-       [KeptMember (".cctor()")]
-       [EventSource (Name = "MyCompany")]
-       class CustomCtorEventSource : EventSource
-       {
-               public class Keywords
-               {
-                       public const EventKeywords Page = (EventKeywords) 1;
-
-                       public int Unused;
-               }
-
-               [Kept]
-               public static CustomCtorEventSource Log = new MyEventSourceBasedOnCustomCtorEventSource (1);
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ldarg.0",
-                       "call",
-                       "ret",
-               })]
-               public CustomCtorEventSource (int value)
-               {
-                       Removed ();
-               }
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ret",
-               })]
-               protected override void OnEventCommand (EventCommandEventArgs command)
-               {
-                       Removed2 ();
-               }
-
-               static void Removed2 ()
-               {
-               }
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ret",
-               })]
-               [Event (8)]
-               public void SomeMethod ()
-               {
-                       Removed ();
-               }
-
-               public void Removed ()
-               {
-               }
-       }
-
-       [Kept]
-       [KeptBaseType (typeof (CustomCtorEventSource))]
-       class MyEventSourceBasedOnCustomCtorEventSource : CustomCtorEventSource
-       {
-               [Kept]
-               public MyEventSourceBasedOnCustomCtorEventSource (int value) : base (value)
-               {
-               }
-       }
-}
diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSourceEmptyBody.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSourceEmptyBody.cs
deleted file mode 100644 (file)
index b72b66a..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
-       [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
-       [SetupLinkerArgument ("--exclude-feature", "etw")]
-       // Keep framework code that calls EventSource methods like OnEventCommand
-       [SetupLinkerTrimMode ("skip")]
-       public class BaseRemovedEventSourceEmptyBody
-       {
-               public static void Main ()
-               {
-                       var b = CustomCtorEventSourceEmptyBody.Log.IsEnabled ();
-                       if (b)
-                               CustomCtorEventSourceEmptyBody.Log.SomeMethod ();
-               }
-       }
-
-       [Kept]
-       [KeptBaseType (typeof (EventSource))]
-       [KeptMember (".ctor()")]
-       [KeptMember (".cctor()")]
-       [EventSource (Name = "MyCompany")]
-       class CustomCtorEventSourceEmptyBody : EventSource
-       {
-               public class Keywords
-               {
-                       public const EventKeywords Page = (EventKeywords) 1;
-
-                       public int Unused;
-               }
-
-               [Kept]
-               public static CustomCtorEventSourceEmptyBody Log = new MyEventSourceBasedOnCustomCtorEventSourceEmptyBody (1);
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ldarg.0",
-                       "call",
-                       "ret",
-               })]
-               public CustomCtorEventSourceEmptyBody (int value)
-               {
-                       Removed ();
-               }
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ret"
-               })]
-               protected override void OnEventCommand (EventCommandEventArgs command)
-               {
-                       // A nop is removed
-               }
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ret"
-               })]
-               [Event (8)]
-               public void SomeMethod ()
-               {
-                       Removed ();
-               }
-
-               public void Removed ()
-               {
-               }
-       }
-
-       [Kept]
-       [KeptBaseType (typeof (CustomCtorEventSourceEmptyBody))]
-       class MyEventSourceBasedOnCustomCtorEventSourceEmptyBody : CustomCtorEventSourceEmptyBody
-       {
-               [Kept]
-               public MyEventSourceBasedOnCustomCtorEventSourceEmptyBody (int value) : base (value)
-               {
-               }
-       }
-}
\ No newline at end of file
diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSourceNonVoidReturn.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/BaseRemovedEventSourceNonVoidReturn.cs
deleted file mode 100644 (file)
index d6ac1d1..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
-       [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
-       [SetupLinkerArgument ("--exclude-feature", "etw")]
-       // Keep framework code that calls EventSource methods like OnEventCommand
-       [SetupLinkerTrimMode ("skip")]
-       public class BaseRemovedEventSourceNonVoidReturn
-       {
-               public static void Main ()
-               {
-                       var b = CustomCtorEventSourceNonVoidReturn.Log.IsEnabled ();
-                       if (b)
-                               CustomCtorEventSourceNonVoidReturn.Log.SomeMethod ();
-               }
-       }
-
-       [Kept]
-       [KeptBaseType (typeof (EventSource))]
-       [KeptMember (".ctor()")]
-       [KeptMember (".cctor()")]
-       [EventSource (Name = "MyCompany")]
-       class CustomCtorEventSourceNonVoidReturn : EventSource
-       {
-               public class Keywords
-               {
-                       public const EventKeywords Page = (EventKeywords) 1;
-
-                       public int Unused;
-               }
-
-               [Kept]
-               public static CustomCtorEventSourceNonVoidReturn Log = new MyEventSourceBasedOnCustomCtorEventSourceNonVoidReturn (1);
-
-               [Kept]
-               [ExpectedInstructionSequence (new[] { "ldarg.0", "call", "ret", })]
-               public CustomCtorEventSourceNonVoidReturn (int value)
-               {
-                       Removed ();
-               }
-
-               [Kept]
-               [ExpectedInstructionSequence (new[] { "ldstr", "newobj", "throw" })]
-               [ExpectLocalsModified]
-               [Event (8)]
-               public int SomeMethod ()
-               {
-                       return Removed ();
-               }
-
-               public int Removed ()
-               {
-                       return 0;
-               }
-       }
-
-       [Kept]
-       [KeptBaseType (typeof (CustomCtorEventSourceNonVoidReturn))]
-       class MyEventSourceBasedOnCustomCtorEventSourceNonVoidReturn : CustomCtorEventSourceNonVoidReturn
-       {
-               [Kept]
-               public MyEventSourceBasedOnCustomCtorEventSourceNonVoidReturn (int value) : base (value)
-               {
-               }
-       }
-}
\ No newline at end of file
diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/Excluded.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/Excluded.cs
deleted file mode 100644 (file)
index 6f9f33a..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
-       [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
-       [SetupLinkerArgument ("--exclude-feature", "etw")]
-       // Keep framework code that calls EventSource methods like OnEventCommand
-       [SetupLinkerTrimMode ("skip")]
-       // Used to avoid different compilers generating different IL which can mess up the instruction asserts
-       [SetupCompileArgument ("/optimize+")]
-       public class Excluded
-       {
-               public static void Main ()
-               {
-                       var b = RemovedEventSource.Log.IsEnabled ();
-                       if (b)
-                               RemovedEventSource.Log.SomeMethod ();
-               }
-       }
-
-       [Kept]
-       [KeptBaseType (typeof (EventSource))]
-       [KeptMember (".ctor()")]
-       [KeptMember (".cctor()")]
-       [EventSource (Name = "MyCompany")]
-       class RemovedEventSource : EventSource
-       {
-               public class Keywords
-               {
-                       public const EventKeywords Page = (EventKeywords) 1;
-
-                       public int Unused;
-               }
-
-               [Kept]
-               public static RemovedEventSource Log = new RemovedEventSource ();
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ret",
-               })]
-               protected override void OnEventCommand (EventCommandEventArgs command)
-               {
-                       Removed2 ();
-               }
-
-               static void Removed2 ()
-               {
-               }
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ret",
-               })]
-               [Event (8)]
-               public void SomeMethod ()
-               {
-                       Removed ();
-               }
-
-               public void Removed ()
-               {
-               }
-       }
-}
diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/LocalsOfModifiedMethodAreRemoved.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/LocalsOfModifiedMethodAreRemoved.cs
deleted file mode 100644 (file)
index ea9788d..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
-       [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
-       [SetupLinkerArgument ("--exclude-feature", "etw")]
-       // Keep framework code that calls EventSource methods like OnEventCommand
-       [SetupLinkerTrimMode ("skip")]
-       // Used to avoid different compilers generating different IL which can mess up the instruction asserts
-       [SetupCompileArgument ("/optimize+")]
-       public class LocalsOfModifiedMethodAreRemoved
-       {
-               public static void Main ()
-               {
-                       var b = LocalsAreCleared_RemovedEventSource.Log.IsEnabled ();
-                       if (b)
-                               LocalsAreCleared_RemovedEventSource.Log.SomeMethod ();
-               }
-
-               public class ClassForLocal
-               {
-               }
-
-               public static void CallsToForceALocal (int arg1, int arg2, int arg3)
-               {
-               }
-       }
-
-       [Kept]
-       [KeptBaseType (typeof (EventSource))]
-       [KeptMember (".ctor()")]
-       [KeptMember (".cctor()")]
-       [EventSource (Name = "MyCompany")]
-       class LocalsAreCleared_RemovedEventSource : EventSource
-       {
-               public class Keywords
-               {
-                       public const EventKeywords Page = (EventKeywords) 1;
-
-                       public int Unused;
-               }
-
-               [Kept]
-               public static LocalsAreCleared_RemovedEventSource Log = new LocalsAreCleared_RemovedEventSource ();
-
-               [Kept]
-               [ExpectBodyModified]
-               [ExpectedLocalsSequence (new string[0])]
-               protected override void OnEventCommand (EventCommandEventArgs command)
-               {
-                       // Do some extra stuff to be extra certain the compiler introduced a local instead of using `dup`
-                       var tmp = new LocalsOfModifiedMethodAreRemoved.ClassForLocal ();
-                       LocalsOfModifiedMethodAreRemoved.CallsToForceALocal (1, 3, 4);
-                       LocalsOfModifiedMethodAreRemoved.CallsToForceALocal (1, 4, 4);
-                       var hashcode = tmp.GetHashCode ();
-                       LocalsOfModifiedMethodAreRemoved.CallsToForceALocal (1, hashcode, 3);
-               }
-
-               [Kept]
-               [Event (8)]
-               [ExpectBodyModified]
-               public void SomeMethod ()
-               {
-                       Removed ();
-               }
-
-               public void Removed ()
-               {
-               }
-       }
-}
\ No newline at end of file
diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/NonEventWithLog.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/NonEventWithLog.cs
deleted file mode 100644 (file)
index f02daab..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
-       [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
-       [SetupLinkerArgument ("--exclude-feature", "etw")]
-       // Used to avoid different compilers generating different IL which can mess up the instruction asserts
-       [SetupCompileArgument ("/optimize+")]
-       public class NonEventWithLog
-       {
-               public static void Main ()
-               {
-                       var n = new NonEventWithLogSource ();
-                       n.Test1 ();
-               }
-       }
-
-       [Kept]
-       [KeptBaseType (typeof (EventSource))]
-       [KeptMember (".ctor()")]
-
-       [EventSource (Name = "MyCompany")]
-       class NonEventWithLogSource : EventSource
-       {
-
-               [NonEvent]
-               [Kept]
-               internal void Test1 ()
-               {
-                       if (IsEnabled ())
-                               Test2 ();
-               }
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ret"
-               })]
-               private void Test2 ()
-               {
-                       Console.WriteLine ();
-               }
-
-               [NonEvent]
-               private void Test3 ()
-               {
-                       Console.WriteLine ();
-               }
-       }
-}
diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/StubbedMethodWithExceptionHandlers.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/StubbedMethodWithExceptionHandlers.cs
deleted file mode 100644 (file)
index 54c8904..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
-       [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
-       [SetupLinkerArgument ("--exclude-feature", "etw")]
-       // Keep framework code that calls EventSource methods like OnEventCommand
-       [SetupLinkerTrimMode ("skip")]
-       // Used to avoid different compilers generating different IL which can mess up the instruction asserts
-       [SetupCompileArgument ("/optimize+")]
-       public class StubbedMethodWithExceptionHandlers
-       {
-               public static void Main ()
-               {
-                       var b = StubbedMethodWithExceptionHandlers_RemovedEventSource.Log.IsEnabled ();
-                       if (b)
-                               StubbedMethodWithExceptionHandlers_RemovedEventSource.Log.SomeMethod ();
-               }
-       }
-
-       [Kept]
-       [KeptBaseType (typeof (EventSource))]
-       [KeptMember (".ctor()")]
-       [KeptMember (".cctor()")]
-       [EventSource (Name = "MyCompany")]
-       class StubbedMethodWithExceptionHandlers_RemovedEventSource : EventSource
-       {
-               public class Keywords
-               {
-                       public const EventKeywords Page = (EventKeywords) 1;
-
-                       public int Unused;
-               }
-
-               [Kept]
-               public static StubbedMethodWithExceptionHandlers_RemovedEventSource Log = new StubbedMethodWithExceptionHandlers_RemovedEventSource ();
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ret"
-               })]
-               protected override void OnEventCommand (EventCommandEventArgs command)
-               {
-                       try {
-                               Removed ();
-                       } catch {
-                               try {
-                                       Removed ();
-                               } catch {
-                                       Removed ();
-                                       throw;
-                               }
-                               throw;
-                       }
-               }
-
-               [Kept]
-               [ExpectedInstructionSequence (new[]
-               {
-                       "ret"
-               })]
-               [Event (8)]
-               public void SomeMethod ()
-               {
-                       Removed ();
-               }
-
-               public void Removed ()
-               {
-               }
-       }
-}
\ No newline at end of file