[os-event] Replace global cond by local cond for each waiting thread (#3941)
authorLudovic Henry <ludovic@xamarin.com>
Mon, 14 Nov 2016 15:08:09 +0000 (10:08 -0500)
committerGitHub <noreply@github.com>
Mon, 14 Nov 2016 15:08:09 +0000 (10:08 -0500)
acceptance-tests/SUBMODULES.json
acceptance-tests/ms-test-suite.mk
mcs/class/System/Mono.Btls/MonoBtlsContext.cs
mcs/class/System/Mono.Net.Security/MobileTlsContext.cs
mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs
mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs
mcs/nunit24/ConsoleRunner/nunit-console-exe/Class1.cs
mcs/nunit24/NUnitFramework/framework/TestFixtureAttribute.cs
mono/metadata/class.c
msvc/monoposixhelper.def
scripts/ci/run-test-default.sh

index 01faee39c981b1215ef68e84e38aa97446d09c14..9df7b8a5811328aafe3a0a58c0def29cf80ec5bb 100644 (file)
@@ -18,7 +18,7 @@
   {
     "name": "ms-test-suite", 
     "url": "git@github.com:xamarin/ms-test-suite.git", 
-    "rev": "eb7cd709549bffe170653a50805f1593d66ea81e", 
+    "rev": "55b6637eb1de61c743323ec82db1e0cadfee5b32", 
     "remote-branch": "origin/master", 
     "branch": "master", 
     "directory": "ms-test-suite"
@@ -31,4 +31,4 @@
     "branch": "master", 
     "directory": "benchmarker"
   }
-]
+]
\ No newline at end of file
index bd85bd494bd3b5e960de1e90ffc6c07330dbeb88..318fe2c2328c1afea1642f4ca9ada3d1a3b0faf4 100644 (file)
@@ -1,7 +1,7 @@
 check-ms-test-suite:
        @if $(MAKE) validate-ms-test-suite RESET_VERSIONS=1; then \
-               $(MAKE) -C $(MSTESTSUITE_PATH)/conformance build MCS="$(MCS) -debug -t:library -warn:1 -r:nunit.framework" && \
-               $(MAKE) -C $(MSTESTSUITE_PATH)/conformance run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-console.exe -nologo -exclude=MonoBug,BadTest" NUNIT_XML_RESULT=$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-conformance.xml || EXIT_CODE=1; \
+               $(MAKE) -C $(MSTESTSUITE_PATH)/conformance build MCS="$(MCS) -debug -t:library -warn:1 -r:nunitlite.dll" && \
+               $(MAKE) -C $(MSTESTSUITE_PATH)/conformance run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-lite-console.exe -exclude=MonoBug,BadTest -format:nunit2" NUNIT_XML_RESULT="-result:$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-conformance.xml" || EXIT_CODE=1; \
                $(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup build MCS="$(MCS) -debug -warn:1" && \
                $(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup run MONO="$(RUNTIME)" || EXIT_CODE=1; \
                exit $$EXIT_CODE; \
index e4054a173c8d3e5c221b5bbb2f6a4995a52f2237..051656ce0536f5bff3e4a82fc9f2ed76d344f823 100644 (file)
@@ -135,7 +135,7 @@ namespace Mono.Btls
                        if (IsServer) {
                                SetPrivateCertificate (nativeServerCertificate);
                        } else {
-                               ssl.SetServerName (TargetHost);
+                               ssl.SetServerName (ServerName);
                        }
                }
 
@@ -233,14 +233,7 @@ namespace Mono.Btls
                        if (!IsServer)
                                ctx.SetSelectCallback (SelectCallback);
 
-                       var host = TargetHost;
-                       if (!string.IsNullOrEmpty (host)) {
-                               var pos = TargetHost.IndexOf (':');
-                               if (pos > 0)
-                                       host = host.Substring (0, pos);
-                       }
-
-                       ctx.SetVerifyParam (MonoBtlsProvider.GetVerifyParam (host, IsServer));
+                       ctx.SetVerifyParam (MonoBtlsProvider.GetVerifyParam (ServerName, IsServer));
 
                        TlsProtocolCode minProtocol, maxProtocol;
                        GetProtocolVersions (out minProtocol, out maxProtocol);
index f051a5fcbc2c04ca406f2edebcf63019cc0af693..79f0468d4619aee415b238d9171366fe801abb8e 100644 (file)
@@ -35,6 +35,7 @@ namespace Mono.Net.Security
                MobileAuthenticatedStream parent;
                bool serverMode;
                string targetHost;
+               string serverName;
                SslProtocols enabledProtocols;
                X509Certificate serverCertificate;
                X509CertificateCollection clientCertificates;
@@ -54,6 +55,13 @@ namespace Mono.Net.Security
                        this.clientCertificates = clientCertificates;
                        this.askForClientCert = askForClientCert;
 
+                       serverName = targetHost;
+                       if (!string.IsNullOrEmpty (serverName)) {
+                               var pos = serverName.IndexOf (':');
+                               if (pos > 0)
+                                       serverName = serverName.Substring (0, pos);
+                       }
+
                        certificateValidator = CertificateValidationHelper.GetInternalValidator (
                                parent.Settings, parent.Provider);
                }
@@ -92,6 +100,10 @@ namespace Mono.Net.Security
                        get { return targetHost; }
                }
 
+               protected string ServerName {
+                       get { return serverName; }
+               }
+
                protected bool AskForClientCertificate {
                        get { return askForClientCert; }
                }
index 9a8560a92b58275149f51640218549c4c1a15652..af9fbec33bef62230039b5cefe5983203eb9ca64 100644 (file)
@@ -406,17 +406,17 @@ namespace System.Net.NetworkInformation {
                        get {
                                Win32_IP_ADAPTER_INFO ai = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
                                // FIXME: should ipv6 DhcpServer be considered?
-                               return ai != null ? Win32FromUnicast ((int) ai.Index, addr.FirstUnicastAddress) : new UnicastIPAddressInformationCollection ();
+                               return ai != null ? Win32FromUnicast (addr.FirstUnicastAddress) : new UnicastIPAddressInformationCollection ();
                        }
                }
 
-               static UnicastIPAddressInformationCollection Win32FromUnicast (int ifIndex, IntPtr ptr)
+               static UnicastIPAddressInformationCollection Win32FromUnicast (IntPtr ptr)
                {
                        UnicastIPAddressInformationCollection c = new UnicastIPAddressInformationCollection ();
                        Win32_IP_ADAPTER_UNICAST_ADDRESS a;
                        for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
                                a = (Win32_IP_ADAPTER_UNICAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_UNICAST_ADDRESS));
-                               c.InternalAdd (new Win32UnicastIPAddressInformation (ifIndex, a));
+                               c.InternalAdd (new Win32UnicastIPAddressInformation (a));
                        }
                        return c;
                }
index 439cab07cf091c553d92b9ba5565fdd1d81bb0dc..17710c420fd9c5188fef8dfcef54222bf74c250c 100644 (file)
 using System;
 using System.Runtime.InteropServices;
 using System.Net.Sockets;
+using System.Diagnostics.Contracts;
 
 namespace System.Net.NetworkInformation {
 #if !MOBILE
        class Win32UnicastIPAddressInformation : UnicastIPAddressInformation 
        {
-               int if_index;
                Win32_IP_ADAPTER_UNICAST_ADDRESS info;
+               IPAddress ipv4Mask;
 
-               public Win32UnicastIPAddressInformation (int ifIndex, Win32_IP_ADAPTER_UNICAST_ADDRESS info)
+               public Win32UnicastIPAddressInformation (Win32_IP_ADAPTER_UNICAST_ADDRESS info)
                {
-                       this.if_index = ifIndex;
                        this.info = info;
+                       IPAddress ipAddress = info.Address.GetIPAddress ();
+                       // IPv6 returns 0.0.0.0 for consistancy with XP
+                       if (ipAddress.AddressFamily == AddressFamily.InterNetwork) {
+                               ipv4Mask = PrefixLengthToSubnetMask (info.OnLinkPrefixLength, ipAddress.AddressFamily);
+                       }
                }
 
                public override IPAddress Address {
@@ -74,27 +79,15 @@ namespace System.Net.NetworkInformation {
                        get { return info.DadState; }
                }
 
-               public override IPAddress IPv4Mask {
+               public override IPAddress IPv4Mask{
                        get {
-                               Win32_IP_ADAPTER_INFO ai = Win32NetworkInterface2.GetAdapterInfoByIndex (if_index);
-                               if (ai == null)
-                                       throw new Exception ("huh? " + if_index);
-                               if (this.Address == null)
-                                       return null;
-                               string expected = this.Address.ToString ();
-                               unsafe {
-                                       Win32_IP_ADDR_STRING p = ai.IpAddressList;
-                                       while (true) {
-                                               if (p.IpAddress == expected)
-                                                       return IPAddress.Parse (p.IpMask);
-                                               if (p.Next == IntPtr.Zero)
-                                                       break;
-                                               p = (Win32_IP_ADDR_STRING) Marshal.PtrToStructure (p.Next, typeof (Win32_IP_ADDR_STRING));
-                                       }
-
-                                       // Or whatever it should be...
-                                       return null;
+                               // The IPv6 equivilant was never available on XP, and we've kept this behavior for legacy reasons.
+                               // For IPv6 use PrefixLength instead.
+                               if (Address.AddressFamily != AddressFamily.InterNetwork) {
+                                       return IPAddress.Any;
                                }
+
+                               return ipv4Mask;
                        }
                }
 
@@ -105,6 +98,28 @@ namespace System.Net.NetworkInformation {
                public override SuffixOrigin SuffixOrigin {
                        get { return info.SuffixOrigin; }
                }
+
+               // Convert a CIDR prefix length to a subnet mask "255.255.255.0" format
+               private static IPAddress PrefixLengthToSubnetMask (byte prefixLength, AddressFamily family) {
+                       Contract.Requires ((0 <= prefixLength) && (prefixLength <= 126));
+                       Contract.Requires ((family == AddressFamily.InterNetwork) || (family == AddressFamily.InterNetworkV6));
+
+                       byte[] addressBytes;
+                       if (family == AddressFamily.InterNetwork) {
+                               addressBytes = new byte [4];
+                       } else { // v6
+                               addressBytes = new byte [16];
+                       }
+
+                       Contract.Assert (prefixLength < (addressBytes.Length * 8));
+
+                       // Enable bits one at a time from left/high to right/low
+                       for (int bit = 0; bit < prefixLength; bit++) {
+                               addressBytes [bit / 8] |= (byte) (0x80 >> (bit % 8));
+                       }
+
+                       return new IPAddress (addressBytes);
+               }
        }
 #endif
 
index 4c55206a32b037e0e3f1e0da3e5e4b813702e430..ff2129e0ca0e6d86b79e6bf697e2e02ed95d3de8 100644 (file)
@@ -19,6 +19,9 @@ namespace NUnit.ConsoleRunner
                [STAThread]\r
                public static int Main(string[] args)\r
                {\r
+                       Console.ForegroundColor = ConsoleColor.Red;\r
+                       Console.WriteLine ("Note: nunit-console shipped with Mono is deprecated, please use the NUnit NuGet package or some other form of acquiring NUnit.");\r
+                       Console.ResetColor ();\r
                        return Runner.Main( args );\r
                }\r
        }\r
index 06794aa8b128d0533ecc6aedff760cf286f00f61..9fb55fb9d965b19a5f6b84321738cbd96ff886f9 100644 (file)
@@ -14,6 +14,7 @@ namespace NUnit.Framework
        /// {}\r
        /// </example>\r
        [AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)]\r
+       [Obsolete ("The NUnit framework shipped with Mono is deprecated and will be removed in a future release. It was based on NUnit 2.4 which is long outdated. Please move to the NUnit NuGet package or some other form of acquiring NUnit.", true)]\r
        public class TestFixtureAttribute : Attribute\r
        {\r
                private string description;\r
index f4646c71123615982cf7aa098a864b102d9c997a..163e3b9b2aff4c21655371a6cbc1a2bc9bd7378e 100644 (file)
@@ -3544,6 +3544,8 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
        int num_array_interfaces;
        int is_enumerator = FALSE;
 
+       mono_loader_lock ();
+
        mono_class_setup_supertypes (klass);
        /* 
         * get the implicit generic interfaces for either the arrays or for System.Array/InternalEnumerator<T>
@@ -3704,8 +3706,6 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
        }
 
        /* Publish the data */
-       mono_loader_lock ();
-
        klass->max_interface_id = max_iid;
        /*
         * We might get called multiple times:
@@ -3747,9 +3747,9 @@ setup_interface_offsets (MonoClass *klass, int cur_slot, gboolean overwrite)
                klass->interface_bitmap = bitmap;
 #endif
        }
+end:
        mono_loader_unlock ();
 
-end:
        g_free (interfaces_full);
        g_free (interface_offsets_full);
        g_free (array_interfaces);
index 611e4c7035cc49ff71830dfce29f6a8eabeb4c0f..027280d5a91a2549a63e5564db72035a76070536 100644 (file)
@@ -92,6 +92,7 @@ Mono_Posix_ToSyslogLevel
 Mono_Posix_ToSyslogOptions\r
 Mono_Posix_ToWaitOptions\r
 Mono_Posix_ToXattrFlags\r
+Mono_Unix_VersionString\r
 CreateZStream\r
 CloseZStream\r
 ReadZStream\r
index a531d8002ef29d812ce51b1748de2ac10438b465..f5381152be2e3f040954ffd7a0271c0e53ac0c8d 100755 (executable)
@@ -25,7 +25,7 @@ fi
 ${TESTCMD} --label=System.Data --timeout=5m make -w -C mcs/class/System.Data run-test
 ${TESTCMD} --label=System.Data.OracleClient --timeout=5m make -w -C mcs/class/System.Data.OracleClient run-test;
 ${TESTCMD} --label=System.Design --timeout=5m make -w -C mcs/class/System.Design run-test;
-${TESTCMD} --label=Mono.Posix --timeout=5m make -w -C mcs/class/Mono.Posix run-test
+if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Mono.Posix --skip; else ${TESTCMD} --label=Mono.Posix --timeout=5m make -w -C mcs/class/Mono.Posix run-test; fi
 ${TESTCMD} --label=System.Web --timeout=30m make -w -C mcs/class/System.Web run-test
 ${TESTCMD} --label=System.Web.Services --timeout=5m make -w -C mcs/class/System.Web.Services run-test
 ${TESTCMD} --label=System.Runtime.SFS --timeout=5m make -w -C mcs/class/System.Runtime.Serialization.Formatters.Soap run-test;