Welcome to mirror list, hosted at ThFree Co, Russian Federation.

main.cs « managed « android « sdks - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1ac277d3699febc83bf348750292a94d867f93e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
// using System.Collections.Generic;
using System.IO;
// using System.Linq;
// using System.Reflection;
using System.Text;
using System.Threading;
using System.Runtime.InteropServices;
using NUnitLite.Runner;

public class Driver
{
	static TextUI Runner;

	public static void RunTests ()
	{
		Console.SetOut (TextWriter.Synchronized (new AndroidIntrumentationWriter (Console.Out)));
		Console.SetError (TextWriter.Synchronized (new AndroidIntrumentationWriter (Console.Error)));

		string assembly = File.ReadAllText ($"{AppDomain.CurrentDomain.BaseDirectory}/testassembly.txt");

		Console.WriteLine ($"Testing assembly \"{assembly}\"");
		Console.WriteLine ($"");

		string exclude = "NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,MobileNotWorking,SatelliteAssembliesNotWorking,AndroidNotWorking";
		if (IntPtr.Size == 4)
			exclude += ",LargeFileSupport";

		string[] args = new string[] {
			$"-labels",
			$"-exclude={exclude}",
			$"{AppDomain.CurrentDomain.BaseDirectory}/{assembly}",
		};

		Runner = new TextUI ();
		Runner.Execute (args);
	}

	public static void Main ()
	{
		Environment.Exit (1);
	}

	class AndroidIntrumentationWriter : TextWriter
	{
		readonly StringBuilder Line = new StringBuilder ();

		readonly TextWriter Inner;

		public override Encoding Encoding => Inner.Encoding;

		public AndroidIntrumentationWriter (TextWriter inner)
		{
			Inner = inner;
		}

		public override void Write(char value)
		{
			if (value == '\n')
				WriteLine ();
			else
				Line.Append (value);
		}

		public override void WriteLine ()
		{
			var l = Line.ToString ();
			Line.Clear ();

			unsafe
			{
				fixed (byte *chars = Encoding.UTF8.GetBytes (l + '\0'))
				{
					WriteLineToInstrumentation (chars);
				}
			}

			Inner.WriteLine (l);
		}

		[DllImport ("__Internal", EntryPoint = "AndroidIntrumentationWriter_WriteLineToInstrumentation", CharSet = CharSet.Unicode)]
		static unsafe extern void WriteLineToInstrumentation (byte *chars);
	}
}