Imported Upstream version 6.0.0.172

Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-04-12 14:10:50 +00:00
parent 8016999e4d
commit 64ac736ec5
32155 changed files with 3981439 additions and 75368 deletions

View File

@@ -13,6 +13,8 @@ using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Collections.Concurrent;
using System.Collections;
#if !MOBILE
using MonoTests.Helpers;
#endif
@@ -191,6 +193,19 @@ public class GClass<T> {
}
}
public struct MySpan<T> {
internal class Pinnable<J> {
public J Data;
}
Pinnable<T> _pinnable;
public MySpan(T[] array) {
_pinnable = Unsafe.As<Pinnable<T>>(array);
}
public override string ToString() {
return "abc";
}
}
public struct GStruct<T> {
public T i;
@@ -246,6 +261,65 @@ class TestIfaces : ITest
}
}
public sealed class DebuggerTaskScheduler : TaskScheduler, IDisposable
{
private readonly BlockingCollection<Task> _tasks = new BlockingCollection<Task>();
private readonly List<Thread> _threads;
private readonly Thread mainThread = null;
public DebuggerTaskScheduler(int countThreads)
{
_threads = Enumerable.Range(0, countThreads).Select(i =>
{
Thread t = new Thread(() =>
{
foreach (var task in _tasks.GetConsumingEnumerable())
{
TryExecuteTask(task);
}
});
//the new task will be executed by a foreground thread ensuring that it will be executed ultil the end.
t.IsBackground = false;
t.Start();
return t;
}).ToList();
}
/// <inheritdoc />
protected override void QueueTask(Task task)
{
_tasks.Add(task);
}
/// <inheritdoc />
public override int MaximumConcurrencyLevel
{
get
{
return _threads.Count;
}
}
/// <inheritdoc />
public void Dispose()
{
// Indicate that no new tasks will be coming in
_tasks.CompleteAdding();
}
/// <inheritdoc />
protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
{
return false;
}
/// <inheritdoc />
protected override IEnumerable<Task> GetScheduledTasks()
{
return _tasks;
}
}
class TestIfaces<T> : ITest<T>
{
void ITest<T>.Foo () {
@@ -344,6 +418,10 @@ public class Tests : TestsBase, ITest2
unhandled_exception_endinvoke ();
return 0;
}
if (args.Length >0 && args [0] == "crash-vm") {
crash ();
return 0;
}
if (args.Length >0 && args [0] == "unhandled-exception-user") {
unhandled_exception_user ();
return 0;
@@ -365,9 +443,7 @@ public class Tests : TestsBase, ITest2
return 0;
}
if (args.Length > 0 && args [0] == "step-out-void-async") {
var wait = new ManualResetEvent (false);
step_out_void_async (wait);
wait.WaitOne ();//Don't exist until step_out_void_async is executed...
run_step_out_void_async();
return 0;
}
assembly_load ();
@@ -410,6 +486,8 @@ public class Tests : TestsBase, ITest2
new Tests ().invoke_abort ();
new Tests ().evaluate_method ();
Bug59649 ();
elapsed_time();
field_with_unsafe_cast_value();
inspect_enumerator_in_generic_struct();
if_property_stepping();
return 3;
@@ -609,6 +687,15 @@ public class Tests : TestsBase, ITest2
}
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void field_with_unsafe_cast_value() {
var arr = new char[3];
arr[0] = 'a';
arr[1] = 'b';
arr[2] = 'c';
MySpan<char> bytes = new MySpan<char>(arr);
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void ss_nested () {
ss_nested_1 (ss_nested_2 ());
@@ -629,10 +716,16 @@ public class Tests : TestsBase, ITest2
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void ss_nested_twice_with_two_args_wrapper () {
ss_nested_with_two_args(ss_nested_arg1 (), ss_nested_with_two_args(ss_nested_arg2 (), ss_nested_arg3 ()));
}
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void elapsed_time () {
Thread.Sleep(200);
Thread.Sleep(00);
Thread.Sleep(100);
Thread.Sleep(300);
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void inspect_enumerator_in_generic_struct() {
TestEnumeratorInsideGenericStruct<String, String> generic_struct = new TestEnumeratorInsideGenericStruct<String, String>(new KeyValuePair<string, string>("0", "f1"));
@@ -1411,6 +1504,11 @@ public class Tests : TestsBase, ITest2
unhandled_exception_endinvoke_2 ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void crash () {
unsafe { Console.WriteLine("{0}", *(int*) -1); }
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void unhandled_exception_user () {
System.Threading.Tasks.Task.Factory.StartNew (() => {
@@ -1854,6 +1952,15 @@ public class Tests : TestsBase, ITest2
{
UninitializedClass.Call();//Breakpoint here and step in
}
public static void run_step_out_void_async()
{
DebuggerTaskScheduler dts = new DebuggerTaskScheduler(2);
var wait = new ManualResetEvent (false);
step_out_void_async (wait);
wait.WaitOne ();//Don't exist until step_out_void_async is executed...
dts.Dispose();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
static async void step_out_void_async (ManualResetEvent wait)

View File

@@ -1 +1 @@
95d884b8ce2ffaec6308c17618646ceaf61a68df
b0c0de5c832e47168e591f21dfc9a8b6866a32d2

View File

@@ -0,0 +1 @@
{}