Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -639,7 +639,7 @@ namespace MonoTests.Microsoft.CSharp
continue;
}
throw new Exception (compilerError.ToString ());
Assert.Fail (compilerError.ToString ());
}
}

View File

@@ -53,7 +53,7 @@ namespace MonoTests.System.CodeDom.Compiler
int importPosition = result.IndexOf (IMPORT);
int attributePosition = result.IndexOf (ATTRIBUTE);
Assert.Greater (attributePosition, importPosition, "Actual order: " + result);
AssertHelper.Greater (attributePosition, importPosition, "Actual order: " + result);
}
[Test]

View File

@@ -38,9 +38,6 @@ using System.Text;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using NUnit.Framework;
#if !MOBILE
using NUnit.Framework.SyntaxHelpers;
#endif
namespace MonoTests.System.Collections.Generic
{

View File

@@ -26,7 +26,7 @@ namespace MonoTests.System.ComponentModel
SynchronizationContext sc1 = new SynchronizationContext ();
SynchronizationContext sc2 = new SynchronizationContext ();
#if MOBILE && !MONODROID
#if MONOTOUCH || XAMMAC
Assert.IsNotNull (SynchronizationContext.Current, "A1");
#else
Assert.IsNull (SynchronizationContext.Current, "A1");

View File

@@ -16,7 +16,7 @@ using System.ComponentModel.Design;
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
#if !MOBILE && !MONOMAC
#if !MOBILE && !MONOMAC && !XAMMAC_4_5
using System.Drawing.Design;
#endif
using NUnit.Framework;
@@ -1053,7 +1053,7 @@ namespace MonoTests.System.ComponentModel
return attr;
return null;
}
#if !MOBILE && !MONOMAC
#if !MOBILE && !MONOMAC && !XAMMAC_4_5
class GetEditor_test
{
[Editor (typeof (UIEditor), typeof (UITypeEditor))]

View File

@@ -16,7 +16,7 @@ namespace MonoTests.System.ComponentModel
[TestFixture]
public class ToolboxItemAttributeTests
{
#if !MOBILE && !MONOMAC
#if !MOBILE && !MONOMAC && !XAMMAC_4_5
[Test]
public void DefaultType ()
{

View File

@@ -287,7 +287,11 @@ namespace MonoTests.System.Configuration {
[Test]
public void TestSettings2_Properties ()
{
#if XAMMAC_4_5
string expected = "MonoTests.System.Configuration.ProviderPoker, xammac_net_4_5_System_test, Version=0.0.0.0";
#else
string expected = "MonoTests.System.Configuration.ProviderPoker, net_4_x_System_test, Version=0.0.0.0";
#endif
Assert.AreEqual (expected, new SettingsProviderAttribute (typeof (ProviderPoker)).ProviderTypeName.Substring (0, expected.Length), "#1");
TestSettings2 settings = new TestSettings2 ();

View File

@@ -1 +1 @@
706bfcdac0c6fa51f6b9a8017e213e59719b12e1
6e63058fed7d5ff90caac0148dcdd7a0b2c8652e

View File

@@ -1 +1 @@
b747e0dd0164e0fc6e98da731bc02b49911c94ef
815bbb85c45d0c4fe36d4a49819a0384e4816a60

View File

@@ -14,6 +14,7 @@ using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using System.Runtime.InteropServices;
using NUnit.Framework;
@@ -22,6 +23,13 @@ namespace MonoTests.System.Diagnostics
[TestFixture]
public class ProcessTest
{
static bool RunningOnUnix {
get {
int p = (int)Environment.OSVersion.Platform;
return ((p == 128) || (p == 4) || (p == 6));
}
}
[Test]
public void GetProcessById_MachineName_Null ()
{
@@ -284,7 +292,9 @@ namespace MonoTests.System.Diagnostics
Assert.AreEqual (-2147467259, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
Assert.AreEqual (2, ex.NativeErrorCode, "#6");
// TODO: On windows we get ACCESS_DENIED (5) instead of FILE_NOT_FOUND (2) and .NET
// gives ERROR_INVALID_PARAMETER (87). See https://bugzilla.xamarin.com/show_bug.cgi?id=44514
Assert.IsTrue (ex.NativeErrorCode == 2 || ex.NativeErrorCode == 5 || ex.NativeErrorCode == 87, "#6");
}
}
@@ -440,7 +450,9 @@ namespace MonoTests.System.Diagnostics
Assert.AreEqual (-2147467259, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
Assert.AreEqual (2, ex.NativeErrorCode, "#6");
// TODO: On windows we get ACCESS_DENIED (5) instead of FILE_NOT_FOUND (2) and .NET
// gives ERROR_INVALID_PARAMETER (87). See https://bugzilla.xamarin.com/show_bug.cgi?id=44514
Assert.IsTrue (ex.NativeErrorCode == 2 || ex.NativeErrorCode == 5 || ex.NativeErrorCode == 87, "#6");
}
}
@@ -724,13 +736,6 @@ namespace MonoTests.System.Diagnostics
bytesRead = stm.EndRead (ar);
}
static bool RunningOnUnix {
get {
int p = (int)Environment.OSVersion.Platform;
return ((p == 128) || (p == 4) || (p == 6));
}
}
public int bytesRead = -1;
[Test]
@@ -892,8 +897,11 @@ namespace MonoTests.System.Diagnostics
path = "/bin/cat";
#endif
return new ProcessStartInfo (path);
} else
return new ProcessStartInfo ("type");
} else {
var psi = new ProcessStartInfo ("findstr");
psi.Arguments = "\"^\"";
return psi;
}
}
#endif // MONO_FEATURE_PROCESS_START
@@ -1018,7 +1026,7 @@ namespace MonoTests.System.Diagnostics
StringBuilder sb = new StringBuilder ();
sb.AppendFormat ("Could not found: {0} {1}\n", name.Name, name.Version);
sb.AppendLine ("Looked in assemblies:");
sb.AppendLine ("Looked in modules:");
foreach (var o in modules) {
var m = (ProcessModule) o;
@@ -1106,5 +1114,71 @@ namespace MonoTests.System.Diagnostics
}
}
#endif // MONO_FEATURE_PROCESS_START
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
public void GetProcessesByName()
{
// This should return Process[0] or a Process[] with all the "foo" programs running
Process.GetProcessesByName ("foo");
}
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
public void NonChildProcessWaitForExit ()
{
if (!RunningOnUnix)
Assert.Ignore ("accessing parent pid, only available on unix");
using (Process process = Process.GetProcessById (getppid ()))
using (ManualResetEvent mre = new ManualResetEvent (false))
{
Assert.IsFalse (process.WaitForExit (10), "#1");
Assert.IsFalse (process.HasExited, "#2");
Assert.Throws<InvalidOperationException>(delegate { int exitCode = process.ExitCode; }, "#3");
process.Exited += (s, e) => mre.Set ();
process.EnableRaisingEvents = true;
Assert.IsFalse (mre.WaitOne (100), "#4");
Assert.IsFalse (process.WaitForExit (10), "#5");
Assert.IsFalse (process.HasExited, "#6");
Assert.Throws<InvalidOperationException>(delegate { int exitCode = process.ExitCode; }, "#7");
}
}
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
public void NonChildProcessName ()
{
if (!RunningOnUnix)
Assert.Ignore ("accessing parent pid, only available on unix");
using (Process process = Process.GetProcessById (getppid ()))
{
string pname = process.ProcessName;
Assert.IsNotNull (pname, "#1");
AssertHelper.IsNotEmpty (pname, "#2");
}
}
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
public void NonChildProcessId ()
{
if (!RunningOnUnix)
Assert.Ignore ("accessing parent pid, only available on unix");
int ppid;
using (Process process = Process.GetProcessById (ppid = getppid ()))
{
int pid = process.Id;
Assert.AreEqual (ppid, pid, "#1");
AssertHelper.Greater (pid, 0, "#2");
}
}
[DllImport ("libc")]
static extern int getppid();
}
}

View File

@@ -53,7 +53,7 @@ namespace MonoTests.System.Diagnostics
public void ConstructorNullName ()
{
SourceSwitch s = new SourceSwitch (null);
Assert.AreEqual (s.DisplayName.Length, 0);
AssertHelper.IsEmpty (s.DisplayName);
}
[Test]

View File

@@ -190,8 +190,8 @@ namespace MonoTests.System.Diagnostics {
public void NullSwitchHasEmptyDisplayNameAndDescription ()
{
var s = new TestNullSwitch ();
Assert.IsEmpty (s.DisplayName);
Assert.IsEmpty (s.Description);
AssertHelper.IsEmpty (s.DisplayName);
AssertHelper.IsEmpty (s.Description);
}
}
}

View File

@@ -67,7 +67,7 @@ bulldog Error: 0 :
Error: 0 :
bulldog Transfer: 0 : hoge, relatedActivityId=00000000-0000-0000-0000-000000000000
";
Assert.AreEqual (expected, sw.ToString ().Replace ("\r\n", "\n"));
Assert.AreEqual (expected.Replace ("\r\n", "\n"), sw.ToString ().Replace ("\r\n", "\n"));
}
[Test]
@@ -116,7 +116,7 @@ bulldog Error: 0 :
Timestamp={1}
bulldog Transfer: 0 : hoge, relatedActivityId=00000000-0000-0000-0000-000000000000
", date.ToString ("o"), time); // date and time are in current culture
Assert.AreEqual (expected, sw.ToString ().Replace ("\r\n", "\n"));
Assert.AreEqual (expected.Replace ("\r\n", "\n"), sw.ToString ().Replace ("\r\n", "\n"));
}
class MyTraceListener : TraceListener

View File

@@ -113,6 +113,9 @@ namespace MonoTests.System.Net.NetworkInformation
[Test]
public void DnsEnabled ()
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
Assert.Ignore ("IsDnsEnabled is not nessasarily enabled for all interfaces on windows.");
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces ();
foreach (NetworkInterface adapter in adapters)
{

View File

@@ -59,6 +59,7 @@ public class SslStreamTest {
}
[Test] //bug https://bugzilla.novell.com/show_bug.cgi?id=457120
[Category ("MacNotWorking")] // Works but launches a prompt on 10.12 that will fail if you don't click in a few seconds
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif

View File

@@ -63,7 +63,7 @@ namespace MonoTests.System.Net.Sockets
clientSocket.NoDelay = true;
Assert.IsTrue(mainEvent.WaitOne(1500));
Assert.AreEqual(serverSocket, acceptedSocket);
Assert.AreEqual(serverSocket, acceptedSocket, "x");
mainEvent.Reset();
if (acceptedSocket != null)

View File

@@ -1 +1 @@
14ec2700869c289ee1159851c5402e07138b70a5
5473cf3916b998b25e4b8dcf2f55fb2b14a3f1e0

View File

@@ -199,5 +199,16 @@ namespace MonoTests.System.Net.Sockets
Assert.Fail ("ConnectMultiRefused #3");
}
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ExclusiveAddressUse ()
{
using (TcpClient client = new TcpClient ()) {
client.ExclusiveAddressUse = false;
}
}
}
}

View File

@@ -219,5 +219,27 @@ namespace MonoTests.System.Net.Sockets
listen.Start (65536);
listen.Stop ();
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void EndAcceptTcpClient ()
{
var port = NetworkHelpers.FindFreePort ();
var listenerSocket = new TcpListener (IPAddress.Any, port);
listenerSocket.Start ();
listenerSocket.BeginAcceptTcpClient (new AsyncCallback (l => {
listenerSocket.EndAcceptTcpClient (l);
}), null);
using (var outClient = new TcpClient ("localhost", port)) {
using (var stream = outClient.GetStream ()) {
stream.WriteByte (3);
}
}
}
}
}

View File

@@ -558,25 +558,15 @@ namespace MonoTests.System.Net.Sockets {
}
[Test] // JoinMulticastGroup (IPAddress)
[Category ("NotWorking")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void JoinMulticastGroup1_Socket_NotBound ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
UdpClient client = new UdpClient (AddressFamily.InterNetwork);
try {
using (UdpClient client = new UdpClient (AddressFamily.InterNetwork)) {
client.JoinMulticastGroup (mcast_addr);
Assert.Fail ("#1");
} catch (SocketException ex) {
// An invalid argument was supplied
Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
Assert.AreEqual (10022, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
} finally {
client.Close ();
}
}
@@ -666,25 +656,15 @@ namespace MonoTests.System.Net.Sockets {
}
[Test] // JoinMulticastGroup (Int32, IPAddress)
[Category ("NotWorking")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void JoinMulticastGroup2_Socket_NotBound ()
{
IPAddress mcast_addr = IPAddress.Parse ("ff02::1");
UdpClient client = new UdpClient (AddressFamily.InterNetworkV6);
try {
using (UdpClient client = new UdpClient (AddressFamily.InterNetworkV6)) {
client.JoinMulticastGroup (0, mcast_addr);
Assert.Fail ("#1");
} catch (SocketException ex) {
// An invalid argument was supplied
Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
Assert.AreEqual (10022, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
} finally {
client.Close ();
}
}
@@ -767,25 +747,15 @@ namespace MonoTests.System.Net.Sockets {
}
[Test] // JoinMulticastGroup (IPAddress, Int32)
[Category ("NotWorking")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void JoinMulticastGroup3_Socket_NotBound ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
UdpClient client = new UdpClient (AddressFamily.InterNetwork);
try {
using (UdpClient client = new UdpClient (AddressFamily.InterNetwork)) {
client.JoinMulticastGroup (mcast_addr, 5);
Assert.Fail ("#1");
} catch (SocketException ex) {
// An invalid argument was supplied
Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
Assert.AreEqual (10022, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
} finally {
client.Close ();
}
}
@@ -896,26 +866,16 @@ namespace MonoTests.System.Net.Sockets {
}
[Test] // JoinMulticastGroup (IPAddress, IPAddress)
[Category ("NotWorking")]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void JoinMulticastGroup4_Socket_NotBound ()
{
IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23");
IPAddress local_addr = Dns.GetHostEntry (string.Empty).AddressList [0];
UdpClient client = new UdpClient (AddressFamily.InterNetwork);
try {
using (UdpClient client = new UdpClient (AddressFamily.InterNetwork)) {
client.JoinMulticastGroup (mcast_addr, local_addr);
Assert.Fail ("#1");
} catch (SocketException ex) {
// An invalid argument was supplied
Assert.AreEqual (typeof (SocketException), ex.GetType (), "#2");
Assert.AreEqual (10022, ex.ErrorCode, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
Assert.AreEqual (10022, ex.NativeErrorCode, "#6");
Assert.AreEqual (SocketError.InvalidArgument, ex.SocketErrorCode, "#7");
} finally {
client.Close ();
}
}
@@ -1031,8 +991,14 @@ namespace MonoTests.System.Net.Sockets {
"BeginSend #4");
}
IPEndPoint ep = new IPEndPoint (Dns.GetHostEntry (string.Empty).AddressList[0], 1236);
IPAddress[] addresses = Dns.GetHostEntry (string.Empty).AddressList;
IPEndPoint ep = null;
foreach (IPAddress a in addresses) {
if (a.AddressFamily == AddressFamily.InterNetwork) {
ep = new IPEndPoint (a, 1236);
break;
}
}
BSCalledBack.Reset ();
client.BeginSend (bytes, bytes.Length, ep,

Some files were not shown because too many files have changed in this diff Show More