You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -58,7 +58,6 @@ using System.Security.Permissions;
|
||||
#if !MONO_POSIX_NETSTANDARD_BUILD
|
||||
// We are using ../Open.snk for MONO_POSIX_NETSTANDARD_BUILD
|
||||
[assembly: AssemblyDelaySign (true)]
|
||||
[assembly: AssemblyKeyFile ("../mono.pub")]
|
||||
#endif
|
||||
/*
|
||||
* TODO:
|
||||
|
||||
@@ -6,6 +6,7 @@ LIBRARY = Mono.Posix.dll
|
||||
# Don't warn about [Obsolete] members, as there are now *lots* of [Obsolete]
|
||||
# members, generating volumes of output.
|
||||
LIB_REFS = System
|
||||
KEYFILE = ../mono.pub
|
||||
LIB_MCS_FLAGS = /unsafe /nowarn:0618,612
|
||||
TEST_MCS_FLAGS = /unsafe /nowarn:0219,0618
|
||||
TEST_LIB_REFS = Mono.Posix System
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Mono.Remoting.Channels.Unix
|
||||
_pool = pool;
|
||||
_client = client;
|
||||
_stream = new BufferedStream (client.GetStream());
|
||||
_controlTime = DateTime.Now;
|
||||
_controlTime = DateTime.UtcNow;
|
||||
_buffer = new byte[UnixMessageIO.DefaultStreamBufferSize];
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace Mono.Remoting.Channels.Unix
|
||||
{
|
||||
lock (_pool)
|
||||
{
|
||||
entry.ControlTime = DateTime.Now; // Initialize timeout
|
||||
entry.ControlTime = DateTime.UtcNow; // Initialize timeout
|
||||
_pool.Add (entry);
|
||||
Monitor.Pulse (_pool);
|
||||
}
|
||||
@@ -295,7 +295,7 @@ namespace Mono.Remoting.Channels.Unix
|
||||
for (int n=0; n < _pool.Count; n++)
|
||||
{
|
||||
UnixConnection entry = (UnixConnection)_pool[n];
|
||||
if ( (DateTime.Now - entry.ControlTime).TotalSeconds > UnixConnectionPool.KeepAliveSeconds)
|
||||
if ( (DateTime.UtcNow - entry.ControlTime).TotalSeconds > UnixConnectionPool.KeepAliveSeconds)
|
||||
{
|
||||
CancelConnection (entry);
|
||||
_pool.RemoveAt(n);
|
||||
|
||||
@@ -309,6 +309,9 @@ namespace Mono.Unix {
|
||||
|
||||
public static IntPtr StringToHeap (string s, Encoding encoding)
|
||||
{
|
||||
if (s == null)
|
||||
return IntPtr.Zero;
|
||||
|
||||
return StringToHeap (s, 0, s.Length, encoding);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,32 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Mono.Unix.Android
|
||||
{
|
||||
// Another version of this class is used by the Xamarin.Android test suite
|
||||
// It is here to keep the test code #ifdef free as much as possible
|
||||
public class TestHelper
|
||||
{
|
||||
static bool areRealTimeSignalsSafe;
|
||||
|
||||
static TestHelper ()
|
||||
{
|
||||
#if MONODROID
|
||||
var method = typeof (Mono.Unix.Native.NativeConvert).Assembly.GetType ("Mono.Unix.Android.AndroidUtils").GetMethod ("AreRealTimeSignalsSafe", BindingFlags.Public | BindingFlags.Static);
|
||||
areRealTimeSignalsSafe = (bool)method.Invoke (null, null);
|
||||
#else
|
||||
areRealTimeSignalsSafe = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static bool CanUseRealTimeSignals ()
|
||||
{
|
||||
if (!areRealTimeSignalsSafe) {
|
||||
Assert.Ignore ("Real-time signals aren't supported on this Android architecture");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,13 @@ namespace MonoTests.Mono.Unix {
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void BXC10074 ()
|
||||
{
|
||||
var result = UnixMarshal.StringToHeap (null, Encoding.ASCII);
|
||||
Assert.AreEqual (IntPtr.Zero, result, "This used to crash due to a NullReferenceException");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStringToHeap ()
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Mono.Unix;
|
||||
@@ -25,12 +26,12 @@ namespace MonoTests.Mono.Unix {
|
||||
static Thread CreateWaitSignalThread (UnixSignal signal, int timeout)
|
||||
{
|
||||
Thread t1 = new Thread(delegate() {
|
||||
DateTime start = DateTime.Now;
|
||||
var sw = Stopwatch.StartNew ();
|
||||
bool r = signal.WaitOne (timeout, false);
|
||||
DateTime end = DateTime.Now;
|
||||
sw.Stop ();
|
||||
Assert.AreEqual (signal.Count, 1);
|
||||
Assert.AreEqual (r, true);
|
||||
if ((end - start) > new TimeSpan (0, 0, timeout/1000))
|
||||
if (sw.Elapsed > new TimeSpan (0, 0, timeout/1000))
|
||||
throw new InvalidOperationException ("Signal slept too long");
|
||||
});
|
||||
return t1;
|
||||
@@ -248,12 +249,12 @@ namespace MonoTests.Mono.Unix {
|
||||
{
|
||||
Thread t1 = new Thread (delegate () {
|
||||
using (UnixSignal a = new UnixSignal (Signum.SIGINT)) {
|
||||
DateTime start = DateTime.Now;
|
||||
var sw = Stopwatch.StartNew ();
|
||||
bool r = a.WaitOne (5000, false);
|
||||
DateTime end = DateTime.Now;
|
||||
sw.Stop ();
|
||||
Assert.AreEqual (a.Count, 1);
|
||||
Assert.AreEqual (r, true);
|
||||
if ((end - start) > new TimeSpan (0, 0, 5))
|
||||
if (sw.Elapsed > new TimeSpan (0, 0, 5))
|
||||
throw new InvalidOperationException ("Signal slept too long");
|
||||
}
|
||||
});
|
||||
@@ -272,12 +273,12 @@ namespace MonoTests.Mono.Unix {
|
||||
{
|
||||
Thread t1 = new Thread (delegate () {
|
||||
using (UnixSignal a = new UnixSignal (Signum.SIGINT)) {
|
||||
DateTime start = DateTime.Now;
|
||||
var sw = Stopwatch.StartNew ();
|
||||
int idx = UnixSignal.WaitAny (new UnixSignal[]{a}, 5000);
|
||||
DateTime end = DateTime.Now;
|
||||
sw.Stop ();
|
||||
Assert.AreEqual (idx, 0);
|
||||
Assert.AreEqual (a.Count, 1);
|
||||
if ((end - start) > new TimeSpan (0, 0, 5))
|
||||
if (sw.Elapsed > new TimeSpan (0, 0, 5))
|
||||
throw new InvalidOperationException ("Signal slept too long");
|
||||
}
|
||||
});
|
||||
@@ -297,13 +298,13 @@ namespace MonoTests.Mono.Unix {
|
||||
Thread t1 = new Thread (delegate () {
|
||||
using (UnixSignal a = new UnixSignal (Signum.SIGINT))
|
||||
using (UnixSignal b = new UnixSignal (Signum.SIGTERM)) {
|
||||
DateTime start = DateTime.Now;
|
||||
var sw = Stopwatch.StartNew ();
|
||||
int idx = UnixSignal.WaitAny (new UnixSignal[]{a, b}, 5000);
|
||||
DateTime end = DateTime.Now;
|
||||
sw.Stop ();
|
||||
Assert.AreEqual (idx, 1);
|
||||
Assert.AreEqual (a.Count, 0);
|
||||
Assert.AreEqual (b.Count, 1);
|
||||
if ((end - start) > new TimeSpan (0, 0, 5))
|
||||
if (sw.Elapsed > new TimeSpan (0, 0, 5))
|
||||
throw new InvalidOperationException ("Signal slept too long");
|
||||
}
|
||||
});
|
||||
@@ -321,12 +322,12 @@ namespace MonoTests.Mono.Unix {
|
||||
public void TestNoEmit ()
|
||||
{
|
||||
using (UnixSignal u = new UnixSignal (Signum.SIGINT)) {
|
||||
DateTime start = DateTime.Now;
|
||||
var sw = Stopwatch.StartNew ();
|
||||
bool r = u.WaitOne (5100, false);
|
||||
Assert.AreEqual (r, false);
|
||||
DateTime end = DateTime.Now;
|
||||
if ((end - start) < new TimeSpan (0, 0, 5))
|
||||
throw new InvalidOperationException ("Signal didn't block for 5s; blocked for " + (end-start).ToString());
|
||||
sw.Stop ();
|
||||
if (sw.Elapsed < new TimeSpan (0, 0, 5))
|
||||
throw new InvalidOperationException ("Signal didn't block for 5s; blocked for " + sw.Elapsed.TotalSeconds.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user