From 4a6dec855fd4ece8d5a13f30e8aacc362ff02ca1 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Sat, 5 Dec 2015 11:19:36 -0500 Subject: [PATCH] [corlib][tests] Disable tests that requires Windows (dllimport) on mobile profile This enables building the tests w/bitcode enabled on AppleTV (and they were already excluded from the results anyway). Part of the fix for https://bugzilla.xamarin.com/show_bug.cgi?id=36569 --- .../corlib/Test/System.Reflection/MethodInfoTest.cs | 10 ++++++++++ .../Test/System.Runtime.InteropServices/MarshalTest.cs | 2 ++ .../X509CapiTest.cs | 2 ++ 3 files changed, 14 insertions(+) diff --git a/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs b/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs index b8a9de2b3c5..57e2fa6364e 100644 --- a/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs +++ b/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs @@ -52,7 +52,12 @@ namespace MonoTests.System.Reflection [TestFixture] public class MethodInfoTest { +#if MONOTOUCH + // use an existing symbol - so we can build without dlsym. It does not matter that the signature does not match for the test + [DllImport ("libc", EntryPoint="readlink", CharSet=CharSet.Unicode, ExactSpelling=false, PreserveSig=true, SetLastError=true, BestFitMapping=true, ThrowOnUnmappableChar=true)] +#else [DllImport ("libfoo", EntryPoint="foo", CharSet=CharSet.Unicode, ExactSpelling=false, PreserveSig=true, SetLastError=true, BestFitMapping=true, ThrowOnUnmappableChar=true)] +#endif public static extern void dllImportMethod (); [MethodImplAttribute(MethodImplOptions.PreserveSig)] public void preserveSigMethod () @@ -108,8 +113,13 @@ namespace MonoTests.System.Reflection DllImportAttribute attr = (DllImportAttribute)((t.GetMethod ("dllImportMethod").GetCustomAttributes (typeof (DllImportAttribute), true)) [0]); Assert.AreEqual (CallingConvention.Winapi, attr.CallingConvention, "#1"); +#if MONOTOUCH + Assert.AreEqual ("readlink", attr.EntryPoint, "#2"); + Assert.AreEqual ("libc", attr.Value, "#3"); +#else Assert.AreEqual ("foo", attr.EntryPoint, "#2"); Assert.AreEqual ("libfoo", attr.Value, "#3"); +#endif Assert.AreEqual (CharSet.Unicode, attr.CharSet, "#4"); Assert.AreEqual (false, attr.ExactSpelling, "#5"); Assert.AreEqual (true, attr.PreserveSig, "#6"); diff --git a/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs b/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs index 92675b00f7c..4c38e08ed56 100644 --- a/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs @@ -805,6 +805,7 @@ namespace MonoTests.System.Runtime.InteropServices } } +#if !MOBILE [DllImport ("kernel32.dll", SetLastError = true)] [PreserveSig] static extern uint GetModuleFileName ( @@ -816,6 +817,7 @@ namespace MonoTests.System.Runtime.InteropServices [MarshalAs (UnmanagedType.U4)] int nSize ); +#endif } #if !NET_2_1 [ComImport()] diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs index 50dfe0e157d..328bbb54a50 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs @@ -72,6 +72,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates { File.Delete("temp.b64"); } +#if !MOBILE public IntPtr GetHandleEx (byte[] certificate) { CertificateContext cc = new CertificateContext (); @@ -151,6 +152,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates { Assert.AreEqual (serial, x509.GetSerialNumber (), "GetSerialNumber"); Assert.AreEqual ("02720006E8", x509.GetSerialNumberString (), "GetSerialNumberString"); } +#endif [Test] [ExpectedException (typeof (ArgumentException))] -- GitLab