From e0f16ffc9ccc45452a3670c80b077ff2b4c52bc0 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 11 Jul 2019 01:21:07 -0700 Subject: [PATCH] [mmptest] Port link-remove-attributes-1 to Unified. Partial fix for #4975. (#6547) Fixes part of https://github.com/xamarin/xamarin-macios/issues/4975. --- tests/mmptest/regression/Makefile | 2 +- .../LinkRemoveAttributes.cs | 42 +++++++++--------- .../link-remove-attributes-1.csproj | 44 +++++-------------- 3 files changed, 32 insertions(+), 56 deletions(-) diff --git a/tests/mmptest/regression/Makefile b/tests/mmptest/regression/Makefile index f6162aace0..33f0bb6709 100644 --- a/tests/mmptest/regression/Makefile +++ b/tests/mmptest/regression/Makefile @@ -26,7 +26,6 @@ DISABLED_TESTS_MONO_4_2 = \ DISABLED_TESTS_MONO_4_4 = \ link-webclient-1 \ link-webclient-3 \ - link-remove-attributes-1 TESTS_UNIFIED = \ custom-bundle-name \ @@ -35,6 +34,7 @@ TESTS_UNIFIED = \ link-keep-resources-2 \ link-posix-1 \ link-preserve-assembly \ + link-remove-attributes-1 \ DISABLED_4_5_TESTS_MONO_4_2 = \ link-httpclient-async \ diff --git a/tests/mmptest/regression/link-remove-attributes-1/LinkRemoveAttributes.cs b/tests/mmptest/regression/link-remove-attributes-1/LinkRemoveAttributes.cs index 49298ddd62..2bf612e963 100644 --- a/tests/mmptest/regression/link-remove-attributes-1/LinkRemoveAttributes.cs +++ b/tests/mmptest/regression/link-remove-attributes-1/LinkRemoveAttributes.cs @@ -5,7 +5,7 @@ using System.Diagnostics; using System.Reflection; using System.Runtime.InteropServices; using System.Xml; -using MonoMac.AppKit; +using AppKit; // Test // * application use some attributes that the linker will remove (unneeded at runtime) @@ -18,7 +18,7 @@ using MonoMac.AppKit; // removed in release builds only [assembly: Debuggable (DebuggableAttribute.DebuggingModes.Default)] -[assembly: MonoMac.Foundation.LinkerSafe] +[assembly: Foundation.LinkerSafe] // not removed [assembly: AssemblyCompany ("Xamarin Inc.")] @@ -33,12 +33,12 @@ namespace Xamarin.Mac.Linker.Test { [System.Obsolete] // [System.Xml.MonoFIX] - [MonoMac.ObjCRuntime.Availability] - [MonoMac.ObjCRuntime.Lion] - [MonoMac.ObjCRuntime.MountainLion] - [MonoMac.ObjCRuntime.Mavericks] - [MonoMac.ObjCRuntime.Since (5,0)] - [MonoMac.ObjCRuntime.ThreadSafe] + [ObjCRuntime.Availability] + [ObjCRuntime.Deprecated (ObjCRuntime.PlatformName.MacOSX)] + [ObjCRuntime.Obsoleted (ObjCRuntime.PlatformName.MacOSX)] + [ObjCRuntime.Introduced (ObjCRuntime.PlatformName.MacOSX)] + [ObjCRuntime.Unavailable (ObjCRuntime.PlatformName.MacOSX)] + [ObjCRuntime.ThreadSafe] [DebuggerDisplay ("")] [DebuggerNonUserCode] @@ -50,12 +50,12 @@ namespace Xamarin.Mac.Linker.Test { class DebugLinkRemoveAttributes { // will be removed - but the instance field will be kept - [MonoMac.Foundation.Preserve] + [Foundation.Preserve] // removed in release builds only [DebuggerBrowsable (DebuggerBrowsableState.Never)] XmlDocument document; - [MonoMac.Foundation.Advice ("")] + [Foundation.Advice ("")] // removed in release builds only [DebuggerHidden] [DebuggerStepperBoundary] @@ -88,13 +88,13 @@ namespace Xamarin.Mac.Linker.Test { try { var type = typeof (DebugLinkRemoveAttributes); CheckPresence (type, "System.ObsoleteAttribute", false); - CheckPresence (type, "MonoMac.Foundation.AdviceAttribute", false); - CheckPresence (type, "MonoMac.ObjCRuntime.AvailabilityAttribute", false); - CheckPresence (type, "MonoMac.ObjCRuntime.LionAttribute", false); - CheckPresence (type, "MonoMac.ObjCRuntime.MountainLionAttribute", false); - CheckPresence (type, "MonoMac.ObjCRuntime.MavericksAttribute", false); - CheckPresence (type, "MonoMac.ObjCRuntime.SinceAttribute", false); - CheckPresence (type, "MonoMac.ObjCRuntime.ThreadSafeAttribute", false); + CheckPresence (type, "Foundation.AdviceAttribute", false); + CheckPresence (type, "ObjCRuntime.AvailabilityAttribute", false); + CheckPresence (type, "ObjCRuntime.LionAttribute", false); + CheckPresence (type, "ObjCRuntime.MountainLionAttribute", false); + CheckPresence (type, "ObjCRuntime.MavericksAttribute", false); + CheckPresence (type, "ObjCRuntime.SinceAttribute", false); + CheckPresence (type, "ObjCRuntime.ThreadSafeAttribute", false); CheckPresence (type, "System.Diagnostics.DebuggerDisplay", debug); CheckPresence (type, "System.Diagnostics.DebuggerNonUserCode", debug); CheckPresence (type, "System.Diagnostics.DebuggerTypeProxy", debug); @@ -102,19 +102,19 @@ namespace Xamarin.Mac.Linker.Test { CheckPresence (type, "System.Runtime.InteropServices.GuidAttribute", true); var assembly = type.Assembly; - CheckPresence (assembly, "MonoMac.Foundation.LinkerSafeAttribute", false); + CheckPresence (assembly, "Foundation.LinkerSafeAttribute", false); CheckPresence (assembly, "System.Diagnostics.DebuggableAttribute", debug); CheckPresence (assembly, "System.Reflection.AssemblyCompanyAttribute", true); var method = type.GetMethod ("CheckPresence", BindingFlags.Static | BindingFlags.NonPublic); - CheckPresence (method, "MonoMac.Foundation.AdviceAttribute", false); + CheckPresence (method, "Foundation.AdviceAttribute", false); CheckPresence (method, "System.Diagnostics.DebuggerHiddenAttribute", debug); CheckPresence (method, "System.Diagnostics.DebuggerStepperBoundaryAttribute", debug); CheckPresence (method, "System.Diagnostics.DebuggerStepThroughAttribute", debug); CheckPresence (method, "System.LoaderOptimizationAttribute", true); var field = type.GetField ("document", BindingFlags.Instance| BindingFlags.NonPublic); - CheckPresence (field, "MonoMac.Foundation.PreserveAttribute", false); + CheckPresence (field, "Foundation.PreserveAttribute", false); CheckPresence (field, "System.Diagnostics.DebuggerBrowsableAttribute", debug); } finally { @@ -122,4 +122,4 @@ namespace Xamarin.Mac.Linker.Test { } } } -} \ No newline at end of file +} diff --git a/tests/mmptest/regression/link-remove-attributes-1/link-remove-attributes-1.csproj b/tests/mmptest/regression/link-remove-attributes-1/link-remove-attributes-1.csproj index 6d32b4e287..dd42a445e3 100644 --- a/tests/mmptest/regression/link-remove-attributes-1/link-remove-attributes-1.csproj +++ b/tests/mmptest/regression/link-remove-attributes-1/link-remove-attributes-1.csproj @@ -6,11 +6,13 @@ 8.0.30703 2.0 {F977D041-B0A5-49DE-815E-B210DBE140A5} - {42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Exe linkremoveattributes1 Resources link-remove-attributes-1 + v2.0 + Xamarin.Mac true @@ -20,18 +22,16 @@ DEBUG; prompt 4 - false - false + True true false + True Mac Developer false false Developer ID Installer - - + Full - false full @@ -39,51 +39,27 @@ bin\Release prompt 4 - false Full - false + True true false Developer ID Application false false Developer ID Installer - - - false - - - full - true - bin\AppStore - prompt - 4 - false - Full - false - true - 3rd Party Mac Developer Installer - true - 3rd Party Mac Developer Application - true - true - false + - - - - - + - + Test.cs