You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
@@ -1 +1 @@
|
||||
706bfcdac0c6fa51f6b9a8017e213e59719b12e1
|
||||
6e63058fed7d5ff90caac0148dcdd7a0b2c8652e
|
@@ -1 +1 @@
|
||||
b747e0dd0164e0fc6e98da731bc02b49911c94ef
|
||||
815bbb85c45d0c4fe36d4a49819a0384e4816a60
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
@@ -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]
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user