You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
@@ -137,7 +137,7 @@ namespace MonoTests.Microsoft.CSharp
|
||||
sb.Length = 0;
|
||||
Assert.AreEqual ("6.445F", Generate (new CodePrimitiveExpression ((float) 6.445), sw), "#8");
|
||||
sb.Length = 0;
|
||||
Assert.AreEqual ("5.76", Generate (new CodePrimitiveExpression ((double) 5.76), sw), "#9");
|
||||
Assert.AreEqual ("5.76D", Generate (new CodePrimitiveExpression ((double) 5.76), sw), "#9");
|
||||
sb.Length = 0;
|
||||
Assert.AreEqual ("7.667m", Generate (new CodePrimitiveExpression ((decimal) 7.667), sw), "#10");
|
||||
sb.Length = 0;
|
||||
|
@@ -49,7 +49,7 @@ namespace MonoTests.Microsoft.CSharp
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NullReferenceException))]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void TestCreateEscapedIdentifierNullArg ()
|
||||
{
|
||||
gen.CreateEscapedIdentifier (null);
|
||||
|
@@ -118,9 +118,9 @@ namespace MonoTests.Microsoft.VisualBasic
|
||||
sb.Length = 0;
|
||||
Assert.AreEqual ("6.445!", Generate (new CodePrimitiveExpression ((float) 6.445), sw), "#8");
|
||||
sb.Length = 0;
|
||||
Assert.AreEqual ("5.76", Generate (new CodePrimitiveExpression ((double) 5.76), sw), "#9");
|
||||
Assert.AreEqual ("5.76R", Generate (new CodePrimitiveExpression ((double) 5.76), sw), "#9");
|
||||
sb.Length = 0;
|
||||
Assert.AreEqual ("7.667", Generate (new CodePrimitiveExpression ((decimal) 7.667), sw), "#10");
|
||||
Assert.AreEqual ("7.667D", Generate (new CodePrimitiveExpression ((decimal) 7.667), sw), "#10");
|
||||
sb.Length = 0;
|
||||
Assert.AreEqual ("true", Generate (new CodePrimitiveExpression (true), sw), "#11");
|
||||
sb.Length = 0;
|
||||
|
@@ -202,9 +202,6 @@ namespace MonoTests.Microsoft.VisualBasic
|
||||
"Public MustInherit Class Test1{0}" +
|
||||
" {0}" +
|
||||
" Public MustOverride Property Name() As String{0}" +
|
||||
" Get{0}" +
|
||||
" Set{0}" +
|
||||
" End Property{0}" +
|
||||
"End Class{0}", NewLine), code);
|
||||
}
|
||||
|
||||
|
@@ -1123,6 +1123,16 @@ namespace MonoTests.System.Diagnostics
|
||||
Process.GetProcessesByName ("foo");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[NUnit.Framework.Category ("NotWorking")] //Getting the name of init works fine on Android and Linux, but fails on OSX, SELinux and iOS
|
||||
public void HigherPrivilegeProcessName ()
|
||||
{
|
||||
if (!RunningOnUnix)
|
||||
Assert.Ignore ("accessing pid 1, only available on unix");
|
||||
|
||||
string v = Process.GetProcessById (1).ProcessName;
|
||||
}
|
||||
|
||||
[Test]
|
||||
[NUnit.Framework.Category ("MobileNotWorking")]
|
||||
public void NonChildProcessWaitForExit ()
|
||||
|
@@ -302,14 +302,14 @@ namespace MonoTests.System.Net.Mail {
|
||||
Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
|
||||
Assert.IsNull (ex.InnerException, "#3");
|
||||
Assert.IsNotNull (ex.Message, "#4");
|
||||
Assert.AreEqual ("info", ex.ParamName, "#5");
|
||||
Assert.AreEqual ("serializationInfo", ex.ParamName, "#5");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MySmtpException : SmtpException {
|
||||
public MySmtpException (SerializationInfo info, StreamingContext context)
|
||||
: base (info, context)
|
||||
public MySmtpException (SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
: base (serializationInfo, streamingContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -1 +1 @@
|
||||
8cd738dc676c2d39164f5615b57fef3320819aed
|
||||
6e80da7dc78d1035425e9a6208d4f5902b685a92
|
@@ -57,7 +57,7 @@ namespace MonoTests.System.Net.WebSockets
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||
[Category ("NotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||
public void ServerHandshakeReturnCrapStatusCodeTest ()
|
||||
{
|
||||
// On purpose,
|
||||
@@ -149,7 +149,7 @@ namespace MonoTests.System.Net.WebSockets
|
||||
Assert.AreEqual (WebSocketState.CloseSent, socket.State);
|
||||
|
||||
var resp = socket.ReceiveAsync (new ArraySegment<byte> (new byte[0]), CancellationToken.None).Result;
|
||||
Assert.AreEqual (WebSocketState.Closed, socket.State);
|
||||
Assert.AreEqual (WebSocketState.CloseReceived, socket.State);
|
||||
Assert.AreEqual (WebSocketMessageType.Close, resp.MessageType);
|
||||
Assert.AreEqual (WebSocketCloseStatus.NormalClosure, resp.CloseStatus);
|
||||
Assert.AreEqual (string.Empty, resp.CloseStatusDescription);
|
||||
@@ -159,7 +159,11 @@ namespace MonoTests.System.Net.WebSockets
|
||||
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||
public void CloseAsyncTest ()
|
||||
{
|
||||
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
|
||||
if (!socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000)) {
|
||||
Assert.Inconclusive (socket.State.ToString ());
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.AreEqual (WebSocketState.Open, socket.State);
|
||||
|
||||
Assert.IsTrue (socket.CloseAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (5000));
|
||||
@@ -207,7 +211,7 @@ namespace MonoTests.System.Net.WebSockets
|
||||
Assert.IsTrue (socket.CloseAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (5000));
|
||||
Assert.IsTrue (socket.ReceiveAsync (new ArraySegment<byte> (new byte[0]), CancellationToken.None).Wait (5000));
|
||||
} catch (AggregateException e) {
|
||||
AssertWebSocketException (e, WebSocketError.Success);
|
||||
AssertWebSocketException (e, WebSocketError.InvalidState);
|
||||
return;
|
||||
}
|
||||
Assert.Fail ("Should have thrown");
|
||||
@@ -222,7 +226,7 @@ namespace MonoTests.System.Net.WebSockets
|
||||
Assert.IsTrue (socket.CloseAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (5000));
|
||||
Assert.IsTrue (socket.SendAsync (new ArraySegment<byte> (new byte[0]), WebSocketMessageType.Text, true, CancellationToken.None).Wait (5000));
|
||||
} catch (AggregateException e) {
|
||||
AssertWebSocketException (e, WebSocketError.Success);
|
||||
AssertWebSocketException (e, WebSocketError.InvalidState);
|
||||
return;
|
||||
}
|
||||
Assert.Fail ("Should have thrown");
|
||||
@@ -237,7 +241,7 @@ namespace MonoTests.System.Net.WebSockets
|
||||
Assert.IsTrue (socket.CloseOutputAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (5000));
|
||||
Assert.IsTrue (socket.SendAsync (new ArraySegment<byte> (new byte[0]), WebSocketMessageType.Text, true, CancellationToken.None).Wait (5000));
|
||||
} catch (AggregateException e) {
|
||||
AssertWebSocketException (e, WebSocketError.Success);
|
||||
AssertWebSocketException (e, WebSocketError.InvalidState);
|
||||
return;
|
||||
}
|
||||
Assert.Fail ("Should have thrown");
|
||||
@@ -292,7 +296,6 @@ namespace MonoTests.System.Net.WebSockets
|
||||
void AssertWebSocketException (AggregateException e, WebSocketError error, Type inner = null)
|
||||
{
|
||||
var wsEx = e.InnerException as WebSocketException;
|
||||
Console.WriteLine (e.InnerException.ToString ());
|
||||
Assert.IsNotNull (wsEx, "Not a websocketexception");
|
||||
Assert.AreEqual (error, wsEx.WebSocketErrorCode);
|
||||
if (inner != null) {
|
||||
|
@@ -37,7 +37,7 @@ namespace MonoTests.System.Net
|
||||
IAsyncResult async = Dns.BeginGetHostByName (site1Name, null, null);
|
||||
IPHostEntry entry = Dns.EndGetHostByName (async);
|
||||
SubTestValidIPHostEntry (entry);
|
||||
Assert.IsTrue (entry.HostName == "google-public-dns-a.google.com");
|
||||
Assert.AreEqual ("google-public-dns-a.google.com", entry.HostName, "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -219,26 +219,13 @@ namespace MonoTests.System.Net
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
[NUnit.Framework.Category ("AndroidNotWorking")] //Some Android devices like to return catch-all IPs for invalid host names.
|
||||
public void GetHostByName ()
|
||||
{
|
||||
SubTestGetHostByName (site1Name, site1Dot);
|
||||
SubTestGetHostByName (site2Name, site2Dot);
|
||||
try {
|
||||
var entry = Dns.GetHostByName (noneExistingSite);
|
||||
/*
|
||||
* Work around broken t-online.de DNS Server.
|
||||
*
|
||||
* T-Online's DNS Server for DSL Customers resolves
|
||||
* non-exisitng domain names to
|
||||
* http://navigationshilfe1.t-online.de/dnserror?url=....
|
||||
* instead of reporting an error.
|
||||
*/
|
||||
var navigationshilfe1 = IPAddress.Parse ("80.156.86.78");
|
||||
var navigationshilfe2 = IPAddress.Parse ("62.157.140.133");
|
||||
foreach (var addr in entry.AddressList) {
|
||||
if (addr.Equals (navigationshilfe1) || addr.Equals (navigationshilfe2))
|
||||
return;
|
||||
}
|
||||
Assert.Fail ("Should raise a SocketException (assuming that '" + noneExistingSite + "' does not exist)");
|
||||
} catch (SocketException) {
|
||||
}
|
||||
|
@@ -336,10 +336,20 @@ namespace MonoTests.System.Net
|
||||
DownloadFile (new ServerDownload (true));
|
||||
}
|
||||
|
||||
void DownloadFile (ServerDownload sp)
|
||||
[Test]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
public void DownloadFileNonLatinChars ()
|
||||
{
|
||||
string filename = "\u0411\u0430\u0448\u043DRowan-\u041F\u0435\u0441\u043D\u043F\u0440\u043E\u043C\u043E\u043D\u0430\u0445\u0430\u0422\u0435\u043E\u0434\u043E\u0440\u0443\u0441\u0430\u0438\u0437\u0413\u0430\u043C\u043C\u0435\u043B\u044C\u043D\u0430.mp3";
|
||||
DownloadFile (new ServerDownload (null, null, filename, false), "ftp://{0}:{1}/" + filename);
|
||||
}
|
||||
|
||||
void DownloadFile (ServerDownload sp, string uriTemplate = "ftp://{0}:{1}/file.txt")
|
||||
{
|
||||
sp.Start ();
|
||||
string uri = String.Format ("ftp://{0}:{1}/file.txt", EncloseIPv6 (sp.IPAddress), sp.Port);
|
||||
string uri = String.Format (uriTemplate, EncloseIPv6 (sp.IPAddress), sp.Port);
|
||||
try {
|
||||
FtpWebRequest ftp = (FtpWebRequest) WebRequest.Create (uri);
|
||||
ftp.KeepAlive = false;
|
||||
@@ -370,7 +380,7 @@ namespace MonoTests.System.Net
|
||||
{
|
||||
// Some embedded FTP servers in Industrial Automation Hardware report
|
||||
// the PWD using backslashes, but allow forward slashes for CWD.
|
||||
DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", false));
|
||||
DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", null, false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -381,7 +391,7 @@ namespace MonoTests.System.Net
|
||||
{
|
||||
// Some embedded FTP servers in Industrial Automation Hardware report
|
||||
// the PWD using backslashes, but allow forward slashes for CWD.
|
||||
DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", true));
|
||||
DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", null, true));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -580,18 +590,19 @@ namespace MonoTests.System.Net
|
||||
|
||||
class ServerDownload : FtpServer {
|
||||
|
||||
string Pwd, Cwd;
|
||||
string Pwd, Cwd, Filename;
|
||||
|
||||
public ServerDownload (bool ipv6)
|
||||
: this (null, null, ipv6)
|
||||
: this (null, null, null, ipv6)
|
||||
{
|
||||
}
|
||||
|
||||
public ServerDownload (string pwd, string cwd, bool ipv6)
|
||||
public ServerDownload (string pwd, string cwd, string filename, bool ipv6)
|
||||
: base (ipv6)
|
||||
{
|
||||
Pwd = pwd ?? "/home/someuser";
|
||||
Cwd = cwd ?? "/home/someuser/";
|
||||
Filename = filename ?? "file.txt";
|
||||
}
|
||||
|
||||
protected override void Run ()
|
||||
@@ -620,8 +631,8 @@ namespace MonoTests.System.Net
|
||||
writer.Flush ();
|
||||
|
||||
str = reader.ReadLine ();
|
||||
if (str != "RETR file.txt") {
|
||||
Where = "RETR - " + str;
|
||||
if (str != $"RETR {Filename}") {
|
||||
Where = $"RETR - got: {str}, expected: RETR {Filename}";
|
||||
client.Close ();
|
||||
return;
|
||||
}
|
||||
|
@@ -286,7 +286,7 @@ namespace MonoTests.System.Net
|
||||
WebHeaderCollection headers = resp.Headers;
|
||||
Assert.AreEqual (6, headers.Count, "#1");
|
||||
Assert.AreEqual ("9", headers ["Content-Length"], "#2");
|
||||
Assert.AreEqual ("utf-8", headers ["Content-Encoding"], "#3");
|
||||
Assert.AreEqual ("identity", headers ["Content-Encoding"], "#3");
|
||||
Assert.AreEqual ("text/xml; charset=UTF-8", headers ["Content-Type"], "#4");
|
||||
Assert.AreEqual ("Wed, 08 Jan 2003 23:11:55 GMT", headers ["Last-Modified"], "#5");
|
||||
Assert.AreEqual ("UserID=Miguel,StoreProfile=true", headers ["Set-Cookie"], "#6");
|
||||
@@ -510,7 +510,7 @@ namespace MonoTests.System.Net
|
||||
sw.WriteLine ("HTTP/1.0 200 OK");
|
||||
sw.WriteLine ("Server: Mono/Test");
|
||||
sw.WriteLine ("Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT");
|
||||
sw.WriteLine ("Content-Encoding: " + Encoding.UTF8.WebName);
|
||||
sw.WriteLine ("Content-Encoding: identity");
|
||||
sw.WriteLine ("Content-Type: text/xml; charset=UTF-8");
|
||||
sw.WriteLine ("Content-Length: 9");
|
||||
sw.WriteLine ("Set-Cookie: UserID=Miguel");
|
||||
@@ -521,6 +521,30 @@ namespace MonoTests.System.Net
|
||||
|
||||
return Encoding.UTF8.GetBytes (sw.ToString ());
|
||||
}
|
||||
|
||||
internal static byte [] GzipResponseHandler (Socket socket)
|
||||
{
|
||||
StringWriter sw = new StringWriter ();
|
||||
sw.NewLine = "\r\n";
|
||||
sw.WriteLine ("HTTP/1.0 200 OK");
|
||||
sw.WriteLine ("Server: Mono/Test");
|
||||
sw.WriteLine ("Content-Encoding: gzip");
|
||||
sw.WriteLine ("Content-Type: text/xml; charset=UTF-8");
|
||||
sw.WriteLine ();
|
||||
sw.Flush ();
|
||||
|
||||
var gzipDummyXml = new byte[] {
|
||||
0x1f, 0x8b, 0x08, 0x08, 0xb6, 0xb1, 0xd3, 0x58, 0x00, 0x03, 0x74, 0x65, 0x73, 0x74, 0x67, 0x7a,
|
||||
0x00, 0xb3, 0x49, 0x29, 0xcd, 0xcd, 0xad, 0x54, 0xd0, 0xb7, 0x03, 0x00, 0xed, 0x55, 0x32, 0xec,
|
||||
0x09, 0x00, 0x00, 0x00 };
|
||||
var header = Encoding.UTF8.GetBytes (sw.ToString ());
|
||||
|
||||
var response = new byte[gzipDummyXml.Length + header.Length];
|
||||
header.CopyTo(response, 0);
|
||||
gzipDummyXml.CopyTo(response, header.Length);
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
@@ -1193,5 +1217,38 @@ namespace MonoTests.System.Net
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
public void AutomaticDecompression ()
|
||||
{
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, s => HttpWebResponseTest.GzipResponseHandler (s))) {
|
||||
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
|
||||
req.Method = "GET";
|
||||
req.Timeout = 2000;
|
||||
req.ReadWriteTimeout = 2000;
|
||||
req.KeepAlive = false;
|
||||
req.AutomaticDecompression = DecompressionMethods.GZip;
|
||||
|
||||
using (HttpWebResponse resp = (HttpWebResponse) req.GetResponse ()) {
|
||||
Stream rs = resp.GetResponseStream ();
|
||||
byte [] buffer = new byte [24];
|
||||
try {
|
||||
// read full response
|
||||
Assert.AreEqual (9, rs.Read (buffer, 0, buffer.Length));
|
||||
Assert.IsNull (resp.Headers[HttpRequestHeader.ContentEncoding]);
|
||||
} finally {
|
||||
rs.Close ();
|
||||
req.Abort ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user