From 6af0751cc5d276370c7c4ce2a0ee064b1106a7bc Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 9 Apr 2009 20:06:27 +0000 Subject: [PATCH] * Tagged long running tests with LongRunningAttribute. * Now, the 144 unit tests takes roughly as long time to run (16s on my laptop) that the 10 long running takes. The database tests takes forever. * Feel free to run the unit tests as you code, and the rest before commit. --- .../ClientStack/LindenUDP/Tests/BasicCircuitTests.cs | 3 ++- .../Inventory/Archiver/Tests/InventoryArchiverTests.cs | 3 ++- .../CoreModules/World/Archiver/Tests/ArchiverTests.cs | 6 ++++-- .../Framework/Scenes/Tests/EntityManagerTests.cs | 7 ++++--- .../Framework/Scenes/Tests/SceneObjectBasicTests.cs | 3 ++- .../Framework/Scenes/Tests/StandaloneTeleportTests.cs | 5 +++-- .../Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 10 +++++----- OpenSim/Tests/Common/LongRunningAttribute.cs | 2 +- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs index 1f564b7526..80fbba2767 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs @@ -33,6 +33,7 @@ using NUnit.Framework.SyntaxHelpers; using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; +using OpenSim.Tests.Common; namespace OpenSim.Region.ClientStack.LindenUDP.Tests { @@ -146,7 +147,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests /// /// Test adding a client to the stack /// - [Test] + [Test, LongRunning] public void TestAddClient() { uint myCircuitCode = 123456; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index bd8d325b79..c140ec09d3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -40,11 +40,12 @@ using OpenSim.Framework.Communications.Cache; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.World.Archiver; using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; using OpenSim.Tests.Common.Setup; namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests { - [TestFixture] + [TestFixture, LongRunning] public class InventoryArchiverTests { private void SaveCompleted( diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 6a64ff19c9..04c3289186 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -38,11 +38,12 @@ using OpenSim.Framework.Serialization; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.World.Terrain; using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; using OpenSim.Tests.Common.Setup; namespace OpenSim.Region.CoreModules.World.Archiver.Tests { - [TestFixture] + [TestFixture, LongRunning] public class ArchiverTests { private void SaveCompleted(string errorMessage) @@ -230,7 +231,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests /// /// Test merging a V0.2 OpenSim Region Archive into an existing scene /// - ///[Test] + + [Test] public void TestMergeOarV0p2() { //XmlConfigurator.Configure(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index 480abc663e..d1ef686e4c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -37,11 +37,12 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; using OpenSim.Tests.Common.Setup; namespace OpenSim.Region.Framework.Scenes.Tests { - [TestFixture] + [TestFixture, LongRunning] public class EntityManagerTests { static public Random random; @@ -51,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T010_AddObjects() { - Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); + // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); random = new Random(); SceneObjectGroup found; @@ -86,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T011_ThreadAddRemoveTest() { - Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); + // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); // This test adds and removes with mutiple threads, attempting to break the // uuid and localid dictionary coherence. diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 59f1ba48bd..5c3d653a99 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -35,6 +35,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Region.Communications.Local; using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Setup; @@ -49,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests /// /// Test adding an object to a scene. /// - [Test] + [Test, LongRunning] public void TestAddSceneObject() { Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index 46bfb302a9..80d2ba9b30 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs @@ -35,6 +35,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Communications.REST; +using OpenSim.Tests.Common; using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Setup; @@ -50,10 +51,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. /// /// Does not yet do what is says on the tin. - [Test] + [Test, LongRunning] public void TestSimpleNotNeighboursTeleport() { - Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); + // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); log4net.Config.XmlConfigurator.Configure(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index cde772baf4..cf98cf1174 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -41,12 +41,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests /// /// Tests for LSL_Api /// - [TestFixture] + [TestFixture, LongRunning] public class LSL_ApiTest { private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; - private LSL_Api lslApi; + private LSL_Api m_lslApi; [SetUp] public void SetUp() @@ -62,8 +62,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests XEngine.XEngine engine = new XEngine.XEngine(); engine.Initialise(scene, initConfigSource); - lslApi = new LSL_Api(); - lslApi.Initialize(engine, part, part.LocalId, part.UUID); + m_lslApi = new LSL_Api(); + m_lslApi.Initialize(engine, part, part.LocalId, part.UUID); } @@ -92,7 +92,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Quaternion rotation1 = Quaternion.CreateFromAxisAngle(axis, 0); Quaternion rotation2 = Quaternion.CreateFromAxisAngle(axis, ToRadians(originalAngle)); - double deducedAngle = FromLslFloat(lslApi.llAngleBetween(ToLslQuaternion(rotation2), ToLslQuaternion(rotation1))); + double deducedAngle = FromLslFloat(m_lslApi.llAngleBetween(ToLslQuaternion(rotation2), ToLslQuaternion(rotation1))); Assert.Greater(deducedAngle, ToRadians(originalAngle) - ANGLE_ACCURACY_IN_RADIANS); Assert.Less(deducedAngle, ToRadians(originalAngle) + ANGLE_ACCURACY_IN_RADIANS); diff --git a/OpenSim/Tests/Common/LongRunningAttribute.cs b/OpenSim/Tests/Common/LongRunningAttribute.cs index 722217d9f1..b1dabfccc5 100644 --- a/OpenSim/Tests/Common/LongRunningAttribute.cs +++ b/OpenSim/Tests/Common/LongRunningAttribute.cs @@ -10,7 +10,7 @@ namespace OpenSim.Tests.Common Inherited = true)] public class LongRunningAttribute : CategoryAttribute { - protected LongRunningAttribute() : this("Long Running Test") + public LongRunningAttribute() : this("Long Running Test") { }