Imported Upstream version 5.16.0.100

Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-08-07 15:19:03 +00:00
parent 0a9828183b
commit 7d7f676260
4419 changed files with 170950 additions and 90273 deletions

View File

@@ -1 +1 @@
ea5e716e270682aa982464368bc77d8d447869c8
bef88b0c599515481b21854be4e0073c3fea3617

View File

@@ -37,7 +37,6 @@ namespace MonoTests.System.Collections.Concurrent
public class PartitionerTests
{
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void PartitionerCreateIntegerWithExplicitRange ()
{
OrderablePartitioner<Tuple<int, int>> partitioner = Partitioner.Create (1, 20, 5);
@@ -59,7 +58,6 @@ namespace MonoTests.System.Collections.Concurrent
}
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void PartitionerCreateLongWithExplicitRange ()
{
OrderablePartitioner<Tuple<long, long>> partitioner = Partitioner.Create ((long)1, (long)20, (long)5);

View File

@@ -11,6 +11,7 @@ using System;
using System.Diagnostics;
using System.Reflection;
using NUnit.Framework;
using System.Runtime.ExceptionServices;
namespace MonoTests.System.Diagnostics
{
@@ -180,7 +181,7 @@ namespace MonoTests.System.Diagnostics
frame1.GetFileLineNumber (),
"Line number (1)");
Assert.AreEqual (134,
Assert.AreEqual (135,
frame2.GetFileLineNumber (),
"Line number (2)");
@@ -320,7 +321,7 @@ namespace MonoTests.System.Diagnostics
frame1.GetFileLineNumber (),
"Line number (1)");
Assert.AreEqual (270,
Assert.AreEqual (271,
frame2.GetFileLineNumber (),
"Line number (2)");
}
@@ -341,6 +342,41 @@ namespace MonoTests.System.Diagnostics
"Column number (2)");
}
/// <summary>
/// Test whether GetFrames contains the frames for nested exceptions
/// </summary>
[Test]
public void GetFramesAndNestedExc ()
{
try
{
throw new Exception("This is a test");
}
catch (Exception e)
{
try
{
ExceptionDispatchInfo.Capture(e.InnerException ?? e).Throw();
}
catch (Exception ee)
{
StackTrace st = new StackTrace(ee, true);
StackFrame[] frames = st.GetFrames();
//Console.WriteLine("StackFrame.ToString() foreach StackFrame in Stacktrace.GetFrames():");
//foreach (StackFrame frame in frames)
//Console.WriteLine(frame);
//Console.WriteLine("Expecting: Main, Throw, Main");
Assert.AreEqual (3, frames.Length);
var wrongFrames = false;
Assert.AreEqual ("GetFramesAndNestedExc", frames [0].GetMethod ().Name);
Assert.AreEqual ("Throw", frames [1].GetMethod ().Name);
Assert.AreEqual ("GetFramesAndNestedExc", frames [2].GetMethod ().Name);
}
}
}
/// <summary>
/// Tests whether getting method associated with frame works.
/// </summary>

View File

@@ -664,6 +664,7 @@ namespace MonoTests.System.Globalization
}
[Test]
[Category ("MultiThreaded")]
public void DefaultThreadCurrentCulture () {
Action c = () => {

View File

@@ -569,6 +569,7 @@ public class BinaryWriterTest {
}
[Test]
[Category ("MultiThreaded")]
public void AsynchronousModeWrites ()
{
string filename = Path.Combine (TempFolder, "myfilename");

View File

@@ -65,7 +65,6 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void GetDrivesValidInfo ()
{
var drives = DriveInfo.GetDrives ();

View File

@@ -1542,6 +1542,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void BeginWrite_Recursive ()
{
string path = TempFolder + Path.DirectorySeparatorChar + "temp";

View File

@@ -1276,7 +1276,11 @@ namespace MonoTests.System.IO
for (var i = 0; i < 200; i++) {
File.WriteAllText (path, "");
var untouched = File.GetLastWriteTimeUtc (path);
File.SetLastWriteTimeUtc (path, DateTime.UtcNow);
var now = DateTime.UtcNow;
var diff = now - untouched;
// sanity check
Assert.IsTrue (diff.TotalSeconds >= 0 && diff.TotalSeconds < 2.0, $"Iteration #{i} failed, diff.TotalSeconds: {diff.TotalSeconds}, untouched: {untouched.ToString (fmt)}, now: {now.ToString (fmt)}");
File.SetLastWriteTimeUtc (path, now);
var touched = File.GetLastWriteTimeUtc (path);
Assert.IsTrue (touched >= untouched, $"Iteration #{i} failed, untouched: {untouched.ToString (fmt)} touched: {touched.ToString (fmt)}");

View File

@@ -334,6 +334,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void BeginReadIsBlockingNextRead ()
{
byte[] readBytes = new byte[5];
@@ -394,6 +395,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void BeginRead_BeginWrite ()
{
byte[] readBytes = new byte[5];

View File

@@ -434,7 +434,7 @@ namespace MonoTests.System.IO
string testFileName = Path.GetFileName (path1);
Assert.AreEqual ("test.txt", testFileName, "#1");
testFileName = Path.GetFileName (null);
testFileName = Path.GetFileName ((string)null);
Assert.AreEqual (null, testFileName, "#2");
testFileName = Path.GetFileName (String.Empty);
Assert.AreEqual (String.Empty, testFileName, "#3");

View File

@@ -470,7 +470,6 @@ namespace MonoTests.System.Reflection.Emit
public delegate object RetObj();
[Test] //#640702
[Category ("NotWorkingRuntimeInterpreter")]
public void GetCurrentMethodWorksWithDynamicMethods ()
{
DynamicMethod dm = new DynamicMethod("Foo", typeof(object), null);
@@ -527,7 +526,6 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void ExceptionHandling ()
{
var method = new DynamicMethod ("", typeof(void), new[] { typeof(int) }, typeof (DynamicMethodTest));
@@ -594,7 +592,6 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void ExceptionHandlingWithExceptionDispatchInfo ()
{
var method = new DynamicMethod ("", typeof(void), new[] { typeof(int) }, typeof (DynamicMethodTest));
@@ -652,7 +649,6 @@ namespace MonoTests.System.Reflection.Emit
}
[Test] //see bxc #59334
[Category ("NotWorkingRuntimeInterpreter")]
public void ExceptionWrapping ()
{
AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (new AssemblyName ("ehatevfheiw"), AssemblyBuilderAccess.Run);

View File

@@ -1024,7 +1024,6 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]//bug #626441
[Category ("NotWorkingRuntimeInterpreter")]
public void CanCallVarargMethods ()
{
var tb = module.DefineType ("foo");

View File

@@ -47,5 +47,48 @@ namespace MonoTests.System.Reflection.Emit
var builder = hello.DefineParameter(1, ParameterAttributes.In, "failParam");
builder.SetConstant(1);
}
public enum E : byte {
E1, E2
}
[Test]
public void SetConstantNullable ()
{
// SetConstant for a Nullable<X> parameter for various X.
var aName = new AssemblyName ("TestSetConstantNullable");
var ab = AppDomain.CurrentDomain.DefineDynamicAssembly (aName, AssemblyBuilderAccess.Run);
var mb = ab.DefineDynamicModule (aName.Name);
var tb = mb.DefineType ("TestItf", TypeAttributes.Abstract | TypeAttributes.Interface);
var paramTypes = new[] { typeof (int?), typeof (int?),
typeof (E?), typeof (E?) };
var methb = tb.DefineMethod ("Method", MethodAttributes.Public | MethodAttributes.Abstract | MethodAttributes.Virtual, typeof (void), paramTypes);
var pb = new ParameterBuilder [paramTypes.Length];
for (int idx = 0, pnum = 1; idx < paramTypes.Length; idx++, pnum++) {
pb [idx] = methb.DefineParameter (pnum, ParameterAttributes.Optional | ParameterAttributes.HasDefault, "arg" + idx);
}
pb [0].SetConstant (null);
pb [1].SetConstant (42);
pb [2].SetConstant (null);
pb [3].SetConstant (E.E2);
var t = tb.CreateType ();
var mi = t.GetMethod ("Method");
Assert.IsNotNull (mi);
var ps = mi.GetParameters ();
Assert.AreEqual (null, ps[0].DefaultValue);
Assert.AreEqual (42, ps[1].DefaultValue);
Assert.AreEqual (null, ps[2].DefaultValue);
Assert.AreEqual ((byte)E.E2, ps[3].DefaultValue);
}
}
}

View File

@@ -1 +1 @@
ecf68042d94f42b229e1001ff274a325aa6d0f14
e4f73aea23f15dae625b30ee994b5e3d7df58d71

View File

@@ -15,6 +15,7 @@ using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
@@ -430,7 +431,7 @@ namespace MonoTests.System.Reflection
}
[Test]
public void SubClassWithOverrides()
public void SubClassWithOverrides ()
{
var p2 = new MyParameterInfo2 ();
Assert.IsFalse (p2.IsIn, "#1");
@@ -438,5 +439,70 @@ namespace MonoTests.System.Reflection
Assert.IsTrue (p2.IsIn, "#2");
Assert.AreEqual (p2.myList, p2.CustomAttributes, "#3");
}
[Test]
public void ParameterInfoToString ()
{
var method = typeof (TestNestedClass).GetTypeInfo ().GetMethod ("TestMethod");
var sb = new StringBuilder ();
foreach (var parameter in method.GetParameters ())
{
sb.Append (parameter + "\n");
}
string actual = sb.ToString ();
string expected = "Int32 a0\n" +
"System.String a1\n" +
"TestNestedClass a2\n" +
"System.Collections.Generic.List`1[System.Int32] a3\n" +
"System.Collections.Generic.List`1[System.Text.StringBuilder] a4\n" +
"System.Collections.Generic.List`1[MonoTests.System.Reflection.ParameterInfoTest+TestNestedClass] a5\n" +
"System.Text.StringBuilder a6\n" +
"System.Collections.Generic.Dictionary`2[System.Int32,System.String] a7\n" +
"Int32& a8\n" +
"Int32& a9\n" +
"TestNestedClass& a10\n" +
"System.Collections.Generic.List`1[System.Int32]& a11\n";
Assert.AreEqual (expected, actual, "#1");
}
public class TestNestedClass
{
public static void TestMethod (int a0, string a1,
TestNestedClass a2, List<int> a3,
List<StringBuilder> a4, List<TestNestedClass> a5,
StringBuilder a6, Dictionary<int, string> a7,
out int a8, ref int a9, out TestNestedClass a10, out List<int> a11)
{
a8 = 0;
a9 = 0;
a10 = null;
a11 = null;
}
}
[Test] // https://github.com/mono/mono/issues/8312
public void ParameterInfoToStringForQueryableSkipWhile ()
{
var sb = new StringBuilder ();
var methods = typeof (Queryable).GetTypeInfo ().GetMethods ().Where (m => m.Name == "SkipWhile");
foreach (var methodInfo in methods)
{
foreach (var parameter in methodInfo.GetParameters ())
{
sb.Append (parameter + "\n");
}
}
string actual = sb.ToString ();
string expected = "System.Linq.IQueryable`1[TSource] source\n" +
"System.Linq.Expressions.Expression`1[System.Func`2[TSource,System.Boolean]] predicate\n" +
"System.Linq.IQueryable`1[TSource] source\n" +
"System.Linq.Expressions.Expression`1[System.Func`3[TSource,System.Int32,System.Boolean]] predicate\n";
Assert.AreEqual (expected, actual, "#1");
}
}
}

View File

@@ -456,6 +456,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
}
[Test]
[Category("WASM")] //This test takes forever under WASM due to over allocating
public void OldGenKeysMakeNewGenObjectsReachable ()
{
if (GC.MaxGeneration == 0) /*Boehm doesn't handle ephemerons */

View File

@@ -195,6 +195,7 @@ namespace MonoTests.System.Runtime.CompilerServices
}
[Test]
[Category ("MultiThreaded")]
public void GetResultWaitOnCompletion ()
{
TaskAwaiter awaiter;
@@ -273,6 +274,7 @@ namespace MonoTests.System.Runtime.CompilerServices
}
[Test]
[Category ("MultiThreaded")]
public void CompletionOnSameCustomSynchronizationContext ()
{
progress = "";
@@ -313,6 +315,7 @@ namespace MonoTests.System.Runtime.CompilerServices
}
[Test]
[Category ("MultiThreaded")]
public void CompletionOnDifferentCustomSynchronizationContext ()
{
mre = new ManualResetEvent (false);
@@ -365,6 +368,7 @@ namespace MonoTests.System.Runtime.CompilerServices
}
[Test]
[Category ("MultiThreaded")]
public void NestedLeakingSynchronizationContext ()
{
var sc = SynchronizationContext.Current;

View File

@@ -42,8 +42,6 @@ namespace MonoTests.System.Runtime.CompilerServices {
{
var a = new TypeForwardedFromAttribute ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a");
Assert.AreEqual ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a", a.AssemblyFullName);
var nullArgumentDoesntThrowException = new TypeForwardedFromAttribute (null);
}
}
}

View File

@@ -66,7 +66,6 @@ namespace MonoTests.System.Runtime.ExceptionServices
}
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void Throw ()
{
Exception orig = null;
@@ -93,7 +92,6 @@ namespace MonoTests.System.Runtime.ExceptionServices
}
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void ThrowWithEmptyFrames ()
{
var edi = ExceptionDispatchInfo.Capture (new OperationCanceledException ());
@@ -108,7 +106,6 @@ namespace MonoTests.System.Runtime.ExceptionServices
}
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void LastThrowWins ()
{
Exception e;
@@ -140,7 +137,6 @@ namespace MonoTests.System.Runtime.ExceptionServices
}
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void ThrowMultipleCaptures ()
{
Exception e;
@@ -169,7 +165,6 @@ namespace MonoTests.System.Runtime.ExceptionServices
}
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void StackTraceUserCopy ()
{
try {

View File

@@ -963,7 +963,6 @@ namespace MonoTests.System.Runtime.InteropServices
}
[Test]
[Category ("NotWorkingRuntimeInterpreter")]
public void CheckPtrToStructureWithFixedArrayAndBaseClassFields()
{
const int arraySize = 6;

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