* Reinstated Scene Crossing tests, now with timeouts to check for race conditions
parent
80ea563bcc
commit
08f83f275d
|
@ -30,6 +30,8 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
using Timer=System.Timers.Timer;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.SyntaxHelpers;
|
||||
|
@ -195,7 +197,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
Assert.That(presence.AbsolutePosition, Is.EqualTo(pos), "Position is not the same one entered");
|
||||
}
|
||||
|
||||
//[Test]
|
||||
[Test]
|
||||
public void T021_TestCrossToNewRegion()
|
||||
{
|
||||
Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
|
||||
|
@ -225,15 +227,35 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
|
||||
// Mimicking communication between client and server, by waiting OK from client
|
||||
// sent by TestClient.CrossRegion call. Originally, this is network comm.
|
||||
wh.WaitOne();
|
||||
if (!wh.WaitOne(5000,false))
|
||||
{
|
||||
presence.Update();
|
||||
if (!wh.WaitOne(8000,false))
|
||||
throw new ArgumentException("1 - Timeout waiting for signal/variable.");
|
||||
}
|
||||
|
||||
// This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
|
||||
// would normally be fired after receiving the reply packet from comm. done on the last line.
|
||||
testclient.CompleteMovement();
|
||||
|
||||
// Crossings are asynchronous
|
||||
while (presence.IsInTransit) { };
|
||||
int timer = 10;
|
||||
|
||||
// Make sure cross hasn't already finished
|
||||
if (!presence.IsInTransit && !presence.IsChildAgent)
|
||||
{
|
||||
// If not and not in transit yet, give it some more time
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
|
||||
// Enough time, should at least be in transit by now.
|
||||
while (presence.IsInTransit && timer > 0)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
timer-=1;
|
||||
}
|
||||
|
||||
Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1.");
|
||||
Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
|
||||
Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
|
||||
|
||||
|
@ -241,11 +263,28 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
presence2.AbsolutePosition = new Vector3(-10, 3, 100);
|
||||
presence2.Update();
|
||||
|
||||
wh.WaitOne();
|
||||
if (!wh.WaitOne(5000,false))
|
||||
{
|
||||
presence2.Update();
|
||||
if (!wh.WaitOne(8000,false))
|
||||
throw new ArgumentException("2 - Timeout waiting for signal/variable.");
|
||||
}
|
||||
testclient.CompleteMovement();
|
||||
|
||||
while (presence2.IsInTransit) { };
|
||||
if (!presence2.IsInTransit && !presence2.IsChildAgent)
|
||||
{
|
||||
// If not and not in transit yet, give it some more time
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
|
||||
// Enough time, should at least be in transit by now.
|
||||
while (presence2.IsInTransit && timer > 0)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
timer-=1;
|
||||
}
|
||||
|
||||
Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2.");
|
||||
Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
|
||||
Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
|
||||
}
|
||||
|
@ -277,7 +316,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
Assert.That(presence.HasAttachments(), Is.False);
|
||||
}
|
||||
|
||||
//[Test]
|
||||
[Test]
|
||||
public void T032_CrossAttachments()
|
||||
{
|
||||
Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
|
||||
|
|
Loading…
Reference in New Issue