diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index ebe09e79953d..e368fb9daaf4 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -1,4 +1,7 @@ + + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)')) + diff --git a/tests/Makefile b/tests/Makefile index 4036df1cf1b8..66826974952a 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -196,11 +196,11 @@ build-all: $(MAKE) build -C dotnet/UnitTests $(MAKE) build -C rgen $(MAKE) build -C xtro-sharpie - $(MAKE) build-all -C "linker/ios/dont link/dotnet" - $(MAKE) build-all -C "linker/ios/link all/dotnet" - $(MAKE) build-all -C "linker/ios/link sdk/dotnet" - $(MAKE) build-all -C "linker/ios/trimmode copy/dotnet" - $(MAKE) build-all -C "linker/ios/trimmode link/dotnet" + $(MAKE) build-all -C "linker/dont link/dotnet" + $(MAKE) build-all -C "linker/link all/dotnet" + $(MAKE) build-all -C "linker/link sdk/dotnet" + $(MAKE) build-all -C "linker/trimmode copy/dotnet" + $(MAKE) build-all -C "linker/trimmode link/dotnet" $(MAKE) build-all -C fsharp/dotnet $(MAKE) build-all -C interdependent-binding-projects/dotnet $(MAKE) build-all -C introspection/dotnet diff --git a/tests/common/shared-dotnet-test.mk b/tests/common/shared-dotnet-test.mk index d75277b8755c..bd9103275f67 100644 --- a/tests/common/shared-dotnet-test.mk +++ b/tests/common/shared-dotnet-test.mk @@ -3,29 +3,31 @@ include $(TOP)/mk/colors.mk # this file is meant to be included from tests//dotnet/Makefile +TESTNAME:=$(notdir $(shell dirname "$(CURDIR)")) + build-%: - @echo "Building for $*" + @echo "Building '$(TESTNAME)' for $*" $(Q) $(MAKE) -C $* build build-all: $(foreach platform,$(DOTNET_PLATFORMS),build-$(platform)) - @echo "Build completed" + @echo "Build of '$(TESTNAME)' completed" build-desktop: $(foreach platform,$(DOTNET_DESKTOP_PLATFORMS),build-$(platform)) - @echo "Build completed" + @echo "Build of '$(TESTNAME)' for desktop platforms completed" run-%: - @echo "Running for $*" + @echo "Running '$(TESTNAME)' for $*" $(Q) $(MAKE) -C $* run run-all: $(foreach platform,$(DOTNET_DESKTOP_PLATFORMS),run-$(platform)) - @echo "Run complete" + @echo "Run of '$(TESTNAME)' complete" remote-%: - @echo "Running remotely for $*" + @echo "Running '$(TESTNAME)' remotely for $*" $(Q) $(MAKE) -C $* run-remote run-remote-all: $(foreach platform,$(DOTNET_DESKTOP_PLATFORMS),remote-$(platform)) - @echo "Run complete" + @echo "Run of '$(TESTNAME)' complete" reload: $(Q) $(MAKE) -C $(TOP)/tests/dotnet reload diff --git a/tests/linker/BaseOptimizeGeneratedCodeTest.cs b/tests/linker/BaseOptimizeGeneratedCodeTest.cs index a659b8c448be..11c275547810 100644 --- a/tests/linker/BaseOptimizeGeneratedCodeTest.cs +++ b/tests/linker/BaseOptimizeGeneratedCodeTest.cs @@ -114,7 +114,7 @@ public void SetupBlockPerfTest () //Console.WriteLine ("Speedup: {0}x", unoptimizedWatch.ElapsedTicks / (double) optimizedWatch.ElapsedTicks); // My testing found a 12-16x speedup on device and a 15-20x speedup in the simulator/desktop. // Setting to 6 to have a margin for random stuff happening, but this may still have to be adjusted. -#if NET && __TVOS__ +#if __TVOS__ // Our optimization is correct, but the test case runs into https://github.com/dotnet/runtime/issues/58939 which overpowers most of our optimization gains. var speedup = 1.2; // Seems to be around 1.4/1.5, so let's see if 1.2 is consistently passing. #else diff --git a/tests/linker/CommonDontLinkTest.cs b/tests/linker/CommonDontLinkTest.cs deleted file mode 100644 index c4f7c16f18a9..000000000000 --- a/tests/linker/CommonDontLinkTest.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections; -using System.Reflection; - -using NUnit.Framework; - -using Foundation; - -namespace DontLink { - - [TestFixture] - public class CommonDontLinkTest { - -#if NET - [Ignore ("This test accesses internal implementation details for TypeConverters, which has changed in .NET.")] -#endif - [Test] - public void TypeDescriptorCanary () - { - // this will fail is ReflectTypeDescriptionProvider.cs is modified - var rtdp = typeof (System.ComponentModel.BooleanConverter).Assembly.GetType ("System.ComponentModel.ReflectTypeDescriptionProvider"); - Assert.NotNull (rtdp, "type"); - var p = rtdp.GetProperty ("IntrinsicTypeConverters", BindingFlags.Static | BindingFlags.NonPublic); - Assert.NotNull (p, "property"); - var ht = (Hashtable) p.GetGetMethod (true).Invoke (null, null); - Assert.NotNull (ht, "Hashtable"); - - Assert.That (ht.Count, Is.EqualTo (26), "Count"); - - foreach (var item in ht.Values) { - var name = item.ToString (); - switch (name) { - case "System.ComponentModel.DateTimeOffsetConverter": - case "System.ComponentModel.DecimalConverter": - case "System.ComponentModel.StringConverter": - case "System.ComponentModel.SByteConverter": - case "System.ComponentModel.CollectionConverter": - case "System.ComponentModel.ReferenceConverter": - case "System.ComponentModel.TypeConverter": - case "System.ComponentModel.DateTimeConverter": - case "System.ComponentModel.UInt64Converter": - case "System.ComponentModel.ArrayConverter": - case "System.ComponentModel.NullableConverter": - case "System.ComponentModel.Int16Converter": - case "System.ComponentModel.CultureInfoConverter": - case "System.ComponentModel.SingleConverter": - case "System.ComponentModel.UInt16Converter": - case "System.ComponentModel.GuidConverter": - case "System.ComponentModel.DoubleConverter": - case "System.ComponentModel.Int32Converter": - case "System.ComponentModel.TimeSpanConverter": - case "System.ComponentModel.CharConverter": - case "System.ComponentModel.Int64Converter": - case "System.ComponentModel.BooleanConverter": - case "System.ComponentModel.UInt32Converter": - case "System.ComponentModel.ByteConverter": - case "System.ComponentModel.EnumConverter": - break; - default: - Assert.Fail ($"Unknown type descriptor {name}"); - break; - } - } - } - } -} diff --git a/tests/linker/CommonLinkAllTest.cs b/tests/linker/CommonLinkAllTest.cs index 2c8e6d51cc85..05125503f099 100644 --- a/tests/linker/CommonLinkAllTest.cs +++ b/tests/linker/CommonLinkAllTest.cs @@ -77,11 +77,7 @@ public void TypeConverter_BuiltIn () Assert.NotNull (TypeDescriptor.GetConverter (new BuiltInConverter ()), "BuiltInConverter"); string name = (typeof (BuiltInConverter).GetCustomAttributes (false) [0] as TypeConverterAttribute).ConverterTypeName; -#if NET var typename = $"System.ComponentModel.BooleanConverter, System.ComponentModel.TypeConverter, Version={typeof (int).Assembly.GetName ().Version}, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; -#else - var typename = "System.ComponentModel.BooleanConverter, System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"; -#endif Assert.That (name, Is.EqualTo (typename), "ConverterTypeName"); } @@ -91,11 +87,7 @@ public void TypeConverter_Custom () Assert.NotNull (TypeDescriptor.GetConverter (new TypeDescriptorTest ()), "TypeDescriptorTest"); string name = (typeof (TypeDescriptorTest).GetCustomAttributes (false) [0] as TypeConverterAttribute).ConverterTypeName; -#if NET var typename = "LinkAll.CustomConverter, link all, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"; -#else - var typename = "LinkAll.CustomConverter, link all, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; -#endif Assert.That (name, Is.EqualTo (typename), "ConverterTypeName"); } diff --git a/tests/linker/CommonLinkAnyTest.cs b/tests/linker/CommonLinkAnyTest.cs index 829b4d43752f..2d157ed78d52 100644 --- a/tests/linker/CommonLinkAnyTest.cs +++ b/tests/linker/CommonLinkAnyTest.cs @@ -1,15 +1,21 @@ using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -#if NET +using System.Security.Cryptography; using System.Text.Json; -#endif +using System.Threading; +using System.Threading.Tasks; using Foundation; using ObjCRuntime; using NUnit.Framework; +using MonoTests.System.Net.Http; + namespace LinkAnyTest { // This test is included in both the LinkAll and LinkSdk projects for both iOS and macOS. [TestFixture] @@ -46,7 +52,6 @@ public static void Bug7114 ([CallerFilePath] string filePath = null) Assert.IsNotNull (filePath, "CallerFilePath"); } -#if NET [Test] public void AppContextGetData () { @@ -54,7 +59,6 @@ public void AppContextGetData () Assert.IsNotNull (AppContext.GetData ("APP_PATHS"), "APP_PATHS"); Assert.IsNotNull (AppContext.GetData ("PINVOKE_OVERRIDE"), "PINVOKE_OVERRIDE"); } -#endif [Test] public void BackingFieldInGenericType () @@ -68,7 +72,6 @@ public void BackingFieldInGenericType () GC.KeepAlive (view.HeightAnchor); } -#if NET [Test] public void JsonSerializer_Serialize () { @@ -88,6 +91,66 @@ public void JsonSerializer_Deserialize () var b = JsonSerializer.Deserialize ("[42,3,14,15]"); CollectionAssert.AreEqual (new int [] { 42, 3, 14, 15 }, b, "deserialized array"); } -#endif + + [Test] + public void AES () + { + Assert.NotNull (Aes.Create (), "AES"); + } + + static bool waited; + static bool requestError; + static HttpStatusCode statusCode; + + void TimedWait (Task task) + { + try { + var rv = task.Wait (TimeSpan.FromMinutes (1)); + if (rv) + return; + } catch (AggregateException ae) { + throw ae.InnerExceptions [0]; + } + + TestRuntime.IgnoreInCI ("This test times out randomly in CI due to bad network."); + Assert.Fail ("Test timed out"); + } + + // http://blogs.msdn.com/b/csharpfaq/archive/2012/06/26/understanding-a-simple-async-program.aspx + // ref: https://bugzilla.xamarin.com/show_bug.cgi?id=7114 + static async Task GetWebPageAsync () + { + // do not use GetStringAsync, we are going to miss useful data, such as the result code + using (var client = new HttpClient ()) { + HttpResponseMessage response = await client.GetAsync (NetworkResources.MicrosoftUrl); + if (!response.IsSuccessStatusCode) { + requestError = true; + statusCode = response.StatusCode; + } else { + string content = await response.Content.ReadAsStringAsync (); + waited = true; + bool success = !String.IsNullOrEmpty (content); + Assert.IsTrue (success, $"received {content.Length} bytes"); + } + } + } + + [Test] + public void GetWebPageAsyncTest () + { + var current_sc = SynchronizationContext.Current; + try { + // we do not want the async code to get back to the AppKit thread, hanging the process + SynchronizationContext.SetSynchronizationContext (null); + TimedWait (GetWebPageAsync ()); + if (requestError) { + Assert.Inconclusive ($"Test cannot be trusted. Issues performing the request. Status code '{statusCode}'"); + } else { + Assert.IsTrue (waited, "async/await worked"); + } + } finally { + SynchronizationContext.SetSynchronizationContext (current_sc); + } + } } } diff --git a/tests/linker/Makefile b/tests/linker/Makefile new file mode 100644 index 000000000000..83892b280194 --- /dev/null +++ b/tests/linker/Makefile @@ -0,0 +1,10 @@ +TOP = ../.. + +include $(TOP)/Make.config + +build-all: + $(Q) $(MAKE) build-all -C "dont link/dotnet" + $(Q) $(MAKE) build-all -C "link all/dotnet" + $(Q) $(MAKE) build-all -C "link sdk/dotnet" + $(Q) $(MAKE) build-all -C "trimmode copy/dotnet" + $(Q) $(MAKE) build-all -C "trimmode link/dotnet" diff --git a/tests/linker/ios/README.md b/tests/linker/README.md similarity index 100% rename from tests/linker/ios/README.md rename to tests/linker/README.md diff --git a/tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/Contents.json b/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/Contents.json similarity index 100% rename from tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/Contents.json rename to tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/Contents.json diff --git a/tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png b/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png similarity index 100% rename from tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png rename to tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png diff --git a/tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-57.png b/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-57.png similarity index 100% rename from tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-57.png rename to tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-57.png diff --git a/tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png b/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png similarity index 100% rename from tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png rename to tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png diff --git a/tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png b/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png similarity index 100% rename from tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png rename to tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png diff --git a/tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-72.png b/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-72.png similarity index 100% rename from tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-72.png rename to tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-72.png diff --git a/tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png b/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png similarity index 100% rename from tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png rename to tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png diff --git a/tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-76.png b/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-76.png similarity index 100% rename from tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-76.png rename to tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-76.png diff --git a/tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png b/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png similarity index 100% rename from tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png rename to tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png diff --git a/tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png b/tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png similarity index 100% rename from tests/linker/ios/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png rename to tests/linker/dont link/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png diff --git a/tests/linker/ios/dont link/BoardingPass.pkpass b/tests/linker/dont link/BoardingPass.pkpass similarity index 100% rename from tests/linker/ios/dont link/BoardingPass.pkpass rename to tests/linker/dont link/BoardingPass.pkpass diff --git a/tests/linker/ios/dont link/CalendarTest.cs b/tests/linker/dont link/CalendarTest.cs similarity index 73% rename from tests/linker/ios/dont link/CalendarTest.cs rename to tests/linker/dont link/CalendarTest.cs index 36a8455a5a10..84366bb0d0fa 100644 --- a/tests/linker/ios/dont link/CalendarTest.cs +++ b/tests/linker/dont link/CalendarTest.cs @@ -18,22 +18,14 @@ public class CalendarTest { public void UmAlQura () { var ci = CultureInfo.GetCultureInfo ("ar"); -#if NET // https://github.com/dotnet/runtime/issues/50859 Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.GregorianCalendar"), "Calendar"); -#else - Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.UmAlQuraCalendar"), "Calendar"); -#endif } [Test] public void Hijri () { var ci = CultureInfo.GetCultureInfo ("ps"); -#if NET // https://github.com/dotnet/runtime/issues/50859 Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.PersianCalendar"), "Calendar"); -#else - Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.HijriCalendar"), "Calendar"); -#endif } [Test] diff --git a/tests/linker/ios/dont link/DontLinkRegressionTests.cs b/tests/linker/dont link/DontLinkRegressionTests.cs similarity index 78% rename from tests/linker/ios/dont link/DontLinkRegressionTests.cs rename to tests/linker/dont link/DontLinkRegressionTests.cs index 20fc1dd391bc..1c72eb141e72 100644 --- a/tests/linker/ios/dont link/DontLinkRegressionTests.cs +++ b/tests/linker/dont link/DontLinkRegressionTests.cs @@ -25,19 +25,6 @@ using NUnit.Framework; namespace DontLink { - -#if !NET - [FileIOPermission (SecurityAction.LinkDemand, AllLocalFiles = FileIOPermissionAccess.AllAccess)] - public class SecurityDeclarationDecoratedUserCode { - - [FileIOPermission (SecurityAction.Assert, AllLocalFiles = FileIOPermissionAccess.NoAccess)] - static public bool Check () - { - return true; - } - } -#endif - [TestFixture] public class DontLinkRegressionTests { @@ -61,16 +48,6 @@ public void RemovedAttributes () Assert.NotNull (Type.GetType ("ObjCRuntime.ThreadSafeAttribute, " + fullname), "ThreadSafeAttribute"); } - [Test] -#if NET - [Ignore ("MulticastDelegate.BeginInvoke isn't supported in .NET (https://github.com/dotnet/runtime/issues/16312)")] -#endif - public void Bug5354 () - { - Action testAction = (string s) => { s.ToString (); }; - testAction.BeginInvoke ("Teszt", null, null); - } - #if !__MACOS__ [Test] public void Autorelease () @@ -88,19 +65,6 @@ public void Autorelease () } #endif // !__MACOS__ -#if !NET - [Test] - public void SecurityDeclaration () - { - // note: security declarations != custom attributes - // we ensure that we can create the type / call the code - Assert.True (SecurityDeclarationDecoratedUserCode.Check (), "call"); - // we ensure that both the permission and the flag are part of the final (non-linked) binary - Assert.NotNull (Type.GetType ("System.Security.Permissions.FileIOPermissionAttribute, mscorlib"), "FileIOPermissionAttribute"); - Assert.NotNull (Type.GetType ("System.Security.Permissions.FileIOPermissionAccess, mscorlib"), "FileIOPermissionAccess"); - } -#endif - [Test] public void DefaultEncoding () { @@ -152,11 +116,7 @@ public void ProcessStart_NotSupported () } var all_properties = type.GetProperties (); - var notsupported_properties = new string [] { "StandardError", "StandardInput", "StandardOutput", -#if !NET - "StartInfo" -#endif - }; + var notsupported_properties = new string [] { "StandardError", "StandardInput", "StandardOutput", }; foreach (var notsupported_property in notsupported_properties) { foreach (var property in all_properties.Where ((v) => v.Name == notsupported_property)) { if (property.GetGetMethod () is not null) diff --git a/tests/linker/ios/dont link/Info.plist b/tests/linker/dont link/Info.plist similarity index 100% rename from tests/linker/ios/dont link/Info.plist rename to tests/linker/dont link/Info.plist diff --git a/tests/linker/ios/dont link/LaunchScreen.storyboard b/tests/linker/dont link/LaunchScreen.storyboard similarity index 100% rename from tests/linker/ios/dont link/LaunchScreen.storyboard rename to tests/linker/dont link/LaunchScreen.storyboard diff --git a/tests/linker/ios/dont link/TableViewSourceTest.cs b/tests/linker/dont link/TableViewSourceTest.cs similarity index 100% rename from tests/linker/ios/dont link/TableViewSourceTest.cs rename to tests/linker/dont link/TableViewSourceTest.cs diff --git a/tests/linker/ios/dont link/dotnet/MacCatalyst/Info.plist b/tests/linker/dont link/dotnet/MacCatalyst/Info.plist similarity index 100% rename from tests/linker/ios/dont link/dotnet/MacCatalyst/Info.plist rename to tests/linker/dont link/dotnet/MacCatalyst/Info.plist diff --git a/tests/linker/ios/dont link/dotnet/MacCatalyst/Makefile b/tests/linker/dont link/dotnet/MacCatalyst/Makefile similarity index 100% rename from tests/linker/ios/dont link/dotnet/MacCatalyst/Makefile rename to tests/linker/dont link/dotnet/MacCatalyst/Makefile diff --git a/tests/linker/ios/dont link/dotnet/MacCatalyst/dont link.csproj b/tests/linker/dont link/dotnet/MacCatalyst/dont link.csproj similarity index 100% rename from tests/linker/ios/dont link/dotnet/MacCatalyst/dont link.csproj rename to tests/linker/dont link/dotnet/MacCatalyst/dont link.csproj diff --git a/tests/linker/ios/link all/dotnet/Makefile b/tests/linker/dont link/dotnet/Makefile similarity index 72% rename from tests/linker/ios/link all/dotnet/Makefile rename to tests/linker/dont link/dotnet/Makefile index 07a44358c22d..a97c2cbb3d5d 100644 --- a/tests/linker/ios/link all/dotnet/Makefile +++ b/tests/linker/dont link/dotnet/Makefile @@ -1,2 +1,2 @@ -TOP=../../../../.. +TOP=../../../.. include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/linker/ios/dont link/dotnet/iOS/Info.plist b/tests/linker/dont link/dotnet/iOS/Info.plist similarity index 100% rename from tests/linker/ios/dont link/dotnet/iOS/Info.plist rename to tests/linker/dont link/dotnet/iOS/Info.plist diff --git a/tests/linker/ios/dont link/dotnet/iOS/Makefile b/tests/linker/dont link/dotnet/iOS/Makefile similarity index 100% rename from tests/linker/ios/dont link/dotnet/iOS/Makefile rename to tests/linker/dont link/dotnet/iOS/Makefile diff --git a/tests/linker/ios/dont link/dotnet/iOS/dont link.csproj b/tests/linker/dont link/dotnet/iOS/dont link.csproj similarity index 100% rename from tests/linker/ios/dont link/dotnet/iOS/dont link.csproj rename to tests/linker/dont link/dotnet/iOS/dont link.csproj diff --git a/tests/linker/ios/dont link/dotnet/macOS/Info.plist b/tests/linker/dont link/dotnet/macOS/Info.plist similarity index 100% rename from tests/linker/ios/dont link/dotnet/macOS/Info.plist rename to tests/linker/dont link/dotnet/macOS/Info.plist diff --git a/tests/linker/ios/dont link/dotnet/macOS/Makefile b/tests/linker/dont link/dotnet/macOS/Makefile similarity index 100% rename from tests/linker/ios/dont link/dotnet/macOS/Makefile rename to tests/linker/dont link/dotnet/macOS/Makefile diff --git a/tests/linker/ios/dont link/dotnet/macOS/dont link.csproj b/tests/linker/dont link/dotnet/macOS/dont link.csproj similarity index 100% rename from tests/linker/ios/dont link/dotnet/macOS/dont link.csproj rename to tests/linker/dont link/dotnet/macOS/dont link.csproj diff --git a/tests/linker/ios/dont link/dotnet/shared.csproj b/tests/linker/dont link/dotnet/shared.csproj similarity index 89% rename from tests/linker/ios/dont link/dotnet/shared.csproj rename to tests/linker/dont link/dotnet/shared.csproj index e842d33f8154..a3c10b18dd75 100644 --- a/tests/linker/ios/dont link/dotnet/shared.csproj +++ b/tests/linker/dont link/dotnet/shared.csproj @@ -7,8 +7,7 @@ dont link None $(MtouchLink) - $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\..\..')) - $(RootTestsDirectory)\linker\ios\dont link + $(RootTestsDirectory)\linker\dont link true @@ -30,7 +29,7 @@ - + @@ -47,9 +46,6 @@ - - CommonDontLinkTest.cs - diff --git a/tests/linker/ios/dont link/dotnet/shared.mk b/tests/linker/dont link/dotnet/shared.mk similarity index 67% rename from tests/linker/ios/dont link/dotnet/shared.mk rename to tests/linker/dont link/dotnet/shared.mk index 38070b2b407c..12f4233f2a4f 100644 --- a/tests/linker/ios/dont link/dotnet/shared.mk +++ b/tests/linker/dont link/dotnet/shared.mk @@ -1,3 +1,3 @@ -TOP=../../../../../.. +TOP=../../../../.. include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/linker/ios/dont link/dotnet/tvOS/Info.plist b/tests/linker/dont link/dotnet/tvOS/Info.plist similarity index 100% rename from tests/linker/ios/dont link/dotnet/tvOS/Info.plist rename to tests/linker/dont link/dotnet/tvOS/Info.plist diff --git a/tests/linker/ios/dont link/dotnet/tvOS/Makefile b/tests/linker/dont link/dotnet/tvOS/Makefile similarity index 100% rename from tests/linker/ios/dont link/dotnet/tvOS/Makefile rename to tests/linker/dont link/dotnet/tvOS/Makefile diff --git a/tests/linker/ios/dont link/dotnet/tvOS/dont link.csproj b/tests/linker/dont link/dotnet/tvOS/dont link.csproj similarity index 100% rename from tests/linker/ios/dont link/dotnet/tvOS/dont link.csproj rename to tests/linker/dont link/dotnet/tvOS/dont link.csproj diff --git a/tests/linker/ios/dont link/dont link.csproj b/tests/linker/ios/dont link/dont link.csproj deleted file mode 100644 index 13ab8e61b730..000000000000 --- a/tests/linker/ios/dont link/dont link.csproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - Debug - iPhoneSimulator - 8.0.30703 - 2.0 - {839212D5-C25B-4284-AA96-59C3872B8184} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - dontlink - dont link - Xamarin.iOS - obj\$(Platform)\$(Configuration)-unified - - latest - PackageReference - ..\..\.. - true - - - True - full - False - bin\iPhoneSimulator\$(Configuration)-unified - DEBUG;MONOTOUCH;$(DefineConstants) - prompt - 4 - None - True - -v -v - x86_64 - - - none - true - bin\iPhoneSimulator\$(Configuration)-unified - prompt - 4 - None - - x86_64 - MONOTOUCH;$(DefineConstants) - - - True - full - False - bin\iPhone\$(Configuration)-unified - DEBUG;MONOTOUCH;$(DefineConstants) - prompt - 4 - True - iPhone Developer - None - - ARM64 - - - none - true - bin\iPhone\$(Configuration)-unified - prompt - 4 - iPhone Developer - -v -v - True - None - ARM64 - MONOTOUCH;$(DefineConstants) - - - - - - - - - {F611ED96-54B5-4975-99BB-12F50AF95936} - Touch.Client-iOS - - - - - Info.plist - - - - - - - - - - - CommonDontLinkTest.cs - - - - - - - - - - - - - - - - - - - - - - - - - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D} - BundledResources - - - diff --git a/tests/linker/ios/link all/MEFTests.cs b/tests/linker/ios/link all/MEFTests.cs deleted file mode 100644 index 1e3c42562f15..000000000000 --- a/tests/linker/ios/link all/MEFTests.cs +++ /dev/null @@ -1,79 +0,0 @@ -#if !NET // https://github.com/xamarin/xamarin-macios/issues/11710 -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.ComponentModel.Composition.Hosting; -using System.Linq; -using System.Reflection; -using Foundation; -using NUnit.Framework; - -namespace LinkAll.Mef { - - // From Desk Case 70807 - public interface IStorageType { - } - - [System.ComponentModel.Composition.Export (typeof (IStorageType))] - [Preserve (AllMembers = true)] - public class Storage : IStorageType { - } - - [Preserve (AllMembers = true)] - [TestFixture] - public class MEFTests { - CompositionContainer _container; - - [ImportMany] - public IEnumerable> StorageTypes { get; set; } - - [Test] - public void MEF_Basic_Import_Test () - { - var catalog = new AggregateCatalog (); - //Adds all the parts found in the same assembly - catalog.Catalogs.Add (new AssemblyCatalog (typeof (MEFTests).Assembly)); - - //Create the CompositionContainer with the parts in the catalog - _container = new CompositionContainer (catalog); - - this._container.SatisfyImportsOnce (this); - - Assert.IsTrue (StorageTypes.Count () > 0, "No MEF imports found?"); - } - - [Test] - public void ExportFactoryCreator () - { - // the above code makes sure that ExportFactoryCreator is present - var efc = Type.GetType ("System.ComponentModel.Composition.ReflectionModel.ExportFactoryCreator, System.ComponentModel.Composition"); - Assert.NotNull (efc, "ExportFactoryCreator"); - - // and there's nothing else that refers to them - hence bug: https://bugzilla.xamarin.com/show_bug.cgi?id=29063 - // as it's used thru reflection in CreateStronglyTypedExportFactoryFactory - var t = efc.GetMethod ("CreateStronglyTypedExportFactoryOfT", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); // same binding flags as MS code - Assert.NotNull (t, "CreateStronglyTypedExportFactoryOfT"); - var tm = efc.GetMethod ("CreateStronglyTypedExportFactoryOfTM", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); // same binding flags as MS code - Assert.NotNull (tm, "CreateStronglyTypedExportFactoryOfTM"); - } - - [Test] - public void ExportServices () - { - var es = Type.GetType ("System.ComponentModel.Composition.ExportServices, System.ComponentModel.Composition"); - Assert.NotNull (es, "ExportServices"); - // unlike the test code for ExportFactoryCreator the method can be marked by other call site, so this test is not 100% conclusive - - // used, thru reflection, from CreateStronglyTypedLazyFactory method - var t = es.GetMethod ("CreateStronglyTypedLazyOfT", BindingFlags.NonPublic | BindingFlags.Static); // same binding flags as MS code - Assert.NotNull (t, "CreateStronglyTypedLazyOfT"); - var tm = es.GetMethod ("CreateStronglyTypedLazyOfTM", BindingFlags.NonPublic | BindingFlags.Static); // same binding flags as MS code - Assert.NotNull (tm, "CreateStronglyTypedLazyOfTM"); - - // used, thru reflection, from CreateSemiStronglyTypedLazyFactory method - var l = es.GetMethod ("CreateSemiStronglyTypedLazy", BindingFlags.NonPublic | BindingFlags.Static); // same binding flags as MS code - Assert.NotNull (l, "CreateSemiStronglyTypedLazy"); - } - } -} -#endif // !NET diff --git a/tests/linker/ios/link all/link all.csproj b/tests/linker/ios/link all/link all.csproj deleted file mode 100644 index acb9d3e9291c..000000000000 --- a/tests/linker/ios/link all/link all.csproj +++ /dev/null @@ -1,173 +0,0 @@ - - - - Debug - iPhoneSimulator - 8.0.30703 - 2.0 - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - linkall - link all - Xamarin.iOS - obj\$(Platform)\$(Configuration)-unified - - latest - PackageReference - ..\..\.. - true - - - True - full - False - bin\iPhoneSimulator\$(Configuration)-unified - DEBUG;$(DefineConstants) - prompt - 4 - True - Full - mideast,other - --registrar=static --optimize=all,-remove-dynamic-registrar,-force-rejected-types-removal - x86_64 - true - - - none - True - bin\iPhoneSimulator\$(Configuration)-unified - prompt - 4 - Full - mideast,other - x86_64 - $(DefineConstants) - --registrar:static --optimize=all,-remove-dynamic-registrar,-force-rejected-types-removal - true - - - True - full - False - bin\iPhone\$(Configuration)-unified - DEBUG;$(DefineConstants) - prompt - 4 - iPhone Developer - True - Full - mideast,other - ARM64 - -gcc_flags="-UhoItsB0rken" --optimize=all,-remove-dynamic-registrar,-force-rejected-types-removal - true - true - - - none - True - bin\iPhone\$(Configuration)-unified - prompt - 4 - iPhone Developer - Full - mideast,other - True - ARM64 - --optimize=all,-remove-dynamic-registrar,-force-rejected-types-removal - $(DefineConstants) - true - - - - - - - - - - - - - - {F611ED96-54B5-4975-99BB-12F50AF95936} - Touch.Client-iOS - - - - - Info.plist - - - - - - - - - - - - - - - OptimizeGeneratedCodeTest.cs - - - - - - - - - ReflectionTest.cs - - - - - - TestRuntime.cs - - - CommonLinkAllTest.cs - - - CommonLinkAnyTest.cs - - - NetworkResources.cs - - - - - Tamarin.pdf - - - - - - - - - - - - - - - - - - - - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D} - BundledResources - - - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA} - bindings-test - - - - - diff --git a/tests/linker/ios/link sdk/HttpClientTest.cs b/tests/linker/ios/link sdk/HttpClientTest.cs deleted file mode 100644 index 629349f0fde8..000000000000 --- a/tests/linker/ios/link sdk/HttpClientTest.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Net.Http; -using System.Threading.Tasks; -using Foundation; -using NUnit.Framework; -using MonoTests.System.Net.Http; - - -namespace LinkSdk.Net.Http { - - [TestFixture] - [Preserve (AllMembers = true)] - public class HttpClientTest { - - async Task Get (HttpClient client) - { - return await client.GetStringAsync (NetworkResources.XamarinUrl); - } - - string Get (HttpMessageHandler handler) - { - using (var client = new HttpClient (handler)) { - var get = Get (client); - get.Wait (); - return get.Result; - } - } - - [Test] - public void ManagedSimple () - { - Assert.NotNull (Get (new HttpClientHandler ()), "HttpClientHandler"); - } - - [Test] - public void NSSimple () - { - Assert.NotNull (Get (new NSUrlSessionHandler ()), "NSUrlSessionHandler"); - } - - // same HttpClient and handler doing two simultaneous calls - void DualGet (HttpMessageHandler handler) - { - using (var client = new HttpClient (handler)) { - var get1 = Get (client); - var get2 = Get (client); - get1.Wait (); - get2.Wait (); - } - } - - [Test] - public void ManagedDual () - { - DualGet (new HttpClientHandler ()); - } - - [Test] - public void NSDual () - { - DualGet (new NSUrlSessionHandler ()); - } - - [Test] - public void CFDual () - { - DualGet (new CFNetworkHandler ()); - } - - Task Get302 (HttpClient client) - { - return Task.Run (async () => await client.GetStringAsync (NetworkResources.Httpbin.GetRedirectUrl (1))); - } - - void Get302 (HttpClient client, bool allowRedirect) - { - var result = Get302 (client); - try { - result.Wait (); - if (!allowRedirect) - Assert.Fail ("Redirection *dis*allowed - assert should not be reached"); - Assert.That (result.Result, Contains.Substring ("You have reached the target"), "true"); - } catch (AggregateException ae) { - if (allowRedirect) - Assert.Fail ("Redirection allowed - assert should not be reached {0}", ae); - var inner = ae.InnerException; - Assert.That (inner is HttpRequestException, "HttpRequestException"); - Assert.That (inner.Message, Contains.Substring ("302 (Found)"), "302"); - } - } - - [Test] - public void Managed302_Allowed () - { - var handler = new HttpClientHandler (); - handler.AllowAutoRedirect = true; - var client = new HttpClient (handler); - Get302 (client, allowRedirect: handler.AllowAutoRedirect); - } - - [Test] - public void Managed302_Disallowed () - { - var handler = new HttpClientHandler (); - handler.AllowAutoRedirect = false; - var client = new HttpClient (handler); - Get302 (client, allowRedirect: handler.AllowAutoRedirect); - } - - [Test] - public void NS302_Allowed () - { - var handler = new NSUrlSessionHandler (); - handler.AllowAutoRedirect = true; - var client = new HttpClient (handler); - Get302 (client, allowRedirect: handler.AllowAutoRedirect); - } - - [Test] - public void NS302_Disallowed () - { - var handler = new NSUrlSessionHandler (); - handler.AllowAutoRedirect = false; - var client = new HttpClient (handler); - Get302 (client, allowRedirect: handler.AllowAutoRedirect); - } - - //[Test] - public void CFSimple () - { - Assert.NotNull (Get (new CFNetworkHandler ()), "CFNetworkHandler"); - } - - [Test] - public void CF302_Allowed () - { - var handler = new CFNetworkHandler (); - handler.AllowAutoRedirect = true; - var client = new HttpClient (handler); - Get302 (client, allowRedirect: handler.AllowAutoRedirect); - } - - [Test] - public void CF302_Disallowed () - { - var handler = new CFNetworkHandler (); - handler.AllowAutoRedirect = false; - var client = new HttpClient (handler); - Get302 (client, allowRedirect: handler.AllowAutoRedirect); - } - } -} diff --git a/tests/linker/ios/link sdk/PclTest.cs b/tests/linker/ios/link sdk/PclTest.cs deleted file mode 100644 index f694c22f687a..000000000000 --- a/tests/linker/ios/link sdk/PclTest.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.IO; -using System.Net; -using System.ServiceModel; -#if !NET -using System.ServiceModel.Channels; -#endif -using System.Windows.Input; -using System.Xml; -using Foundation; -using ObjCRuntime; -using NUnit.Framework; - -namespace LinkSdk { - - [TestFixture] - [Preserve (AllMembers = true)] - public class PclTest { - - [Test] - public void Corlib () - { - BinaryWriter bw = new BinaryWriter (Stream.Null); - bw.Dispose (); - } - - [Test] - public void System () - { - const string url = "http://www.google.com"; - Uri uri = new Uri (url); - - Assert.False (this is ICommand, "ICommand"); - - HttpWebRequest hwr = WebRequest.CreateHttp (uri); - try { - Assert.True (hwr.SupportsCookieContainer, "SupportsCookieContainer"); - } catch (NotImplementedException) { - // feature is not available, but the symbol itself is needed - } - - WebResponse wr = hwr.GetResponse (); - try { - Assert.True (wr.SupportsHeaders, "SupportsHeaders"); - } catch (NotImplementedException) { - // feature is not available, but the symbol itself is needed - } - wr.Dispose (); - - try { - Assert.NotNull (WebRequest.CreateHttp (url)); - } catch (NotImplementedException) { - // feature is not available, but the symbol itself is needed - } - - try { - Assert.NotNull (WebRequest.CreateHttp (uri)); - } catch (NotImplementedException) { - // feature is not available, but the symbol itself is needed - } - } - -#if !NET - [Test] - public void ServiceModel () - { - AddressHeaderCollection ahc = new AddressHeaderCollection (); - try { - ahc.FindAll ("name", "namespace"); - } catch (NotImplementedException) { - // feature is not available, but the symbol itself is needed - } - - try { - FaultException.CreateFault (new TestFault (), String.Empty, Array.Empty ()); - } catch (NotImplementedException) { - // feature is not available, but the symbol itself is needed - } - } - - class TestFault : MessageFault { - public override FaultCode Code => throw new NotImplementedException (); - public override bool HasDetail => throw new NotImplementedException (); - public override FaultReason Reason => throw new NotImplementedException (); - protected override void OnWriteDetailContents (XmlDictionaryWriter writer) - { - throw new NotImplementedException (); - } - } -#endif - - [Test] - public void Xml () - { - try { - XmlConvert.VerifyPublicId (String.Empty); - } catch (NotImplementedException) { - // feature is not available, but the symbol itself is needed - } - - try { - XmlConvert.VerifyWhitespace (String.Empty); - } catch (NotImplementedException) { - // feature is not available, but the symbol itself is needed - } - - try { - XmlConvert.VerifyXmlChars (String.Empty); - } catch (NotImplementedException) { - // feature is not available, but the symbol itself is needed - } - - var xr = XmlReader.Create (Stream.Null); - xr.Dispose (); - - var xw = XmlWriter.Create (Stream.Null); - xw.Dispose (); - - XmlReaderSettings xrs = new XmlReaderSettings (); - xrs.DtdProcessing = DtdProcessing.Ignore; - } - } -} diff --git a/tests/linker/ios/link sdk/link sdk.csproj b/tests/linker/ios/link sdk/link sdk.csproj deleted file mode 100644 index 79e6ccb7f240..000000000000 --- a/tests/linker/ios/link sdk/link sdk.csproj +++ /dev/null @@ -1,171 +0,0 @@ - - - - Debug - iPhoneSimulator - 8.0.30703 - 2.0 - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - linksdk - link sdk - Xamarin.iOS - obj\$(Platform)\$(Configuration)-unified - - latest - PackageReference - ..\..\.. - true - - - True - full - False - bin\iPhoneSimulator\$(Configuration)-unified - DEBUG;;$(DefineConstants) - prompt - 4 - True - -v -v -disable-thread-check -xml=${ProjectDir}/extra-linker-defs.xml - x86_64 - SdkOnly - true - false - - - none - True - bin\iPhoneSimulator\$(Configuration)-unified - prompt - 4 - -v -v -xml=${ProjectDir}/extra-linker-defs.xml - x86_64 - DO_NOT_REMOVE;;$(DefineConstants) - true - - - True - full - False - bin\iPhone\$(Configuration)-unified - DEBUG;$(DefineConstants) - prompt - 4 - True - iPhone Developer - -v -v -xml=${ProjectDir}/extra-linker-defs.xml "--dlsym:-link sdk" -gcc_flags="-UhoItsB0rken" - ARM64 - true - true - - - none - True - bin\iPhone\$(Configuration)-unified - prompt - 4 - iPhone Developer - -v -v -xml=${ProjectDir}/extra-linker-defs.xml "--dlsym:-link sdk" - True - ARM64 - DO_NOT_REMOVE;$(DefineConstants) - true - - - - - - - - - - - - support.dll - - - - - - - - - - {F611ED96-54B5-4975-99BB-12F50AF95936} - Touch.Client-iOS - - - - - Info.plist - - - - - - - - - - - - - - - - - - - - - - - - - - - TestRuntime.cs - - - ILReader.cs - - - CommonLinkSdkTest.cs - - - CommonLinkAnyTest.cs - - - - NetworkResources.cs - - - - - - - - - - - - - - - - - - - - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D} - BundledResources - - - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA} - bindings-test - - - - - diff --git a/tests/linker/ios/trimmode link/dotnet/Makefile b/tests/linker/ios/trimmode link/dotnet/Makefile deleted file mode 100644 index 07a44358c22d..000000000000 --- a/tests/linker/ios/trimmode link/dotnet/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -TOP=../../../../.. -include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/linker/ios/trimmode link/dotnet/shared.mk b/tests/linker/ios/trimmode link/dotnet/shared.mk deleted file mode 100644 index 38070b2b407c..000000000000 --- a/tests/linker/ios/trimmode link/dotnet/shared.mk +++ /dev/null @@ -1,3 +0,0 @@ -TOP=../../../../../.. - -include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/Contents.json b/tests/linker/link all/Assets.xcassets/AppIcons.appiconset/Contents.json similarity index 100% rename from tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/Contents.json rename to tests/linker/link all/Assets.xcassets/AppIcons.appiconset/Contents.json diff --git a/tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png b/tests/linker/link all/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png similarity index 100% rename from tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png rename to tests/linker/link all/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png diff --git a/tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-57.png b/tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-57.png similarity index 100% rename from tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-57.png rename to tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-57.png diff --git a/tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png b/tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png similarity index 100% rename from tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png rename to tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png diff --git a/tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png b/tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png similarity index 100% rename from tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png rename to tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png diff --git a/tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-72.png b/tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-72.png similarity index 100% rename from tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-72.png rename to tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-72.png diff --git a/tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png b/tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png similarity index 100% rename from tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png rename to tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png diff --git a/tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-76.png b/tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-76.png similarity index 100% rename from tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-76.png rename to tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-76.png diff --git a/tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png b/tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png similarity index 100% rename from tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png rename to tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png diff --git a/tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png b/tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png similarity index 100% rename from tests/linker/ios/link all/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png rename to tests/linker/link all/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png diff --git a/tests/linker/ios/link all/AttributeTest.cs b/tests/linker/link all/AttributeTest.cs similarity index 85% rename from tests/linker/ios/link all/AttributeTest.cs rename to tests/linker/link all/AttributeTest.cs index 668a6f4896bf..924a77760aa7 100644 --- a/tests/linker/ios/link all/AttributeTest.cs +++ b/tests/linker/link all/AttributeTest.cs @@ -105,29 +105,13 @@ public CustomAttributeObject (object type) public class CustomTypeO { } -#if !NET - [FileIOPermission (SecurityAction.LinkDemand, AllLocalFiles = FileIOPermissionAccess.AllAccess)] - public class SecurityDeclarationDecoratedUserCode { - - [FileIOPermission (SecurityAction.Assert, AllLocalFiles = FileIOPermissionAccess.NoAccess)] - static public bool Check () - { - return true; - } - } -#endif - [TestFixture] // we want the tests to be available because we use the linker [Preserve (AllMembers = true)] public class AttributeTest { // Good enough to fool linker to abort the tracking -#if NET static string mscorlib = "System.Private.CoreLib"; -#else - static string mscorlib = "mscorlib"; -#endif [Test] public void DebugAssemblyAttributes () @@ -222,18 +206,5 @@ public void CustomAttributesWithTypes () //Assert.That (to.Count (), Is.EqualTo (1), "Object"); //Assert.NotNull (Type.GetType ("LinkAll.Attributes.CustomTypeO"), "CustomTypeO"); } - -#if !NET - [Test] - public void SecurityDeclaration () - { - // note: security declarations != custom attributes - // we ensure that we can create the type / call the code - Assert.True (SecurityDeclarationDecoratedUserCode.Check (), "call"); - // we ensure that both the permission and the flag are NOT part of the final/linked binary (link all removes security declarations) - Assert.Null (Type.GetType ("System.Security.Permissions.FileIOPermissionAttribute, " + mscorlib), "FileIOPermissionAttribute"); - Assert.Null (Type.GetType ("System.Security.Permissions.FileIOPermissionAccess, " + mscorlib), "FileIOPermissionAccess"); - } -#endif } } diff --git a/tests/linker/ios/link all/CalendarTest.cs b/tests/linker/link all/CalendarTest.cs similarity index 73% rename from tests/linker/ios/link all/CalendarTest.cs rename to tests/linker/link all/CalendarTest.cs index c8b2e55a47f2..67e40a5bbb0d 100644 --- a/tests/linker/ios/link all/CalendarTest.cs +++ b/tests/linker/link all/CalendarTest.cs @@ -18,22 +18,14 @@ public class CalendarTest { public void UmAlQura () { var ci = CultureInfo.GetCultureInfo ("ar"); -#if NET // https://github.com/dotnet/runtime/issues/50859 Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.GregorianCalendar"), "Calendar"); -#else - Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.UmAlQuraCalendar"), "Calendar"); -#endif } [Test] public void Hijri () { var ci = CultureInfo.GetCultureInfo ("ps"); -#if NET // https://github.com/dotnet/runtime/issues/50859 Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.PersianCalendar"), "Calendar"); -#else - Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.HijriCalendar"), "Calendar"); -#endif } [Test] diff --git a/tests/linker/ios/link all/ClassLayoutTest.cs b/tests/linker/link all/ClassLayoutTest.cs similarity index 100% rename from tests/linker/ios/link all/ClassLayoutTest.cs rename to tests/linker/link all/ClassLayoutTest.cs diff --git a/tests/linker/ios/link all/DataContractTest.cs b/tests/linker/link all/DataContractTest.cs similarity index 100% rename from tests/linker/ios/link all/DataContractTest.cs rename to tests/linker/link all/DataContractTest.cs diff --git a/tests/linker/ios/link all/Info.plist b/tests/linker/link all/Info.plist similarity index 100% rename from tests/linker/ios/link all/Info.plist rename to tests/linker/link all/Info.plist diff --git a/tests/linker/ios/link all/InterfacesTest.cs b/tests/linker/link all/InterfacesTest.cs similarity index 90% rename from tests/linker/ios/link all/InterfacesTest.cs rename to tests/linker/link all/InterfacesTest.cs index 99d44892ce9a..4d487956540a 100644 --- a/tests/linker/ios/link all/InterfacesTest.cs +++ b/tests/linker/link all/InterfacesTest.cs @@ -88,15 +88,9 @@ public void Bug10866 () // Foo and Bar are never used on B - so they can be removed Assert.Null (type_b.GetMethod ("Foo", BindingFlags.Instance | BindingFlags.Public), "B::Foo"); -#if !NET // This is actually a bug in the linker that's been fixed in .NET - Assert.Null (type_b.GetMethod ("Bar", BindingFlags.Instance | BindingFlags.Public), "B::Bar"); -#endif } [Test] -#if !NET - [Ignore ("https://github.com/xamarin/xamarin-macios/issues/9566")] -#endif public void Issue9566 () { var ifaces = (I []) (object) new B [0]; diff --git a/tests/linker/ios/link all/InternalsTest.cs b/tests/linker/link all/InternalsTest.cs similarity index 100% rename from tests/linker/ios/link all/InternalsTest.cs rename to tests/linker/link all/InternalsTest.cs diff --git a/tests/linker/ios/link all/LaunchScreen.storyboard b/tests/linker/link all/LaunchScreen.storyboard similarity index 100% rename from tests/linker/ios/link all/LaunchScreen.storyboard rename to tests/linker/link all/LaunchScreen.storyboard diff --git a/tests/linker/mac/link all/LinkAllTest.cs b/tests/linker/link all/LinkAllMacTest.cs similarity index 79% rename from tests/linker/mac/link all/LinkAllTest.cs rename to tests/linker/link all/LinkAllMacTest.cs index 60059c532dc7..218f8949f623 100644 --- a/tests/linker/mac/link all/LinkAllTest.cs +++ b/tests/linker/link all/LinkAllMacTest.cs @@ -1,3 +1,4 @@ +#if __MACOS__ using System; using System.IO; using System.Runtime.CompilerServices; @@ -15,24 +16,6 @@ namespace LinkAllTests { [TestFixture] [Preserve (AllMembers = true)] public class LinkAllTest { -#if !NET // this test is in a file shared with all platforms for .NET - static void Check (string calendarName, bool present) - { - var type = Type.GetType ("System.Globalization." + calendarName); - bool success = present == (type is not null); - Assert.AreEqual (present, type is not null, calendarName); - } - - [Test] - public void Calendars () - { - Check ("GregorianCalendar", true); - Check ("UmAlQuraCalendar", false); - Check ("HijriCalendar", false); - Check ("ThaiBuddhistCalendar", false); - } -#endif // !NET - [Test] public void EnsureUIThreadException () { @@ -97,3 +80,4 @@ public SerializeMe () } } } +#endif // __MACOS__ diff --git a/tests/linker/ios/link all/LinkAllTest.cs b/tests/linker/link all/LinkAllTest.cs similarity index 80% rename from tests/linker/ios/link all/LinkAllTest.cs rename to tests/linker/link all/LinkAllTest.cs index 8179b5c5bbd2..eb330cca55b9 100644 --- a/tests/linker/ios/link all/LinkAllTest.cs +++ b/tests/linker/link all/LinkAllTest.cs @@ -66,32 +66,16 @@ public void UnusedMethod () { } public class LinkAllRegressionTest { #if __MACCATALYST__ public const string NamespacePrefix = ""; -#if NET public const string AssemblyName = "Microsoft.MacCatalyst"; -#else - public const string AssemblyName = "Xamarin.MacCatalyst"; -#endif #elif __IOS__ public const string NamespacePrefix = ""; -#if NET public const string AssemblyName = "Microsoft.iOS"; -#else - public const string AssemblyName = "Xamarin.iOS"; -#endif #elif __TVOS__ public const string NamespacePrefix = ""; -#if NET public const string AssemblyName = "Microsoft.tvOS"; -#else - public const string AssemblyName = "Xamarin.TVOS"; -#endif #elif __MACOS__ public const string NamespacePrefix = ""; -#if NET public const string AssemblyName = "Microsoft.macOS"; -#else - public const string AssemblyName = "Xamarin.Mac"; -#endif #else #error Unknown platform #endif @@ -154,7 +138,6 @@ public void MEF_3862 () Assert.True (default_value, "DefaultValue"); } -#if NET static void Check (string calendarName, bool present) { var type = Type.GetType ("System.Globalization." + calendarName); @@ -170,7 +153,6 @@ public void Calendars () Check ("HijriCalendar", true); Check ("ThaiBuddhistCalendar", true); } -#endif // NET public enum CertificateProblem : long { CertEXPIRED = 0x800B0101, @@ -192,61 +174,6 @@ public enum CertificateProblem : long { CertTRUSTEFAIL = 0x800B010B, } -#if !NET - // ICertificatePolicy has been removed from .NET 5+ - class TestPolicy : ICertificatePolicy { - - const int RecoverableTrustFailure = 5; // SecTrustResult - - public TestPolicy () - { - CheckCount = 0; - } - - public int CheckCount { get; private set; } - - public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) - { - Assert.That (certificateProblem, Is.EqualTo (0), GetProblemMessage ((CertificateProblem) certificateProblem)); - CheckCount++; - return true; - } - - string GetProblemMessage (CertificateProblem problem) - { - var problemMessage = ""; - CertificateProblem problemList = new CertificateProblem (); - var problemCodeName = Enum.GetName (problemList.GetType (), problem); - problemMessage = problemCodeName is not null ? problemMessage + "-Certificateproblem:" + problemCodeName : "Unknown Certificate Problem"; - return problemMessage; - } - } - - static TestPolicy test_policy = new TestPolicy (); - - [Test] - public void TrustUsingOldPolicy () - { - // Three similar tests exists in dontlink, linkall and linksdk to test 3 different cases - // untrusted, custom ICertificatePolicy and ServerCertificateValidationCallback without - // having caching issues (in S.Net or the SSL handshake cache) - ICertificatePolicy old = ServicePointManager.CertificatePolicy; - try { - ServicePointManager.CertificatePolicy = test_policy; - WebClient wc = new WebClient (); - Assert.IsNotNull (wc.DownloadString (NetworkResources.XamarinUrl)); - // caching means it will be called at least for the first run, but it might not - // be called again in subsequent requests (unless it expires) - Assert.That (test_policy.CheckCount, Is.GreaterThan (0), "policy checked"); - } catch (WebException we) { - TestRuntime.IgnoreInCIIfBadNetwork (we); - throw; - } finally { - ServicePointManager.CertificatePolicy = old; - } - } -#endif - #if !__MACOS__ [Test] public void DetectPlatform () @@ -254,27 +181,15 @@ public void DetectPlatform () // for (future) nunit[lite] platform detection - if this test fails then platform detection won't work var typename = NamespacePrefix + "UIKit.UIApplicationDelegate, " + AssemblyName; Assert.NotNull (Helper.GetType (typename), typename); -#if NET Assert.Null (Helper.GetType ("Mono.Runtime"), "Mono.Runtime"); -#else - // and you can trust the old trick with the linker - Assert.NotNull (Helper.GetType ("Mono.Runtime"), "Mono.Runtime"); -#endif } #endif // !__MACOS__ [Test] -#if NET #pragma warning disable CA1418 // The platform '*' is not a known platform name [SupportedOSPlatform ("none")] [UnsupportedOSPlatform ("none)")] #pragma warning restore CA1418 -#else - [Introduced (PlatformName.None)] - [Deprecated (PlatformName.None)] - [Obsoleted (PlatformName.None)] - [Unavailable (PlatformName.None)] -#endif [ThreadSafe] public void RemovedAttributes () { @@ -288,25 +203,15 @@ public void RemovedAttributes () Assert.Null (Helper.GetType (prefix + "ObjCRuntime.ObsoletedAttribute, " + suffix), "ObsoletedAttribute"); Assert.Null (Helper.GetType (prefix + "ObjCRuntime.UnavailableAttribute, " + suffix), "UnavailableAttribute"); Assert.Null (Helper.GetType (prefix + "ObjCRuntime.ThreadSafeAttribute, " + suffix), "ThreadSafeAttribute"); -#if NET Assert.Null (Helper.GetType ("System.Runtime.Versioning.SupportedOSPlatformAttribute, " + suffix), "SupportedOSPlatformAttribute"); Assert.Null (Helper.GetType ("System.Runtime.Versioning.UnsupportedOSPlatformAttribute, " + suffix), "UnsupportedOSPlatformAttribute"); -#endif } [Test] public void Assembly_Load () { -#if NET Assembly mscorlib = Assembly.Load ("System.Private.CoreLib.dll"); Assert.NotNull (mscorlib, "System.Private.CoreLib.dll"); -#else - Assembly mscorlib = Assembly.Load ("mscorlib.dll"); - Assert.NotNull (mscorlib, "mscorlib"); - - Assembly system = Assembly.Load ("System.dll"); - Assert.NotNull (system, "System"); -#endif } string FindAssemblyPath () @@ -351,29 +256,12 @@ public void Assembly_LoadFrom () public void Assembly_ReflectionOnlyLoadFrom () { string filename = FindAssemblyPath (); -#if NET // new behavior across all platforms, see https://github.com/dotnet/runtime/issues/50529 #pragma warning disable SYSLIB0018 // 'Assembly.ReflectionOnlyLoadFrom(string)' is obsolete: 'ReflectionOnly loading is not supported and throws PlatformNotSupportedException.' Assert.Throws (() => Assembly.ReflectionOnlyLoadFrom (filename)); #pragma warning restore SYSLIB0018 -#else - Assert.NotNull (Assembly.ReflectionOnlyLoadFrom (filename), "1"); -#endif } -#if !NET - [Test] - public void SystemDataSqlClient () - { - // notes: - // * this test is mean to fail when building the application using a Community or Indie licenses - // * linksdk.app references System.Data (assembly) but not types in SqlClient namespace - using (var sc = new System.Data.SqlClient.SqlConnection ()) { - Assert.NotNull (sc); - } - } -#endif - #if !__TVOS__ && !__MACOS__ [Test] public void Pasteboard_ImagesTest () @@ -447,13 +335,8 @@ public void SingleEpsilon_ToString () { TestRuntime.AssertNotDevice ("Known to fail on devices, see bug #15802"); var ci = CultureInfo.InvariantCulture; -#if NET Assert.That (Single.Epsilon.ToString (ci), Is.EqualTo ("1E-45"), "Epsilon.ToString()"); Assert.That ((-Single.Epsilon).ToString (ci), Is.EqualTo ("-1E-45"), "-Epsilon.ToString()"); -#else - Assert.That (Single.Epsilon.ToString (ci), Is.EqualTo ("1.401298E-45"), "Epsilon.ToString()"); - Assert.That ((-Single.Epsilon).ToString (ci), Is.EqualTo ("-1.401298E-45"), "-Epsilon.ToString()"); -#endif } [Test] @@ -471,13 +354,8 @@ public void DoubleEpsilon_ToString () TestRuntime.AssertNotDevice ("Known to fail on devices, see bug #15802"); var ci = CultureInfo.InvariantCulture; // note: unlike Single this works on both my iPhone5S and iPodTouch5 -#if NET Assert.That (Double.Epsilon.ToString (ci), Is.EqualTo ("5E-324"), "Epsilon.ToString()"); Assert.That ((-Double.Epsilon).ToString (ci), Is.EqualTo ("-5E-324"), "-Epsilon.ToString()"); -#else - Assert.That (Double.Epsilon.ToString (ci), Is.EqualTo ("4.94065645841247E-324"), "Epsilon.ToString()"); - Assert.That ((-Double.Epsilon).ToString (ci), Is.EqualTo ("-4.94065645841247E-324"), "-Epsilon.ToString()"); -#endif } [Test] @@ -492,29 +370,6 @@ public void AssemblyReferences_16213 () } } -#if !__MACCATALYST__ -#if !NET // OpenTK-1.0.dll isn't supported in .NET yet - [Test] - public void OpenTk10_Preserved () - { - // that will bring OpenTK-1.0 into the .app - OpenTK.WindowState state = OpenTK.WindowState.Normal; - // Compiler optimization (roslyn release) can remove the variable, which removes OpenTK-1.dll from the app and fail the test - Assert.That (state, Is.EqualTo (OpenTK.WindowState.Normal), "normal"); - - var gl = Helper.GetType ("OpenTK.Graphics.ES11.GL, OpenTK-1.0", false); - Assert.NotNull (gl, "ES11/GL"); - var core = Helper.GetType ("OpenTK.Graphics.ES11.GL/Core, OpenTK-1.0", false); - Assert.NotNull (core, "ES11/Core"); - - gl = Helper.GetType ("OpenTK.Graphics.ES20.GL, OpenTK-1.0", false); - Assert.NotNull (gl, "ES20/GL"); - core = Helper.GetType ("OpenTK.Graphics.ES20.GL/Core, OpenTK-1.0", false); - Assert.NotNull (core, "ES20/Core"); - } -#endif // !NET -#endif // !__MACCATALYST__ - [Test] public void NestedNSObject () { @@ -653,9 +508,7 @@ void CheckAsyncTaskMethodBuilder (Type atmb) } [Test] -#if NET [Ignore ("BUG https://github.com/xamarin/xamarin-macios/issues/11280")] -#endif public void LinkedAwayGenericTypeAsOptionalMemberInProtocol () { // https://github.com/xamarin/xamarin-macios/issues/3523 @@ -687,11 +540,7 @@ public void NoFatCorlib () var bundlePath = Path.Combine (NSBundle.MainBundle.BundlePath, bundleLocation); var isExtension = bundlePath.EndsWith (".appex", StringComparison.Ordinal); var bundleName = isExtension ? "link all.appex" : "link all.app"; -#if NET const string corelib = "System.Private.CoreLib.dll"; -#else - const string corelib = "mscorlib.dll"; -#endif var suffix = Path.Combine (bundleName, bundleLocation, corelib); Assert.That (corlib, Does.EndWith (suffix), corlib); } @@ -710,16 +559,10 @@ public void CGPdfPage () #endif } -#if NET [SupportedOSPlatform ("macos1.0")] [SupportedOSPlatform ("ios1.0")] [SupportedOSPlatform ("tvos1.0")] [SupportedOSPlatform ("maccatalyst1.0")] -#else - [Introduced (PlatformName.MacOSX, 1, 0, PlatformArchitecture.Arch64)] - [Introduced (PlatformName.iOS, 1, 0)] - [Introduced (PlatformName.TvOS, 1, 0)] -#endif [Preserve] public class ClassFromThePast : NSObject { [Export ("foo:")] diff --git a/tests/linker/ios/link all/LinqExpressionTest.cs b/tests/linker/link all/LinqExpressionTest.cs similarity index 100% rename from tests/linker/ios/link all/LinqExpressionTest.cs rename to tests/linker/link all/LinqExpressionTest.cs diff --git a/tests/linker/ios/link all/PreserveTest.cs b/tests/linker/link all/PreserveTest.cs similarity index 91% rename from tests/linker/ios/link all/PreserveTest.cs rename to tests/linker/link all/PreserveTest.cs index 8d64fd24b5eb..21e965d50cb7 100644 --- a/tests/linker/ios/link all/PreserveTest.cs +++ b/tests/linker/link all/PreserveTest.cs @@ -76,25 +76,10 @@ public void PreserveTypeWithoutMembers () Assert.Null (t.GetProperty ("Absent"), "members"); } - [Test] -#if NET - [Ignore ("This feature is not supported by dotnet's ILLink -> https://github.com/xamarin/xamarin-macios/issues/8900")] -#endif - public void PreserveTypeWithCustomAttribute () - { - var t = Type.GetType ("LinkAll.Attributes.MemberWithCustomAttribute" + WorkAroundLinkerHeuristics); - // both type and members are preserved - in this case the type is preserved because it's member was - Assert.NotNull (t, "type"); - // and that member was preserved because it's decorated with a preserved attribute - Assert.NotNull (t.GetProperty ("Custom"), "members"); - } - [Test] public void Runtime_RegisterEntryAssembly () { -#if NET TestRuntime.AssertSimulator ("https://github.com/xamarin/xamarin-macios/issues/10457"); -#endif var klass = Type.GetType ("ObjCRuntime.Runtime, " + AssemblyName); Assert.NotNull (klass, "Runtime"); @@ -111,13 +96,7 @@ public void Runtime_RegisterEntryAssembly () [Test] public void MonoTouchException_Unconditional () { -#if NET const string klassName = "ObjCRuntime.ObjCException"; -#elif __MACOS__ - const string klassName = "Foundation.ObjCException"; -#else - const string klassName = "Foundation.MonoTouchException"; -#endif var klass = Type.GetType (klassName + ", " + AssemblyName); Assert.NotNull (klass, klassName); } diff --git a/tests/linker/ios/link all/SealerTest.cs b/tests/linker/link all/SealerTest.cs similarity index 99% rename from tests/linker/ios/link all/SealerTest.cs rename to tests/linker/link all/SealerTest.cs index 35f1272f5b71..3c00df6ce8b9 100644 --- a/tests/linker/ios/link all/SealerTest.cs +++ b/tests/linker/link all/SealerTest.cs @@ -36,7 +36,6 @@ public class Subclass : Base, Interface { [Preserve (AllMembers = true)] public class SealerTest { -#if NET [SetUp] public void SetUp () { @@ -45,7 +44,6 @@ public void SetUp () // so the optimization is disabled unless AOT is used TestRuntime.AssertDevice (); } -#endif [Test] public void Sealed () diff --git a/tests/linker/ios/link all/SerializationTest.cs b/tests/linker/link all/SerializationTest.cs similarity index 100% rename from tests/linker/ios/link all/SerializationTest.cs rename to tests/linker/link all/SerializationTest.cs diff --git a/tests/linker/ios/link all/StructLayoutTest.cs b/tests/linker/link all/StructLayoutTest.cs similarity index 100% rename from tests/linker/ios/link all/StructLayoutTest.cs rename to tests/linker/link all/StructLayoutTest.cs diff --git a/tests/linker/ios/link all/XmlSerializationTest.cs b/tests/linker/link all/XmlSerializationTest.cs similarity index 99% rename from tests/linker/ios/link all/XmlSerializationTest.cs rename to tests/linker/link all/XmlSerializationTest.cs index 452abdfd01ee..926134037229 100644 --- a/tests/linker/ios/link all/XmlSerializationTest.cs +++ b/tests/linker/link all/XmlSerializationTest.cs @@ -37,9 +37,7 @@ public class XmlField { public T Result; } -#if NET [Ignore ("https://github.com/dotnet/runtime/issues/41389")] -#endif [TestFixture] // we want the tests to be available because we use the linker [Preserve (AllMembers = true)] diff --git a/tests/linker/ios/link all/dotnet/MacCatalyst/Info.plist b/tests/linker/link all/dotnet/MacCatalyst/Info.plist similarity index 100% rename from tests/linker/ios/link all/dotnet/MacCatalyst/Info.plist rename to tests/linker/link all/dotnet/MacCatalyst/Info.plist diff --git a/tests/linker/ios/link all/dotnet/MacCatalyst/Makefile b/tests/linker/link all/dotnet/MacCatalyst/Makefile similarity index 100% rename from tests/linker/ios/link all/dotnet/MacCatalyst/Makefile rename to tests/linker/link all/dotnet/MacCatalyst/Makefile diff --git a/tests/linker/ios/link all/dotnet/MacCatalyst/link all.csproj b/tests/linker/link all/dotnet/MacCatalyst/link all.csproj similarity index 100% rename from tests/linker/ios/link all/dotnet/MacCatalyst/link all.csproj rename to tests/linker/link all/dotnet/MacCatalyst/link all.csproj diff --git a/tests/linker/ios/link sdk/dotnet/Makefile b/tests/linker/link all/dotnet/Makefile similarity index 72% rename from tests/linker/ios/link sdk/dotnet/Makefile rename to tests/linker/link all/dotnet/Makefile index 07a44358c22d..a97c2cbb3d5d 100644 --- a/tests/linker/ios/link sdk/dotnet/Makefile +++ b/tests/linker/link all/dotnet/Makefile @@ -1,2 +1,2 @@ -TOP=../../../../.. +TOP=../../../.. include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/linker/ios/link all/dotnet/iOS/Info.plist b/tests/linker/link all/dotnet/iOS/Info.plist similarity index 100% rename from tests/linker/ios/link all/dotnet/iOS/Info.plist rename to tests/linker/link all/dotnet/iOS/Info.plist diff --git a/tests/linker/ios/link all/dotnet/iOS/Makefile b/tests/linker/link all/dotnet/iOS/Makefile similarity index 100% rename from tests/linker/ios/link all/dotnet/iOS/Makefile rename to tests/linker/link all/dotnet/iOS/Makefile diff --git a/tests/linker/ios/link all/dotnet/iOS/link all.csproj b/tests/linker/link all/dotnet/iOS/link all.csproj similarity index 100% rename from tests/linker/ios/link all/dotnet/iOS/link all.csproj rename to tests/linker/link all/dotnet/iOS/link all.csproj diff --git a/tests/linker/ios/link all/dotnet/macOS/Info.plist b/tests/linker/link all/dotnet/macOS/Info.plist similarity index 100% rename from tests/linker/ios/link all/dotnet/macOS/Info.plist rename to tests/linker/link all/dotnet/macOS/Info.plist diff --git a/tests/linker/ios/link all/dotnet/macOS/Makefile b/tests/linker/link all/dotnet/macOS/Makefile similarity index 100% rename from tests/linker/ios/link all/dotnet/macOS/Makefile rename to tests/linker/link all/dotnet/macOS/Makefile diff --git a/tests/linker/ios/link all/dotnet/macOS/link all.csproj b/tests/linker/link all/dotnet/macOS/link all.csproj similarity index 100% rename from tests/linker/ios/link all/dotnet/macOS/link all.csproj rename to tests/linker/link all/dotnet/macOS/link all.csproj diff --git a/tests/linker/ios/link all/dotnet/shared.csproj b/tests/linker/link all/dotnet/shared.csproj similarity index 72% rename from tests/linker/ios/link all/dotnet/shared.csproj rename to tests/linker/link all/dotnet/shared.csproj index 8a757585fae9..a8bad04a8cf9 100644 --- a/tests/linker/ios/link all/dotnet/shared.csproj +++ b/tests/linker/link all/dotnet/shared.csproj @@ -10,8 +10,7 @@ --optimize=all,-remove-dynamic-registrar,-force-rejected-types-removal $(MtouchExtraArgs) --optimize=-remove-uithread-checks $(MtouchExtraArgs) - $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\..\..')) - $(RootTestsDirectory)\linker\ios\link all + $(RootTestsDirectory)\linker\link all true @@ -48,53 +47,39 @@ - - + - - - - - - - - + + OptimizeGeneratedCodeTest.cs - - - - - - ReflectionTest.cs - - - + + TestRuntime.cs - + CommonLinkAllTest.cs - + CommonLinkAnyTest.cs - + NetworkResources.cs - + Tamarin.pdf diff --git a/tests/linker/ios/link sdk/dotnet/shared.mk b/tests/linker/link all/dotnet/shared.mk similarity index 67% rename from tests/linker/ios/link sdk/dotnet/shared.mk rename to tests/linker/link all/dotnet/shared.mk index 38070b2b407c..12f4233f2a4f 100644 --- a/tests/linker/ios/link sdk/dotnet/shared.mk +++ b/tests/linker/link all/dotnet/shared.mk @@ -1,3 +1,3 @@ -TOP=../../../../../.. +TOP=../../../../.. include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/linker/ios/link all/dotnet/tvOS/Info.plist b/tests/linker/link all/dotnet/tvOS/Info.plist similarity index 100% rename from tests/linker/ios/link all/dotnet/tvOS/Info.plist rename to tests/linker/link all/dotnet/tvOS/Info.plist diff --git a/tests/linker/ios/link all/dotnet/tvOS/Makefile b/tests/linker/link all/dotnet/tvOS/Makefile similarity index 100% rename from tests/linker/ios/link all/dotnet/tvOS/Makefile rename to tests/linker/link all/dotnet/tvOS/Makefile diff --git a/tests/linker/ios/link all/dotnet/tvOS/link all.csproj b/tests/linker/link all/dotnet/tvOS/link all.csproj similarity index 100% rename from tests/linker/ios/link all/dotnet/tvOS/link all.csproj rename to tests/linker/link all/dotnet/tvOS/link all.csproj diff --git a/tests/linker/ios/link sdk/AotBugs.cs b/tests/linker/link sdk/AotBugs.cs similarity index 97% rename from tests/linker/ios/link sdk/AotBugs.cs rename to tests/linker/link sdk/AotBugs.cs index aafe675229f3..d1a58f9555be 100644 --- a/tests/linker/ios/link sdk/AotBugs.cs +++ b/tests/linker/link sdk/AotBugs.cs @@ -410,11 +410,6 @@ IEnumerable> MakeEnumerable (KeyValuePair [] } [Test] -#if __MACOS__ && NET -#if !NET9_0_OR_GREATER // not sure if this issue is limited to .NET 8, but add this in so that we find out in our .NET 9 branch. - [Ignore ("https://github.com/dotnet/runtime/issues/107026")] -#endif -#endif public void AsEnumerable_4114 () { Enumbers e = new Enumbers (); @@ -467,16 +462,6 @@ public void Bug8379_b () new Class1 (); } - [Test] -#if NET - [Ignore ("MulticastDelegate.BeginInvoke isn't supported in .NET (https://github.com/dotnet/runtime/issues/16312)")] -#endif - public void Bug5354 () - { - Action testAction = (string s) => { s.ToString (); }; - testAction.BeginInvoke ("Teszt", null, null); - } - public static IEnumerable GetStringList () where T : struct, IConvertible { return Enum.GetValues (typeof (T)).Cast ().Select (x => x.ToString ()); diff --git a/tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/Contents.json b/tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/Contents.json similarity index 100% rename from tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/Contents.json rename to tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/Contents.json diff --git a/tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png b/tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png similarity index 100% rename from tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png rename to tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png diff --git a/tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-57.png b/tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-57.png similarity index 100% rename from tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-57.png rename to tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-57.png diff --git a/tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png b/tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png similarity index 100% rename from tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png rename to tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png diff --git a/tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png b/tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png similarity index 100% rename from tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png rename to tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png diff --git a/tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-72.png b/tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-72.png similarity index 100% rename from tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-72.png rename to tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-72.png diff --git a/tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png b/tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png similarity index 100% rename from tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png rename to tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png diff --git a/tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-76.png b/tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-76.png similarity index 100% rename from tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-76.png rename to tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-76.png diff --git a/tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png b/tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png similarity index 100% rename from tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png rename to tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png diff --git a/tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png b/tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png similarity index 100% rename from tests/linker/ios/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png rename to tests/linker/link sdk/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png diff --git a/tests/linker/ios/link sdk/AsyncTest.cs b/tests/linker/link sdk/AsyncTest.cs similarity index 100% rename from tests/linker/ios/link sdk/AsyncTest.cs rename to tests/linker/link sdk/AsyncTest.cs diff --git a/tests/linker/ios/link sdk/BitcodeTest.cs b/tests/linker/link sdk/BitcodeTest.cs similarity index 100% rename from tests/linker/ios/link sdk/BitcodeTest.cs rename to tests/linker/link sdk/BitcodeTest.cs diff --git a/tests/linker/ios/link sdk/Bug1820Test.cs b/tests/linker/link sdk/Bug1820Test.cs similarity index 100% rename from tests/linker/ios/link sdk/Bug1820Test.cs rename to tests/linker/link sdk/Bug1820Test.cs diff --git a/tests/linker/ios/link sdk/Bug2096Test.cs b/tests/linker/link sdk/Bug2096Test.cs similarity index 100% rename from tests/linker/ios/link sdk/Bug2096Test.cs rename to tests/linker/link sdk/Bug2096Test.cs diff --git a/tests/linker/ios/link sdk/CalendarTest.cs b/tests/linker/link sdk/CalendarTest.cs similarity index 73% rename from tests/linker/ios/link sdk/CalendarTest.cs rename to tests/linker/link sdk/CalendarTest.cs index 8159ebdf3331..67b8f636193a 100644 --- a/tests/linker/ios/link sdk/CalendarTest.cs +++ b/tests/linker/link sdk/CalendarTest.cs @@ -25,22 +25,14 @@ public void UmAlQura () public void Hijri () { var ci = CultureInfo.GetCultureInfo ("ps"); -#if NET // https://github.com/dotnet/runtime/issues/50859 Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.PersianCalendar"), "Calendar"); -#else - Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.GregorianCalendar"), "Calendar"); -#endif } [Test] public void ThaiBuddhist () { var ci = CultureInfo.GetCultureInfo ("th"); -#if NET // https://github.com/dotnet/runtime/issues/50859 Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.ThaiBuddhistCalendar"), "Calendar"); -#else - Assert.That (ci.Calendar.ToString (), Is.EqualTo ("System.Globalization.GregorianCalendar"), "Calendar"); -#endif } } } diff --git a/tests/linker/ios/link sdk/CanaryTest.cs b/tests/linker/link sdk/CanaryTest.cs similarity index 100% rename from tests/linker/ios/link sdk/CanaryTest.cs rename to tests/linker/link sdk/CanaryTest.cs diff --git a/tests/linker/ios/link sdk/CryptoTest.cs b/tests/linker/link sdk/CryptoTest.cs similarity index 94% rename from tests/linker/ios/link sdk/CryptoTest.cs rename to tests/linker/link sdk/CryptoTest.cs index d079de3e6f6f..aa09705b654a 100644 --- a/tests/linker/ios/link sdk/CryptoTest.cs +++ b/tests/linker/link sdk/CryptoTest.cs @@ -31,13 +31,7 @@ public void AesCreate () // located inside System.Core.dll - IOW the linker needs to be aware of this Aes aes = Aes.Create (); Assert.NotNull (aes, "Aes"); -#if NET7_0_OR_GREATER const string prefix = "System.Security.Cryptography, "; -#elif NET - const string prefix = "System.Security.Cryptography.Algorithms, "; -#else - const string prefix = "System.Core, "; -#endif Assert.That (aes.GetType ().Assembly.FullName, Does.StartWith (prefix), prefix); } @@ -53,14 +47,8 @@ public void TrustUsingNewCallback () ServicePointManager.ServerCertificateValidationCallback = delegate (object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors errors) { Assert.That (errors, Is.EqualTo (SslPolicyErrors.None), "certificateProblem"); -#if NET X509Certificate2 c2 = X509CertificateLoader.LoadCertificate (cert.GetRawCertData ()); Assert.True (chain.Build (c2), "Build"); -#else - X509Certificate2 c2 = new X509Certificate2 (cert.GetRawCertData ()); - Assert.False (chain.Build (c2), "Build"); - Assert.AreSame (c2, chain.ChainElements [0].Certificate, "ChainElements"); -#endif trust_validation_callback++; return true; }; @@ -111,17 +99,8 @@ public void TLS1_ServerNameExtension () ServicePointManager.ServerCertificateValidationCallback = delegate (object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors errors) { Assert.That (errors, Is.EqualTo (SslPolicyErrors.None), "certificateProblem"); -#if NET X509Certificate2 c2 = X509CertificateLoader.LoadCertificate (cert.GetRawCertData ()); -#else - X509Certificate2 c2 = new X509Certificate2 (cert.GetRawCertData ()); -#endif -#if NET Assert.True (chain.Build (c2), "Build"); -#else - Assert.False (chain.Build (c2), "Build"); - Assert.AreSame (c2, chain.ChainElements [0].Certificate, "ChainElements"); -#endif sne_validation_callback++; return true; }; @@ -147,33 +126,15 @@ public void TLS1_ServerNameExtension () public void Chain () { string certString = "MIIDGjCCAgKgAwIBAgICApowDQYJKoZIhvcNAQEFBQAwLjELMAkGA1UEBhMCQ1oxDjAMBgNVBAoTBVJlYmV4MQ8wDQYDVQQDEwZUZXN0Q0EwHhcNMDAwMTAxMDAwMDAwWhcNNDkxMjMxMDAwMDAwWjAuMQswCQYDVQQGEwJDWjEOMAwGA1UEChMFUmViZXgxDzANBgNVBAMTBlRlc3RDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMgeRAcaNLTFaaBhFx8RDJ8b9K655dNUXmO11mbImDbPq4qVeZXDgAjnzPov8iBscwfqBvBpF38LsxBIPA2i1d0RMsQruOhJHttA9I0enElUXXj63sOEVNMSQeg1IMyvNeEotag+Gcx6SF+HYnariublETaZGzwAOD2SM49mfqUyfkgeTjdO6qp8xnoEr7dS5pEBHDg70byj/JEeZd3gFea9TiOXhbCrI89dKeWYBeoHFYhhkaSB7q9EOaUEzKo/BQ6PBHFu6odfGkOjXuwfPkY/wUy9U4uj75LmdhzvJf6ifsJS9BQZF4//JcUYSxiyzpxDYqSbTF3g9w5Ds2LOAscCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgB/MA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFD1v20tPgvHTEK/0eLO09j0rL2qXMA0GCSqGSIb3DQEBBQUAA4IBAQAZIjcdR3EZiFJ67gfCnPBrxVgFNvaRAMCYEYYIGDCAUeB4bLTu9dvun9KFhgVNqjgx+xTTpx9d/5mAZx5W3YAG6faQPCaHccLefB1M1hVPmo8md2uw1a44RHU9LlM0V5Lw8xTKRkQiZz3Ysu0sY27RvLrTptbbfkE4Rp9qAMguZT9cFrgPAzh+0zuo8NNj9Jz7/SSa83yIFmflCsHYSuNyKIy2iaX9TCVbTrwJmRIB65gqtTb6AKtFGIPzsb6nayHvgGHFchrFovcNrvRpE71F38oVG+eCjT23JfiIZim+yJLppSf56167u8etDcQ39j2b9kzWlHIVkVM0REpsKF7S"; -#if NET X509Certificate2 rootCert = X509CertificateLoader.LoadCertificate (Convert.FromBase64String (certString)); -#else - X509Certificate2 rootCert = new X509Certificate2 (Convert.FromBase64String (certString)); -#endif - -#if !NET - X509Store store = new X509Store ("Trust"); - store.Open (OpenFlags.ReadWrite); - if (!store.Certificates.Contains (rootCert)) - store.Add (rootCert); - store.Close (); -#endif byte [] certData = new byte [] { 0x30, 0x82, 0x02, 0xFA, 0x30, 0x82, 0x01, 0xE2, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x03, 0x01, 0x4F, 0x55, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x2E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5A, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x05, 0x52, 0x65, 0x62, 0x65, 0x78, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x06, 0x54, 0x65, 0x73, 0x74, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x32, 0x30, 0x34, 0x32, 0x32, 0x31, 0x38, 0x33, 0x31, 0x35, 0x33, 0x5A, 0x17, 0x0D, 0x34, 0x39, 0x31, 0x32, 0x33, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5A, 0x30, 0x37, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5A, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x05, 0x52, 0x65, 0x62, 0x65, 0x78, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0F, 0x77, 0x69, 0x6E, 0x30, 0x31, 0x2E, 0x64, 0x30, 0x35, 0x2E, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xF1, 0x4F, 0xAC, 0x71, 0x70, 0x8F, 0x8A, 0xFE, 0x38, 0x67, 0xA7, 0x21, 0x56, 0x8B, 0x34, 0xBC, 0xF5, 0xCD, 0x48, 0x1C, 0x69, 0xEB, 0x83, 0x98, 0x69, 0x3D, 0x33, 0x2A, 0x7B, 0x04, 0xB1, 0x0A, 0xA9, 0x2C, 0x17, 0xDD, 0x41, 0xEC, 0x21, 0x91, 0xB8, 0x12, 0x95, 0xB0, 0x4C, 0x2A, 0x53, 0xBF, 0x06, 0x47, 0x72, 0xBB, 0x68, 0xCA, 0x49, 0x34, 0x15, 0x7B, 0x78, 0x4F, 0x42, 0x03, 0xD9, 0x58, 0xEE, 0x9D, 0x72, 0x61, 0xAD, 0xAD, 0x0C, 0x28, 0x65, 0x61, 0x48, 0xF8, 0x68, 0xB5, 0x16, 0x19, 0xD0, 0xDD, 0x47, 0x44, 0x86, 0xE3, 0xA6, 0x93, 0x81, 0xD5, 0xA1, 0x70, 0x23, 0x05, 0x74, 0x33, 0xD1, 0xD2, 0x21, 0x17, 0x68, 0xAF, 0x5F, 0x25, 0xD5, 0x8C, 0x72, 0xF6, 0x28, 0xF4, 0x1F, 0x42, 0x24, 0xCF, 0x18, 0x7B, 0x5D, 0xCE, 0x29, 0x43, 0xF2, 0x10, 0xB6, 0x73, 0x65, 0x4C, 0x0A, 0x17, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x81, 0x9B, 0x30, 0x81, 0x98, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x05, 0xA0, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x14, 0x00, 0x58, 0x48, 0x55, 0x6C, 0x45, 0xC6, 0xCC, 0x06, 0x25, 0x2D, 0xD3, 0xBA, 0x0C, 0x08, 0x81, 0x00, 0x58, 0xDF, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x3D, 0x6F, 0xDB, 0x4B, 0x4F, 0x82, 0xF1, 0xD3, 0x10, 0xAF, 0xF4, 0x78, 0xB3, 0xB4, 0xF6, 0x3D, 0x2B, 0x2F, 0x6A, 0x97, 0x30, 0x31, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x2A, 0x30, 0x28, 0x30, 0x26, 0xA0, 0x24, 0xA0, 0x22, 0x86, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x74, 0x65, 0x73, 0x74, 0x2D, 0x63, 0x61, 0x2E, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x2F, 0x74, 0x65, 0x73, 0x74, 0x2D, 0x63, 0x61, 0x2E, 0x63, 0x72, 0x6C, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x22, 0x48, 0xC3, 0x95, 0x3A, 0x51, 0x72, 0x15, 0x41, 0x5B, 0x47, 0xC4, 0xC5, 0x4E, 0x2E, 0x97, 0xAC, 0x1D, 0x0B, 0xD1, 0xA4, 0x38, 0xF2, 0xFB, 0x6E, 0x33, 0x9D, 0xC8, 0x93, 0x4C, 0x88, 0x34, 0xA3, 0x68, 0xC7, 0xC6, 0x42, 0x51, 0x54, 0x31, 0x72, 0x72, 0xEB, 0xEE, 0x5C, 0xF0, 0x7D, 0xC9, 0xC8, 0xAE, 0x24, 0x9F, 0xA0, 0x1D, 0x2E, 0xEE, 0x84, 0x55, 0xC3, 0x3A, 0xC4, 0xCE, 0xE1, 0xB3, 0xA2, 0xD2, 0x1F, 0x44, 0xC8, 0x81, 0x0F, 0x9C, 0xED, 0x5B, 0x17, 0xBB, 0x2C, 0xDA, 0x4A, 0x9D, 0xF7, 0x7D, 0x5A, 0x08, 0x6C, 0xA3, 0xF4, 0xCB, 0x55, 0xE6, 0x1A, 0xAA, 0xC7, 0x14, 0x16, 0x7D, 0x46, 0xD0, 0x7C, 0x71, 0xA8, 0xA7, 0xEA, 0xBF, 0xA6, 0x92, 0xD4, 0xC5, 0x7A, 0xB8, 0x45, 0x3A, 0x00, 0xB3, 0xDC, 0x76, 0x2E, 0xEB, 0xB9, 0xF4, 0x6B, 0xDC, 0xF2, 0xC4, 0x7C, 0x0C, 0xD5, 0x1C, 0x73, 0xE8, 0xE1, 0xBB, 0xC1, 0x5C, 0xCC, 0xD9, 0xBE, 0xDE, 0x61, 0x4D, 0xEF, 0x2B, 0x23, 0xFA, 0xA6, 0xF6, 0xED, 0x4F, 0x5F, 0x2C, 0xCA, 0x68, 0x29, 0x59, 0x27, 0x82, 0x41, 0x5E, 0xAD, 0xC8, 0x93, 0xBF, 0x83, 0x01, 0x8F, 0x32, 0xCB, 0x79, 0xEE, 0x93, 0x4C, 0xCB, 0x87, 0x48, 0x62, 0x0D, 0x44, 0xD7, 0x80, 0x31, 0x87, 0x41, 0x72, 0x2D, 0x12, 0xA0, 0x2C, 0x99, 0x89, 0x08, 0x5F, 0xE9, 0xFE, 0x5E, 0xB4, 0xEC, 0xCB, 0x6C, 0x23, 0xC1, 0xB8, 0xE4, 0xD6, 0x1E, 0x4B, 0x9C, 0x88, 0x0A, 0x63, 0x65, 0x78, 0xC0, 0x37, 0xAC, 0x54, 0xCB, 0xDE, 0xA9, 0x0F, 0x59, 0x43, 0x1E, 0x41, 0xF5, 0x32, 0xAC, 0x85, 0x69, 0xE9, 0xBA, 0xA6, 0x78, 0x87, 0x88, 0x8B, 0x71, 0xFB, 0xE4, 0x51, 0xC0, 0xF5, 0xB7, 0x4C, 0x1F, 0xCF, 0x6A, 0x1C, 0xF6, 0x1B, 0x27, 0x50, 0xE9, 0xAC, 0xBF, 0xB7, 0x4E }; -#if NET X509Certificate2 cert = X509CertificateLoader.LoadCertificate (certData); -#else - X509Certificate2 cert = new X509Certificate2 (certData); -#endif X509Chain chain = new X509Chain (false); -#if NET chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust; chain.ChainPolicy.CustomTrustStore.Add (rootCert); -#endif Assert.False (chain.Build (cert), "Online"); Assert.True (chain.ChainStatus.Any (s => s.Status.HasFlag (X509ChainStatusFlags.RevocationStatusUnknown)), "Online"); @@ -245,11 +206,7 @@ public void Chain () [Test] public void Sha256 () { -#if NET X509Certificate2 c = X509CertificateLoader.LoadCertificate (sha256_data); -#else - X509Certificate2 c = new X509Certificate2 (sha256_data); -#endif // can't build is fine - as long as we do not throw Assert.False (new X509Chain (false).Build (c), "Build"); } diff --git a/tests/linker/ios/link sdk/DataContractTest.cs b/tests/linker/link sdk/DataContractTest.cs similarity index 100% rename from tests/linker/ios/link sdk/DataContractTest.cs rename to tests/linker/link sdk/DataContractTest.cs diff --git a/tests/linker/ios/link sdk/DllImportTest.cs b/tests/linker/link sdk/DllImportTest.cs similarity index 100% rename from tests/linker/ios/link sdk/DllImportTest.cs rename to tests/linker/link sdk/DllImportTest.cs diff --git a/tests/linker/ios/link sdk/HttpClientHandlerTest.cs b/tests/linker/link sdk/HttpClientHandlerTest.cs similarity index 100% rename from tests/linker/ios/link sdk/HttpClientHandlerTest.cs rename to tests/linker/link sdk/HttpClientHandlerTest.cs diff --git a/tests/linker/ios/link sdk/Info.plist b/tests/linker/link sdk/Info.plist similarity index 100% rename from tests/linker/ios/link sdk/Info.plist rename to tests/linker/link sdk/Info.plist diff --git a/tests/linker/ios/link sdk/LaunchScreen.storyboard b/tests/linker/link sdk/LaunchScreen.storyboard similarity index 100% rename from tests/linker/ios/link sdk/LaunchScreen.storyboard rename to tests/linker/link sdk/LaunchScreen.storyboard diff --git a/tests/linker/ios/link sdk/LinkExtraDefsTest.cs b/tests/linker/link sdk/LinkExtraDefsTest.cs similarity index 94% rename from tests/linker/ios/link sdk/LinkExtraDefsTest.cs rename to tests/linker/link sdk/LinkExtraDefsTest.cs index ebee58795af7..5aa603af54db 100644 --- a/tests/linker/ios/link sdk/LinkExtraDefsTest.cs +++ b/tests/linker/link sdk/LinkExtraDefsTest.cs @@ -36,11 +36,7 @@ public void Corlib () [Test] public void System () { -#if NET Type t = Type.GetType ("System.Net.Mime.ContentType, System.Net.Mail"); -#else - Type t = Type.GetType ("System.Net.Mime.ContentType, System"); -#endif Assert.NotNull (t, "System.Net.Mime.ContentType"); // we asked for ParseValue to be preserved Assert.NotNull (t.GetMethod ("ParseValue", BindingFlags.Instance | BindingFlags.NonPublic), "Parse"); diff --git a/tests/linker/ios/link sdk/LinkSdkRegressionTest.cs b/tests/linker/link sdk/LinkSdkRegressionTest.cs similarity index 82% rename from tests/linker/ios/link sdk/LinkSdkRegressionTest.cs rename to tests/linker/link sdk/LinkSdkRegressionTest.cs index ea23fc9055b1..9204c167d828 100644 --- a/tests/linker/ios/link sdk/LinkSdkRegressionTest.cs +++ b/tests/linker/link sdk/LinkSdkRegressionTest.cs @@ -6,9 +6,6 @@ using System.Diagnostics; using System.Globalization; using System.IO; -#if !NET // https://github.com/xamarin/xamarin-macios/issues/11710 -using System.Json; -#endif using System.Linq; using System.Net; using System.Net.NetworkInformation; @@ -16,15 +13,9 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; -#if !NET -using System.Security.Permissions; -#endif using System.Security.Principal; using System.Threading; using System.Xml; -#if !NET -using Mono.Data.Sqlite; -#endif using MonoTouch; #if HAS_ADDRESSBOOK using AddressBook; @@ -48,7 +39,7 @@ #if !__MACCATALYST__ && !__MACOS__ using OpenGLES; #endif -#if !(__TVOS__ && NET) +#if !__TVOS__ using WebKit; #endif using NUnit.Framework; @@ -57,19 +48,6 @@ namespace LinkSdk { - -#if !NET - [FileIOPermission (SecurityAction.LinkDemand, AllLocalFiles = FileIOPermissionAccess.AllAccess)] - public class SecurityDeclarationDecoratedUserCode { - - [FileIOPermission (SecurityAction.Assert, AllLocalFiles = FileIOPermissionAccess.NoAccess)] - static public bool Check () - { - return true; - } - } -#endif - [TestFixture] // we want the test to be availble if we use the linker [Preserve (AllMembers = true)] @@ -94,19 +72,6 @@ public void Bug205_ExposingIEnumerable () // the above should not throw System.Runtime.Serialization.SerializationException } -#if !NET // This test requires Mono.Data.SqliteConnection, which .NET 5+ doesn't have - [Test] - // http://bugzilla.xamarin.com/show_bug.cgi?id=233 - public void Bug233_MonoPInvokeCallback () - { - var c = new SqliteConnection ("Data Source=:memory:"); - c.Open (); - c.Update += (sender, e) => { }; - // the above should not crash - c.Close (); - } -#endif - [Test] // http://bugzilla.xamarin.com/show_bug.cgi?id=234 public void Bug234_Interlocked () @@ -250,68 +215,6 @@ void CheckExceptionDetailProperty (PropertyInfo pi) } } -#if !NET // This test requires System.ServiceModel.dll, which .NET 5+ doesn't have - [Test] - // http://bugzilla.xamarin.com/show_bug.cgi?id=1415 - public void Bug1415_Linker_DataMember () - { - // the typeof ensure we're can't (totally) link away System.ServiceModel.dll - Type ed = typeof (System.ServiceModel.AuditLevel).Assembly.GetType ("System.ServiceModel.ExceptionDetail", false); - // which means it's [DataContract] / [DataMember] should not be linked out - // even if we're not specifically using them (and without [Preserve] being added) - // which is important since System.ServiceModel.dll is an SDK assembly - Assert.NotNull (ed, "ExceptionDetail"); - bool help_link = false; - bool inner_exception = false; - bool message = false; - bool stack_trace = false; - bool type = false; - foreach (var pi in ed.GetProperties ()) { - CheckExceptionDetailProperty (pi); - switch (pi.Name) { - case "HelpLink": - help_link = true; - break; - case "InnerException": - inner_exception = true; - break; - case "Message": - message = true; - break; - case "StackTrace": - stack_trace = true; - break; - case "Type": - type = true; - break; - } - } - // ensure all properties are still present - Assert.True (help_link, "HelpLink"); - Assert.True (inner_exception, "InnerException"); - Assert.True (message, "Message"); - Assert.True (stack_trace, "StackTrace"); - Assert.True (type, "Type"); - } -#endif // !NET - -#if !NET // This test requires System.ServiceModel.dll, which .NET 5+ doesn't have - [Test] - // http://bugzilla.xamarin.com/show_bug.cgi?id=1415 - // not really part of the bug - but part of the same fix - public void Bug1415_Linker_XmlAttribute () - { - // the typeof ensure we're can't (totally) link away System.ServiceModel.dll - Type ed = typeof (System.ServiceModel.AuditLevel).Assembly.GetType ("System.ServiceModel.EndpointAddress10", false); - // type is decorated with both [XmlSchemaProvider] and [XmlRoot] - Assert.NotNull (ed, "EndpointAddress10"); - - var q = new OpenTK.Quaternion (); - Assert.Null (q.GetType ().GetProperty ("XYZ"), "XmlIgnore"); - // should be null if application is linked (won't be if "Don't link" is used) - } -#endif // !NET - [Test] // http://bugzilla.xamarin.com/show_bug.cgi?id=1443 public void Bug1443_Linq_Aot () @@ -396,11 +299,7 @@ public void Bug2000_NSPersistentStoreCoordinator () // from http://bugzilla.xamarin.com/show_bug.cgi?id=2000 NSError error; var c = new NSPersistentStoreCoordinator (model); -#if NET c.AddPersistentStore (NSPersistentStoreCoordinator.SQLiteStoreType, null, url, null, out error); -#else - c.AddPersistentStoreWithType (NSPersistentStoreCoordinator.SQLiteStoreType, null, url, null, out error); -#endif Assert.IsNull (error, "error"); } finally { File.Delete (sqlitePath); @@ -419,18 +318,6 @@ public void Linker_RuntimeWrappedException () } } -#if !NET // This test requires Mono.Data.SqliteConnection, which .NET 5+ doesn't have - [Test] - // http://stackoverflow.com/questions/8602726/cant-open-sqlite-database-in-read-only-mode - public void Sqlite_ReadOnly () - { - var c = new SqliteConnection ("Data Source=:memory:;Read Only=true"); - c.Open (); - // the above should not throw a 'misuse' exception - c.Close (); - } -#endif - [Test] public void AsQueryable_3028 () { @@ -439,36 +326,6 @@ public void AsQueryable_3028 () Assert.That (f, Is.EqualTo ("hi"), "f"); } -#if !__MACCATALYST__ -#if !NET // OpenTK-1.0.dll is not supported yet - [Test] - public void OpenTk_3049 () - { - using (var gc1 = OpenTK.Platform.Utilities.CreateGraphicsContext (EAGLRenderingAPI.OpenGLES1)) { - Assert.NotNull (gc1); - } - using (var gc2 = OpenTK.Platform.Utilities.CreateGraphicsContext (EAGLRenderingAPI.OpenGLES2)) { - Assert.NotNull (gc2); - } - } - - [Test] - public void OpenTk_Preserved () - { - const string OpenTKAssembly = "OpenTK-1.0"; - var gl = GetTypeHelper ("OpenTK.Graphics.ES11.GL, " + OpenTKAssembly, false); - Assert.NotNull (gl, "ES11/GL"); - var core = GetTypeHelper ("OpenTK.Graphics.ES11.GL/Core, " + OpenTKAssembly, false); - Assert.NotNull (core, "ES11/Core"); - - gl = GetTypeHelper ("OpenTK.Graphics.ES20.GL, " + OpenTKAssembly, false); - Assert.NotNull (gl, "ES20/GL"); - core = GetTypeHelper ("OpenTK.Graphics.ES20.GL/Core, " + OpenTKAssembly, false); - Assert.NotNull (core, "ES20/Core"); - } -#endif // !NET -#endif // !__MACCATALYST__ - [Test] public void XElement_3137 () { @@ -629,21 +486,6 @@ public void Synchronized_3904 () Assert.NotNull (getInstance (), "Location"); } -#if !NET // https://github.com/xamarin/xamarin-macios/issues/11710 - [Test] - [Culture ("en")] - public void Json_Parse_4415 () - { - var f = 4.25987E-06f; - // note: always use '.' see http://www.json.org/fatfree.html - var s = f.ToString (); - var v = JsonValue.Parse (s); - Assert.AreEqual (f, (float) v, "Parse Negative Exponent"); - f *= 10; - Assert.AreNotEqual (f, (float) v, "non-equal"); - } -#endif // !NET - [Test] [Culture ("en")] public void ConvertToDouble_4620 () @@ -683,11 +525,7 @@ public void WebClient_SSL_Leak () public void WebProxy_Leak () { // note: needs to be executed under Instrument to verify it does not leak -#if NET Assert.NotNull (global::CoreFoundation.CFNetwork.GetSystemProxySettings (), "should not leak"); -#else - Assert.NotNull (CFNetwork.GetSystemProxySettings (), "should not leak"); -#endif } #endif // !__TVOS__ && !__MACOS__ @@ -763,14 +601,6 @@ public void AttributeUsageAttribute_Persistance () Assert.IsFalse (Attribute.IsDefined (GetType (), typeof (SerializableAttribute))); } -#if !NET // This test requires System.Runtime.Remoting.dll, which .NET 5+ doesn't have - [Test] - public void LinkedAway () - { - Assert.Throws (() => new System.Runtime.Remoting.RemotingException ()); - } -#endif // !NET - [Test] public void ArrayClear_11184 () { @@ -827,7 +657,6 @@ public void Aot_Gsharedvt_21893 () public void PrivateMemorySize64 () { // ref: https://bugzilla.xamarin.com/show_bug.cgi?id=21882 -#if NET #if __MACOS__ || __MACCATALYST__ var mem = System.Diagnostics.Process.GetCurrentProcess ().PrivateMemorySize64; Assert.That (mem, Is.EqualTo (0), "PrivateMemorySize64"); @@ -835,12 +664,6 @@ public void PrivateMemorySize64 () // It's not entirely clear, but it appears this is not implemented, and won't be, for mobile platforms: https://github.com/dotnet/runtime/issues/28990 Assert.Throws (() => { var mem = System.Diagnostics.Process.GetCurrentProcess ().PrivateMemorySize64; }, "PrivateMemorySize64"); #endif // __MACOS__ || __MACCATALYST__ -#else - var mem = System.Diagnostics.Process.GetCurrentProcess ().PrivateMemorySize64; - // the above used a mach call that iOS samdbox did *not* allow (sandbox) on device - // but has been fixed (different call) for the same PID - Assert.That (mem, Is.Not.EqualTo (0), "PrivateMemorySize64"); -#endif } string TestFolder (Environment.SpecialFolder folder, bool supported = true, bool? exists = true, bool readOnly = false) @@ -874,7 +697,6 @@ public void SpecialFolder () try { SpecialFolderImpl (); } catch (Exception e) { -#if NET Console.WriteLine ($"An exception occurred in this test: {e}"); Console.WriteLine ($"Dumping info about various directories:"); foreach (var value in Enum.GetValues ().OrderBy (v => v.ToString ())) { @@ -886,7 +708,6 @@ public void SpecialFolder () foreach (var value in Enum.GetValues ().OrderBy (v => v.ToString ())) Console.WriteLine ($"SpecialFolder '{value}' => {Environment.GetFolderPath (value)}"); -#endif // Throw the original exception so that the test actually fails. throw; @@ -963,11 +784,7 @@ void SpecialFolderImpl () #endif path = TestFolder (Environment.SpecialFolder.MyMusic, exists: myExists); -#if __MACOS__ && !NET8_0_OR_GREATER - path = TestFolder (Environment.SpecialFolder.MyVideos, supported: false); -#else path = TestFolder (Environment.SpecialFolder.MyVideos, exists: myExists); -#endif path = TestFolder (Environment.SpecialFolder.DesktopDirectory, exists: myExists); @@ -1000,7 +817,6 @@ void SpecialFolderImpl () Assert.That (path, Is.EqualTo ("/usr/share"), "path - CommonApplicationData"); // and the simulator is more lax -#if NET path = TestFolder (Environment.SpecialFolder.ProgramFiles, readOnly: device, exists: null /* may or may not exist */); #if __MACOS__ var applicationsPath = "/Applications"; @@ -1009,11 +825,6 @@ void SpecialFolderImpl () var applicationsPath = NSSearchPath.GetDirectories (NSSearchPathDirectory.ApplicationDirectory, NSSearchPathDomain.All, true).FirstOrDefault (); #endif Assert.That (path, Is.EqualTo (applicationsPath), "path - ProgramFiles"); -#else - - path = TestFolder (Environment.SpecialFolder.ProgramFiles, readOnly: device); - Assert.That (path, Is.EqualTo ("/Applications"), "path - ProgramFiles"); -#endif path = TestFolder (Environment.SpecialFolder.UserProfile, readOnly: device); var bundlePath = NSBundle.MainBundle.BundlePath; @@ -1041,7 +852,7 @@ void SpecialFolderImpl () bool tvos = false; #endif -#if __MACOS__ && NET8_0_OR_GREATER +#if __MACOS__ path = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); if (string.IsNullOrEmpty (path) && TestRuntime.IsInCI) { // ignore this @@ -1052,35 +863,19 @@ void SpecialFolderImpl () #else // and some stuff is read/write path = TestFolder (Environment.SpecialFolder.MyDocuments); -#if __MACOS__ && !NET8_0_OR_GREATER - Assert.That (path, Is.EqualTo (home), "path - MyDocuments"); -#else Assert.That (path, Is.EqualTo (docs), "path - MyDocuments"); -#endif -#endif // __MACOS__ && NET8_0_OR_GREATER +#endif // __MACOS__ -#if NET path = TestFolder (Environment.SpecialFolder.ApplicationData, exists: null /* may or may not exist */); -#else - path = TestFolder (Environment.SpecialFolder.ApplicationData); -#endif #if __MACOS__ -#if NET8_0_OR_GREATER Assert.That (path, Is.EqualTo (Path.Combine (home, "Library", "Application Support")), "path - ApplicationData"); -#else - Assert.That (path, Is.EqualTo (Path.Combine (home, ".config")), "path - ApplicationData"); -#endif #else Assert.That (path, Is.EqualTo (docs + "/.config"), "path - ApplicationData"); #endif path = TestFolder (Environment.SpecialFolder.LocalApplicationData); #if __MACOS__ -#if NET8_0_OR_GREATER Assert.That (path, Is.EqualTo (Path.Combine (home, "Library", "Application Support")), "path - ApplicationData"); -#else - Assert.That (path, Is.EqualTo (Path.Combine (home, ".local", "share")), "path - LocalApplicationData"); -#endif #else Assert.That (path, Is.EqualTo (docs), "path - LocalApplicationData"); #endif @@ -1123,19 +918,6 @@ public void Events () } #endif // !__MACOS__ -#if !NET - [Test] - public void SecurityDeclaration () - { - // note: security declarations != custom attributes - // we ensure that we can create the type / call the code - Assert.True (SecurityDeclarationDecoratedUserCode.Check (), "call"); - // we ensure that both the permission and the flag are NOT part of the final/linked binary (link removes security declarations) - Assert.Null (GetTypeHelper ("System.Security.Permissions.FileIOPermissionAttribute, mscorlib"), "FileIOPermissionAttribute"); - Assert.Null (GetTypeHelper ("System.Security.Permissions.FileIOPermissionAccess, mscorlib"), "FileIOPermissionAccess"); - } -#endif - #if !__MACOS__ [Test] public void UIButtonSubclass () @@ -1144,23 +926,11 @@ public void UIButtonSubclass () using (var b = new UIButton (UIButtonType.Custom)) { // https://trello.com/c/Nf2B8mIM/484-remove-debug-code-in-the-linker var m = b.GetType ().GetMethod ("VerifyIsUIButton", BindingFlags.Instance | BindingFlags.NonPublic); -#if NET CheckILLinkStubbedMethod (m); -#else // NET -#if DEBUG - // kept in debug builds - Assert.NotNull (m, "VerifyIsUIButton"); -#else - // removed from release builds - Assert.Null (m, "VerifyIsUIButton"); -#endif -#endif // NET } } - #endif // !__MACOS__ -#if NET static void CheckILLinkStubbedMethod (MethodInfo m) { // ILLink does not remove the method, but it can "stub" (empty) it @@ -1205,16 +975,11 @@ public void EnsureDelegateAssignIsNotOverwritingInternalDelegate () var m = ApplicationType.GetMethod ("EnsureDelegateAssignIsNotOverwritingInternalDelegate", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); CheckILLinkStubbedMethod (m); } -#endif [Test] public void MonoRuntime34671 () { -#if NET Assert.Null (GetTypeHelper ("Mono.Runtime"), "Mono.Runtime"); -#else - Assert.NotNull (GetTypeHelper ("Mono.Runtime"), "Mono.Runtime"); -#endif } [Test] @@ -1224,16 +989,6 @@ public void TraceListeners36255 () Assert.NotNull (Trace.Listeners, "C6 had a SecurityPermission call"); } -#if !NET // This test requires Mono.Security.dll, which .NET 5+ doesn't have - [Test] - public void TlsProvider_Apple () - { - var provider = Mono.Security.Interface.MonoTlsProviderFactory.GetProvider (); - Assert.NotNull (provider, "provider"); - Assert.That (provider.ID, Is.EqualTo (new Guid ("981af8af-a3a3-419a-9f01-a518e3a17c1c")), "correct provider"); - } -#endif - #if !__MACOS__ [Test] public void Github5024 () diff --git a/tests/linker/mac/link sdk/LinkSdkTest.cs b/tests/linker/link sdk/LinkSdkTest.cs similarity index 100% rename from tests/linker/mac/link sdk/LinkSdkTest.cs rename to tests/linker/link sdk/LinkSdkTest.cs diff --git a/tests/linker/ios/link sdk/LocaleTest.cs b/tests/linker/link sdk/LocaleTest.cs similarity index 100% rename from tests/linker/ios/link sdk/LocaleTest.cs rename to tests/linker/link sdk/LocaleTest.cs diff --git a/tests/linker/ios/link sdk/OptimizeGeneratedCodeTest.cs b/tests/linker/link sdk/OptimizeGeneratedCodeTest.cs similarity index 100% rename from tests/linker/ios/link sdk/OptimizeGeneratedCodeTest.cs rename to tests/linker/link sdk/OptimizeGeneratedCodeTest.cs diff --git a/tests/linker/link sdk/PclTest.cs b/tests/linker/link sdk/PclTest.cs new file mode 100644 index 000000000000..451b74f2d548 --- /dev/null +++ b/tests/linker/link sdk/PclTest.cs @@ -0,0 +1,96 @@ +using System; +using System.IO; +using System.Net; +using System.ServiceModel; +using System.Windows.Input; +using System.Xml; +using Foundation; +using ObjCRuntime; +using NUnit.Framework; + +namespace LinkSdk { + + [TestFixture] + [Preserve (AllMembers = true)] + public class PclTest { + + [Test] + public void Corlib () + { + BinaryWriter bw = new BinaryWriter (Stream.Null); + bw.Dispose (); + } + + [Test] + public void System () + { + const string url = "http://www.google.com"; + Uri uri = new Uri (url); + + Assert.False (this is ICommand, "ICommand"); + + try { + HttpWebRequest hwr = WebRequest.CreateHttp (uri); + try { + Assert.True (hwr.SupportsCookieContainer, "SupportsCookieContainer"); + } catch (NotImplementedException) { + // feature is not available, but the symbol itself is needed + } + + WebResponse wr = hwr.GetResponse (); + try { + Assert.True (wr.SupportsHeaders, "SupportsHeaders"); + } catch (NotImplementedException) { + // feature is not available, but the symbol itself is needed + } + wr.Dispose (); + + try { + Assert.NotNull (WebRequest.CreateHttp (url)); + } catch (NotImplementedException) { + // feature is not available, but the symbol itself is needed + } + + try { + Assert.NotNull (WebRequest.CreateHttp (uri)); + } catch (NotImplementedException) { + // feature is not available, but the symbol itself is needed + } + } catch (Exception e) { + TestRuntime.IgnoreInCIIfBadNetwork (e); + throw; + } + } + + [Test] + public void Xml () + { + try { + XmlConvert.VerifyPublicId (String.Empty); + } catch (NotImplementedException) { + // feature is not available, but the symbol itself is needed + } + + try { + XmlConvert.VerifyWhitespace (String.Empty); + } catch (NotImplementedException) { + // feature is not available, but the symbol itself is needed + } + + try { + XmlConvert.VerifyXmlChars (String.Empty); + } catch (NotImplementedException) { + // feature is not available, but the symbol itself is needed + } + + var xr = XmlReader.Create (Stream.Null); + xr.Dispose (); + + var xw = XmlWriter.Create (Stream.Null); + xw.Dispose (); + + XmlReaderSettings xrs = new XmlReaderSettings (); + xrs.DtdProcessing = DtdProcessing.Ignore; + } + } +} diff --git a/tests/linker/ios/link sdk/ReflectionTest.cs b/tests/linker/link sdk/ReflectionTest.cs similarity index 100% rename from tests/linker/ios/link sdk/ReflectionTest.cs rename to tests/linker/link sdk/ReflectionTest.cs diff --git a/tests/linker/ios/link sdk/TaskTest.cs b/tests/linker/link sdk/TaskTest.cs similarity index 100% rename from tests/linker/ios/link sdk/TaskTest.cs rename to tests/linker/link sdk/TaskTest.cs diff --git a/tests/linker/ios/link sdk/dotnet/MacCatalyst/Info.plist b/tests/linker/link sdk/dotnet/MacCatalyst/Info.plist similarity index 100% rename from tests/linker/ios/link sdk/dotnet/MacCatalyst/Info.plist rename to tests/linker/link sdk/dotnet/MacCatalyst/Info.plist diff --git a/tests/linker/ios/link sdk/dotnet/MacCatalyst/Makefile b/tests/linker/link sdk/dotnet/MacCatalyst/Makefile similarity index 100% rename from tests/linker/ios/link sdk/dotnet/MacCatalyst/Makefile rename to tests/linker/link sdk/dotnet/MacCatalyst/Makefile diff --git a/tests/linker/ios/link sdk/dotnet/MacCatalyst/extra-linker-defs.xml b/tests/linker/link sdk/dotnet/MacCatalyst/extra-linker-defs.xml similarity index 100% rename from tests/linker/ios/link sdk/dotnet/MacCatalyst/extra-linker-defs.xml rename to tests/linker/link sdk/dotnet/MacCatalyst/extra-linker-defs.xml diff --git a/tests/linker/ios/link sdk/dotnet/MacCatalyst/link sdk.csproj b/tests/linker/link sdk/dotnet/MacCatalyst/link sdk.csproj similarity index 100% rename from tests/linker/ios/link sdk/dotnet/MacCatalyst/link sdk.csproj rename to tests/linker/link sdk/dotnet/MacCatalyst/link sdk.csproj diff --git a/tests/linker/ios/trimmode copy/dotnet/Makefile b/tests/linker/link sdk/dotnet/Makefile similarity index 72% rename from tests/linker/ios/trimmode copy/dotnet/Makefile rename to tests/linker/link sdk/dotnet/Makefile index 07a44358c22d..a97c2cbb3d5d 100644 --- a/tests/linker/ios/trimmode copy/dotnet/Makefile +++ b/tests/linker/link sdk/dotnet/Makefile @@ -1,2 +1,2 @@ -TOP=../../../../.. +TOP=../../../.. include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/linker/ios/link sdk/dotnet/iOS/Info.plist b/tests/linker/link sdk/dotnet/iOS/Info.plist similarity index 100% rename from tests/linker/ios/link sdk/dotnet/iOS/Info.plist rename to tests/linker/link sdk/dotnet/iOS/Info.plist diff --git a/tests/linker/ios/link sdk/dotnet/iOS/Makefile b/tests/linker/link sdk/dotnet/iOS/Makefile similarity index 100% rename from tests/linker/ios/link sdk/dotnet/iOS/Makefile rename to tests/linker/link sdk/dotnet/iOS/Makefile diff --git a/tests/linker/ios/link sdk/dotnet/iOS/extra-linker-defs.xml b/tests/linker/link sdk/dotnet/iOS/extra-linker-defs.xml similarity index 100% rename from tests/linker/ios/link sdk/dotnet/iOS/extra-linker-defs.xml rename to tests/linker/link sdk/dotnet/iOS/extra-linker-defs.xml diff --git a/tests/linker/ios/link sdk/dotnet/iOS/link sdk.csproj b/tests/linker/link sdk/dotnet/iOS/link sdk.csproj similarity index 100% rename from tests/linker/ios/link sdk/dotnet/iOS/link sdk.csproj rename to tests/linker/link sdk/dotnet/iOS/link sdk.csproj diff --git a/tests/linker/ios/link sdk/dotnet/macOS/Info.plist b/tests/linker/link sdk/dotnet/macOS/Info.plist similarity index 100% rename from tests/linker/ios/link sdk/dotnet/macOS/Info.plist rename to tests/linker/link sdk/dotnet/macOS/Info.plist diff --git a/tests/linker/ios/link sdk/dotnet/macOS/Makefile b/tests/linker/link sdk/dotnet/macOS/Makefile similarity index 100% rename from tests/linker/ios/link sdk/dotnet/macOS/Makefile rename to tests/linker/link sdk/dotnet/macOS/Makefile diff --git a/tests/linker/ios/link sdk/dotnet/macOS/extra-linker-defs.xml b/tests/linker/link sdk/dotnet/macOS/extra-linker-defs.xml similarity index 100% rename from tests/linker/ios/link sdk/dotnet/macOS/extra-linker-defs.xml rename to tests/linker/link sdk/dotnet/macOS/extra-linker-defs.xml diff --git a/tests/linker/ios/link sdk/dotnet/macOS/link sdk.csproj b/tests/linker/link sdk/dotnet/macOS/link sdk.csproj similarity index 100% rename from tests/linker/ios/link sdk/dotnet/macOS/link sdk.csproj rename to tests/linker/link sdk/dotnet/macOS/link sdk.csproj diff --git a/tests/linker/ios/link sdk/dotnet/shared.csproj b/tests/linker/link sdk/dotnet/shared.csproj similarity index 64% rename from tests/linker/ios/link sdk/dotnet/shared.csproj rename to tests/linker/link sdk/dotnet/shared.csproj index 67009a35f0eb..6d328aa58ad1 100644 --- a/tests/linker/ios/link sdk/dotnet/shared.csproj +++ b/tests/linker/link sdk/dotnet/shared.csproj @@ -9,8 +9,7 @@ $(MtouchLink) -disable-thread-check "--dlsym:-link sdk" -gcc_flags="-UhoItsB0rken" $(MtouchExtraArgs) - $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\..\..')) - $(RootTestsDirectory)\linker\ios\link sdk + $(RootTestsDirectory)\linker\link sdk false @@ -38,52 +37,34 @@ - + - - + - - - - - - - - - - - - - - - - - - - + + + TestRuntime.cs - + ILReader.cs - + CommonLinkSdkTest.cs - + CommonLinkAnyTest.cs - - + NetworkResources.cs diff --git a/tests/linker/ios/link all/dotnet/shared.mk b/tests/linker/link sdk/dotnet/shared.mk similarity index 67% rename from tests/linker/ios/link all/dotnet/shared.mk rename to tests/linker/link sdk/dotnet/shared.mk index 38070b2b407c..12f4233f2a4f 100644 --- a/tests/linker/ios/link all/dotnet/shared.mk +++ b/tests/linker/link sdk/dotnet/shared.mk @@ -1,3 +1,3 @@ -TOP=../../../../../.. +TOP=../../../../.. include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/linker/ios/link sdk/dotnet/tvOS/Info.plist b/tests/linker/link sdk/dotnet/tvOS/Info.plist similarity index 100% rename from tests/linker/ios/link sdk/dotnet/tvOS/Info.plist rename to tests/linker/link sdk/dotnet/tvOS/Info.plist diff --git a/tests/linker/ios/link sdk/dotnet/tvOS/Makefile b/tests/linker/link sdk/dotnet/tvOS/Makefile similarity index 100% rename from tests/linker/ios/link sdk/dotnet/tvOS/Makefile rename to tests/linker/link sdk/dotnet/tvOS/Makefile diff --git a/tests/linker/ios/link sdk/dotnet/tvOS/extra-linker-defs.xml b/tests/linker/link sdk/dotnet/tvOS/extra-linker-defs.xml similarity index 100% rename from tests/linker/ios/link sdk/dotnet/tvOS/extra-linker-defs.xml rename to tests/linker/link sdk/dotnet/tvOS/extra-linker-defs.xml diff --git a/tests/linker/ios/link sdk/dotnet/tvOS/link sdk.csproj b/tests/linker/link sdk/dotnet/tvOS/link sdk.csproj similarity index 100% rename from tests/linker/ios/link sdk/dotnet/tvOS/link sdk.csproj rename to tests/linker/link sdk/dotnet/tvOS/link sdk.csproj diff --git a/tests/linker/ios/link sdk/extra-linker-defs-maccatalyst.xml b/tests/linker/link sdk/extra-linker-defs-maccatalyst.xml similarity index 100% rename from tests/linker/ios/link sdk/extra-linker-defs-maccatalyst.xml rename to tests/linker/link sdk/extra-linker-defs-maccatalyst.xml diff --git a/tests/linker/ios/link sdk/extra-linker-defs-today.xml b/tests/linker/link sdk/extra-linker-defs-today.xml similarity index 100% rename from tests/linker/ios/link sdk/extra-linker-defs-today.xml rename to tests/linker/link sdk/extra-linker-defs-today.xml diff --git a/tests/linker/ios/link sdk/extra-linker-defs-tvos.xml b/tests/linker/link sdk/extra-linker-defs-tvos.xml similarity index 100% rename from tests/linker/ios/link sdk/extra-linker-defs-tvos.xml rename to tests/linker/link sdk/extra-linker-defs-tvos.xml diff --git a/tests/linker/ios/link sdk/extra-linker-defs-watchos.xml b/tests/linker/link sdk/extra-linker-defs-watchos.xml similarity index 100% rename from tests/linker/ios/link sdk/extra-linker-defs-watchos.xml rename to tests/linker/link sdk/extra-linker-defs-watchos.xml diff --git a/tests/linker/ios/link sdk/extra-linker-defs.xml b/tests/linker/link sdk/extra-linker-defs.xml similarity index 100% rename from tests/linker/ios/link sdk/extra-linker-defs.xml rename to tests/linker/link sdk/extra-linker-defs.xml diff --git a/tests/linker/ios/link sdk/support.dll b/tests/linker/link sdk/support.dll similarity index 100% rename from tests/linker/ios/link sdk/support.dll rename to tests/linker/link sdk/support.dll diff --git a/tests/linker/ios/link sdk/support.il b/tests/linker/link sdk/support.il similarity index 100% rename from tests/linker/ios/link sdk/support.il rename to tests/linker/link sdk/support.il diff --git a/tests/linker/mac/LinkAnyTest.cs b/tests/linker/mac/LinkAnyTest.cs deleted file mode 100644 index 29610d179463..000000000000 --- a/tests/linker/mac/LinkAnyTest.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Http; -using System.Security.Cryptography; -using System.Threading; -using System.Threading.Tasks; - -using Foundation; - -using NUnit.Framework; -using MonoTests.System.Net.Http; - -namespace LinkAnyTest { - // This test is included in both the LinkAll and LinkSdk projects. - [TestFixture] - [Preserve (AllMembers = true)] - public class LinkAnyTest { - [Test] - public void AES () - { - Assert.NotNull (Aes.Create (), "AES"); - } - - static bool waited; - static bool requestError; - static HttpStatusCode statusCode; - - void TimedWait (Task task) - { - var rv = task.Wait (TimeSpan.FromMinutes (1)); - if (rv) - return; - - TestRuntime.IgnoreInCI ("This test times out randomly in CI due to bad network."); - Assert.Fail ("Test timed out"); - } - - // http://blogs.msdn.com/b/csharpfaq/archive/2012/06/26/understanding-a-simple-async-program.aspx - // ref: https://bugzilla.xamarin.com/show_bug.cgi?id=7114 - static async Task GetWebPageAsync () - { - // do not use GetStringAsync, we are going to miss useful data, such as the resul code - using (var client = new HttpClient ()) { - HttpResponseMessage response = await client.GetAsync ("http://example.com"); - if (!response.IsSuccessStatusCode) { - requestError = true; - statusCode = response.StatusCode; - } else { - string content = await response.Content.ReadAsStringAsync (); - waited = true; - bool success = !String.IsNullOrEmpty (content); - Assert.IsTrue (success, $"received {content.Length} bytes"); - } - } - } - - [Test] - public void GetWebPageAsyncTest () - { - var current_sc = SynchronizationContext.Current; - try { - // we do not want the async code to get back to the AppKit thread, hanging the process - SynchronizationContext.SetSynchronizationContext (null); - TimedWait (GetWebPageAsync ()); - if (requestError) { - Assert.Inconclusive ($"Test cannot be trusted. Issues performing the request. Status code '{statusCode}'"); - } else { - Assert.IsTrue (waited, "async/await worked"); - } - } finally { - SynchronizationContext.SetSynchronizationContext (current_sc); - } - } - - void WebClientTest (string [] urls) - { - var exceptions = new List (); - foreach (var url in urls) { - try { - var wc = new WebClient (); - var data = wc.DownloadString (url); - - Assert.That (data, Is.Not.Empty, "Downloaded content"); - return; // one url succeeded, that's enough - } catch (Exception e) { - var msg = $"Url '{url}' failed: {e.ToString ()}"; - Console.WriteLine (msg); // If this keeps occurring locally for the same url, we might have to take it off the list of urls to test. - exceptions.Add (msg); - } - } - Assert.That (exceptions, Is.Empty, "At least one url should work"); - } - - [Test] - public void WebClientTest_Http () - { - WebClientTest (NetworkResources.HttpUrls); - } - - [Test] - public void WebClientTest_Https () - { - WebClientTest (NetworkResources.HttpsUrls); - } - - [Test] - public void WebClientTest_Async () - { - var current_sc = SynchronizationContext.Current; - try { - // we do not want the async code to get back to the AppKit thread, hanging the process - SynchronizationContext.SetSynchronizationContext (null); - - string data = null; - - var exceptions = new List (); - foreach (var url in NetworkResources.HttpsUrls) { - try { - async Task GetWebPage (string url) - { - var wc = new WebClient (); - var task = wc.DownloadStringTaskAsync (new Uri (url)); - data = await task; - } - - TimedWait (GetWebPage (url)); - Assert.That (data, Is.Not.Empty, "Downloaded content"); - return; // one url succeeded, that's enough - } catch (Exception e) { - var msg = $"Url '{url}' failed: {e.ToString ()}"; - Console.WriteLine (msg); // If this keeps occurring locally for the same url, we might have to take it off the list of urls to test. - exceptions.Add (msg); - } - } - Assert.That (exceptions, Is.Empty, "At least one url should work"); - } finally { - SynchronizationContext.SetSynchronizationContext (current_sc); - - } - } - } -} diff --git a/tests/linker/mac/link all/OptimizeGeneratedCodeTest.cs b/tests/linker/mac/link all/OptimizeGeneratedCodeTest.cs deleted file mode 100644 index 75c3fa6cae5a..000000000000 --- a/tests/linker/mac/link all/OptimizeGeneratedCodeTest.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -using Foundation; - -using NUnit.Framework; - -namespace Linker.Shared { - [TestFixture] - [Preserve (AllMembers = true)] - public class OptimizeGeneratedCodeTest : BaseOptimizeGeneratedCodeTest { - } -} diff --git a/tests/linker/ios/trimmode copy/dotnet/MacCatalyst/Info.plist b/tests/linker/trimmode copy/dotnet/MacCatalyst/Info.plist similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/MacCatalyst/Info.plist rename to tests/linker/trimmode copy/dotnet/MacCatalyst/Info.plist diff --git a/tests/linker/ios/trimmode copy/dotnet/MacCatalyst/Makefile b/tests/linker/trimmode copy/dotnet/MacCatalyst/Makefile similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/MacCatalyst/Makefile rename to tests/linker/trimmode copy/dotnet/MacCatalyst/Makefile diff --git a/tests/linker/ios/trimmode copy/dotnet/MacCatalyst/trimmode copy.csproj b/tests/linker/trimmode copy/dotnet/MacCatalyst/trimmode copy.csproj similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/MacCatalyst/trimmode copy.csproj rename to tests/linker/trimmode copy/dotnet/MacCatalyst/trimmode copy.csproj diff --git a/tests/linker/ios/dont link/dotnet/Makefile b/tests/linker/trimmode copy/dotnet/Makefile similarity index 72% rename from tests/linker/ios/dont link/dotnet/Makefile rename to tests/linker/trimmode copy/dotnet/Makefile index 07a44358c22d..a97c2cbb3d5d 100644 --- a/tests/linker/ios/dont link/dotnet/Makefile +++ b/tests/linker/trimmode copy/dotnet/Makefile @@ -1,2 +1,2 @@ -TOP=../../../../.. +TOP=../../../.. include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/linker/ios/trimmode copy/dotnet/iOS/Info.plist b/tests/linker/trimmode copy/dotnet/iOS/Info.plist similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/iOS/Info.plist rename to tests/linker/trimmode copy/dotnet/iOS/Info.plist diff --git a/tests/linker/ios/trimmode copy/dotnet/iOS/Makefile b/tests/linker/trimmode copy/dotnet/iOS/Makefile similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/iOS/Makefile rename to tests/linker/trimmode copy/dotnet/iOS/Makefile diff --git a/tests/linker/ios/trimmode copy/dotnet/iOS/trimmode copy.csproj b/tests/linker/trimmode copy/dotnet/iOS/trimmode copy.csproj similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/iOS/trimmode copy.csproj rename to tests/linker/trimmode copy/dotnet/iOS/trimmode copy.csproj diff --git a/tests/linker/ios/trimmode copy/dotnet/macOS/Info.plist b/tests/linker/trimmode copy/dotnet/macOS/Info.plist similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/macOS/Info.plist rename to tests/linker/trimmode copy/dotnet/macOS/Info.plist diff --git a/tests/linker/ios/trimmode copy/dotnet/macOS/Makefile b/tests/linker/trimmode copy/dotnet/macOS/Makefile similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/macOS/Makefile rename to tests/linker/trimmode copy/dotnet/macOS/Makefile diff --git a/tests/linker/ios/trimmode copy/dotnet/macOS/trimmode copy.csproj b/tests/linker/trimmode copy/dotnet/macOS/trimmode copy.csproj similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/macOS/trimmode copy.csproj rename to tests/linker/trimmode copy/dotnet/macOS/trimmode copy.csproj diff --git a/tests/linker/ios/trimmode copy/dotnet/shared.csproj b/tests/linker/trimmode copy/dotnet/shared.csproj similarity index 89% rename from tests/linker/ios/trimmode copy/dotnet/shared.csproj rename to tests/linker/trimmode copy/dotnet/shared.csproj index 90cef015c965..597f9c126a2e 100644 --- a/tests/linker/ios/trimmode copy/dotnet/shared.csproj +++ b/tests/linker/trimmode copy/dotnet/shared.csproj @@ -8,8 +8,7 @@ TrimMode Copy copy <_TrimmerDefaultAction>copy - $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..\..\..\..\..')) - $(RootTestsDirectory)\linker\ios\dont link + $(RootTestsDirectory)\linker\dont link true @@ -31,7 +30,7 @@ - + @@ -39,9 +38,6 @@ - - CommonDontLinkTest.cs - TestRuntime.cs diff --git a/tests/linker/ios/trimmode copy/dotnet/shared.mk b/tests/linker/trimmode copy/dotnet/shared.mk similarity index 67% rename from tests/linker/ios/trimmode copy/dotnet/shared.mk rename to tests/linker/trimmode copy/dotnet/shared.mk index 38070b2b407c..12f4233f2a4f 100644 --- a/tests/linker/ios/trimmode copy/dotnet/shared.mk +++ b/tests/linker/trimmode copy/dotnet/shared.mk @@ -1,3 +1,3 @@ -TOP=../../../../../.. +TOP=../../../../.. include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/linker/ios/trimmode copy/dotnet/tvOS/Info.plist b/tests/linker/trimmode copy/dotnet/tvOS/Info.plist similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/tvOS/Info.plist rename to tests/linker/trimmode copy/dotnet/tvOS/Info.plist diff --git a/tests/linker/ios/trimmode copy/dotnet/tvOS/Makefile b/tests/linker/trimmode copy/dotnet/tvOS/Makefile similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/tvOS/Makefile rename to tests/linker/trimmode copy/dotnet/tvOS/Makefile diff --git a/tests/linker/ios/trimmode copy/dotnet/tvOS/trimmode copy.csproj b/tests/linker/trimmode copy/dotnet/tvOS/trimmode copy.csproj similarity index 100% rename from tests/linker/ios/trimmode copy/dotnet/tvOS/trimmode copy.csproj rename to tests/linker/trimmode copy/dotnet/tvOS/trimmode copy.csproj diff --git a/tests/linker/ios/trimmode link/dotnet/MacCatalyst/Info.plist b/tests/linker/trimmode link/dotnet/MacCatalyst/Info.plist similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/MacCatalyst/Info.plist rename to tests/linker/trimmode link/dotnet/MacCatalyst/Info.plist diff --git a/tests/linker/ios/trimmode link/dotnet/MacCatalyst/Makefile b/tests/linker/trimmode link/dotnet/MacCatalyst/Makefile similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/MacCatalyst/Makefile rename to tests/linker/trimmode link/dotnet/MacCatalyst/Makefile diff --git a/tests/linker/ios/trimmode link/dotnet/MacCatalyst/trimmode link.csproj b/tests/linker/trimmode link/dotnet/MacCatalyst/trimmode link.csproj similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/MacCatalyst/trimmode link.csproj rename to tests/linker/trimmode link/dotnet/MacCatalyst/trimmode link.csproj diff --git a/tests/linker/trimmode link/dotnet/Makefile b/tests/linker/trimmode link/dotnet/Makefile new file mode 100644 index 000000000000..a97c2cbb3d5d --- /dev/null +++ b/tests/linker/trimmode link/dotnet/Makefile @@ -0,0 +1,2 @@ +TOP=../../../.. +include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/linker/ios/trimmode link/dotnet/iOS/Info.plist b/tests/linker/trimmode link/dotnet/iOS/Info.plist similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/iOS/Info.plist rename to tests/linker/trimmode link/dotnet/iOS/Info.plist diff --git a/tests/linker/ios/trimmode link/dotnet/iOS/Makefile b/tests/linker/trimmode link/dotnet/iOS/Makefile similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/iOS/Makefile rename to tests/linker/trimmode link/dotnet/iOS/Makefile diff --git a/tests/linker/ios/trimmode link/dotnet/iOS/trimmode link.csproj b/tests/linker/trimmode link/dotnet/iOS/trimmode link.csproj similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/iOS/trimmode link.csproj rename to tests/linker/trimmode link/dotnet/iOS/trimmode link.csproj diff --git a/tests/linker/ios/trimmode link/dotnet/macOS/Info.plist b/tests/linker/trimmode link/dotnet/macOS/Info.plist similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/macOS/Info.plist rename to tests/linker/trimmode link/dotnet/macOS/Info.plist diff --git a/tests/linker/ios/trimmode link/dotnet/macOS/Makefile b/tests/linker/trimmode link/dotnet/macOS/Makefile similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/macOS/Makefile rename to tests/linker/trimmode link/dotnet/macOS/Makefile diff --git a/tests/linker/ios/trimmode link/dotnet/macOS/trimmode link.csproj b/tests/linker/trimmode link/dotnet/macOS/trimmode link.csproj similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/macOS/trimmode link.csproj rename to tests/linker/trimmode link/dotnet/macOS/trimmode link.csproj diff --git a/tests/linker/ios/trimmode link/dotnet/shared.csproj b/tests/linker/trimmode link/dotnet/shared.csproj similarity index 70% rename from tests/linker/ios/trimmode link/dotnet/shared.csproj rename to tests/linker/trimmode link/dotnet/shared.csproj index 9511f86fd765..1aa8c8c9bb6b 100644 --- a/tests/linker/ios/trimmode link/dotnet/shared.csproj +++ b/tests/linker/trimmode link/dotnet/shared.csproj @@ -9,8 +9,7 @@ link -disable-thread-check "--dlsym:-trimmode link" -gcc_flags="-UhoItsB0rken" $(MtouchExtraArgs) - $([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..\..\..\..\..')) - $(RootTestsDirectory)\linker\ios\link sdk + $(RootTestsDirectory)\linker\link sdk false @@ -45,49 +44,31 @@ - + - - + - - - - - - - - - - - - - - - - - - - + + + ILReader.cs - + CommonLinkSdkTest.cs - + CommonLinkAnyTest.cs - - + NetworkResources.cs diff --git a/tests/linker/trimmode link/dotnet/shared.mk b/tests/linker/trimmode link/dotnet/shared.mk new file mode 100644 index 000000000000..12f4233f2a4f --- /dev/null +++ b/tests/linker/trimmode link/dotnet/shared.mk @@ -0,0 +1,3 @@ +TOP=../../../../.. + +include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/linker/ios/trimmode link/dotnet/tvOS/Info.plist b/tests/linker/trimmode link/dotnet/tvOS/Info.plist similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/tvOS/Info.plist rename to tests/linker/trimmode link/dotnet/tvOS/Info.plist diff --git a/tests/linker/ios/trimmode link/dotnet/tvOS/Makefile b/tests/linker/trimmode link/dotnet/tvOS/Makefile similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/tvOS/Makefile rename to tests/linker/trimmode link/dotnet/tvOS/Makefile diff --git a/tests/linker/ios/trimmode link/dotnet/tvOS/trimmode link.csproj b/tests/linker/trimmode link/dotnet/tvOS/trimmode link.csproj similarity index 100% rename from tests/linker/ios/trimmode link/dotnet/tvOS/trimmode link.csproj rename to tests/linker/trimmode link/dotnet/tvOS/trimmode link.csproj diff --git a/tests/package-mac-tests.sh b/tests/package-mac-tests.sh index 11bb868ab3be..b114e3de4fe3 100755 --- a/tests/package-mac-tests.sh +++ b/tests/package-mac-tests.sh @@ -46,7 +46,7 @@ TEST_SUITES+=(build-monotouch-test) make -f packaged-macos-tests.mk "${TEST_SUITES[@]}" $MAKE_FLAGS -for app in linker/*/*/dotnet/*/bin/*/*/*/*.app */dotnet/*/bin/*/*/*/*.app; do +for app in linker/*/dotnet/*/bin/*/*/*/*.app */dotnet/*/bin/*/*/*/*.app; do mkdir -p "$DIR/tests/$app" $CP -R "$app" "$DIR/tests/$app/.." done diff --git a/tests/packaged-macos-tests.mk b/tests/packaged-macos-tests.mk index 578b97b40941..8a170d5060f6 100644 --- a/tests/packaged-macos-tests.mk +++ b/tests/packaged-macos-tests.mk @@ -121,40 +121,40 @@ $(eval $(call DotNetNormalTest,introspection,introspection,_LONGER)) define DotNetLinkerTest # macOS/.NET/x64 build-mac-dotnet-x64-$(1): .stamp-dotnet-dependency-macOS - $$(Q_BUILD) $$(MAKE) -C "linker/ios/$(2)/dotnet/macOS" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=osx-x64 + $$(Q_BUILD) $$(MAKE) -C "linker/$(2)/dotnet/macOS" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=osx-x64 exec-mac-dotnet-x64-$(1): $(RUN_WITH_TIMEOUT) @echo "ℹ️ Executing the '$(2)' test for macOS/.NET (x64) ℹ️" - $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-x64/$(2).app/Contents/MacOS/$(2)" + $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/$(2)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-x64/$(2).app/Contents/MacOS/$(2)" # macOS/.NET/arm64 build-mac-dotnet-arm64-$(1): .stamp-dotnet-dependency-macOS - $$(Q) $$(MAKE) -C "linker/ios/$(2)/dotnet/macOS" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=osx-arm64 + $$(Q) $$(MAKE) -C "linker/$(2)/dotnet/macOS" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=osx-arm64 exec-mac-dotnet-arm64-$(1): $(RUN_WITH_TIMEOUT) ifeq ($(IS_APPLE_SILICON),1) @echo "ℹ️ Executing the '$(2)' test for macOS/.NET (arm64) ℹ️" - $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-arm64/$(2).app/Contents/MacOS/$(2)" + $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/$(2)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-arm64/$(2).app/Contents/MacOS/$(2)" else @echo "⚠️ Not executing the '$(2)' test for macOS/.NET (arm64) - not executing on Apple Silicon ⚠️" endif # MacCatalyst/.NET/x64 build-maccatalyst-dotnet-x64-$(1): .stamp-dotnet-dependency-MacCatalyst - $$(Q_BUILD) $$(MAKE) -C "linker/ios/$(2)/dotnet/MacCatalyst" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=maccatalyst-x64 + $$(Q_BUILD) $$(MAKE) -C "linker/$(2)/dotnet/MacCatalyst" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=maccatalyst-x64 exec-maccatalyst-dotnet-x64-$(1): $(RUN_WITH_TIMEOUT) @echo "ℹ️ Executing the '$(2)' test for Mac Catalyst/.NET (x64) ℹ️" - $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-x64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) + $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/$(2)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-x64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) # MacCatalyst/.NET/arm64 build-maccatalyst-dotnet-arm64-$(1): .stamp-dotnet-dependency-MacCatalyst - $$(Q) $$(MAKE) -C "linker/ios/$(2)/dotnet/MacCatalyst" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=maccatalyst-arm64 + $$(Q) $$(MAKE) -C "linker/$(2)/dotnet/MacCatalyst" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=maccatalyst-arm64 exec-maccatalyst-dotnet-arm64-$(1): $(RUN_WITH_TIMEOUT) ifeq ($(IS_APPLE_SILICON),1) @echo "ℹ️ Executing the '$(2)' test for Mac Catalyst/.NET (arm64) ℹ️" - $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-arm64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) + $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/$(2)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-arm64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) else @echo "⚠️ Not executing the '$(2)' test for Mac Catalyst/.NET (arm64) - not executing on Apple Silicon ⚠️" endif diff --git a/tests/xharness/Harness.cs b/tests/xharness/Harness.cs index cf277f1021ef..624fc92cd3a8 100644 --- a/tests/xharness/Harness.cs +++ b/tests/xharness/Harness.cs @@ -439,35 +439,35 @@ void PopulatePlatformSpecificProjects () new { Label = TestLabel.Linker, Platforms = TestPlatform.All, - ProjectPath = Path.Combine ("linker", "ios", "dont link"), + ProjectPath = Path.Combine ("linker", "dont link"), IsFSharp = false, Configurations = debugAndRelease, }, new { Label = TestLabel.Linker, Platforms = TestPlatform.All, - ProjectPath = Path.Combine ("linker", "ios", "link sdk"), + ProjectPath = Path.Combine ("linker", "link sdk"), IsFSharp = false, Configurations = debugAndRelease, }, new { Label = TestLabel.Linker, Platforms = TestPlatform.All, - ProjectPath = Path.Combine ("linker", "ios", "link all"), + ProjectPath = Path.Combine ("linker", "link all"), IsFSharp = false, Configurations = debugAndRelease, }, new { Label = TestLabel.Linker, Platforms = TestPlatform.All, - ProjectPath = Path.Combine ("linker", "ios", "trimmode copy"), + ProjectPath = Path.Combine ("linker", "trimmode copy"), IsFSharp = false, Configurations = debugAndRelease, }, new { Label = TestLabel.Linker, Platforms = TestPlatform.All, - ProjectPath = Path.Combine ("linker", "ios", "trimmode link"), + ProjectPath = Path.Combine ("linker", "trimmode link"), IsFSharp = false, Configurations = debugAndRelease, },