From b678ea18b238ef1ab816445f48bd1c838f9978fc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 30 Apr 2012 18:44:22 +0100 Subject: Create TestHelpers.EnableLogging() and DisableLogging() to turn logging on and off within tests. This makes *.Tests.dll.config files no longer needed, hence deleted. --- OpenSim/Tests/Common/TestHelpers.cs | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'OpenSim/Tests/Common/TestHelpers.cs') diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index ced06de..5030d4b 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs @@ -27,6 +27,8 @@ using System; using System.Diagnostics; +using System.IO; +using System.Text; using NUnit.Framework; using OpenMetaverse; @@ -34,6 +36,37 @@ namespace OpenSim.Tests.Common { public class TestHelpers { + private static Stream EnableLoggingConfigStream + = new MemoryStream( + Encoding.UTF8.GetBytes( +@" + + + + + + + + + + + + + + + +")); + + private static Stream DisableLoggingConfigStream + = new MemoryStream( + Encoding.UTF8.GetBytes( + // ""))); + //""))); + //""))); + //""))); + //""))); + "")); + public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) { try @@ -58,6 +91,19 @@ namespace OpenSim.Tests.Common Console.WriteLine("===> In Test Method : {0} <===", stackTrace.GetFrame(1).GetMethod().Name); } + public static void EnableLogging() + { + log4net.Config.XmlConfigurator.Configure(EnableLoggingConfigStream); + } + + /// + /// Disable logging whilst running the tests. + /// + public static void DisableLogging() + { + log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream); + } + /// /// Parse tail section into full UUID. /// -- cgit v1.1 From 9d2e1c67a8969e4769006c7347505b58a7827b3f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 1 May 2012 23:14:12 +0100 Subject: Add regression test for teleporting between neighbouring regions on the same simulator This adds a non-advertised wait_for_callback option in [EntityTransfer]. Default is always true. Teleport tests disable the wait for callback from the destination region in order to run within a single thread. --- OpenSim/Tests/Common/TestHelpers.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Tests/Common/TestHelpers.cs') diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index 5030d4b..6744fca 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs @@ -46,7 +46,8 @@ namespace OpenSim.Tests.Common - + + @@ -62,9 +63,9 @@ namespace OpenSim.Tests.Common Encoding.UTF8.GetBytes( // ""))); //""))); - //""))); - //""))); - //""))); +// "")); +// ""))); +// "")); "")); public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) -- cgit v1.1 From bdcf2d1348c6770a42a91ca5b3c7d74d2307b0c1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 17 May 2012 01:27:59 +0100 Subject: Add regression TestSameSimulatorSeparatedRegionsQueryAccessFails() --- OpenSim/Tests/Common/TestHelpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Tests/Common/TestHelpers.cs') diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index 6744fca..a241a3c 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs @@ -61,7 +61,7 @@ namespace OpenSim.Tests.Common private static Stream DisableLoggingConfigStream = new MemoryStream( Encoding.UTF8.GetBytes( - // ""))); +// "")); //""))); // "")); // ""))); -- cgit v1.1 From f0c9cb8dc0eeccf2c686ff8ceacc7e1acceb543d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 17 May 2012 01:34:04 +0100 Subject: Comment out TestSameSimulatorSeparatedRegionsQueryAccessFails() regression test logging accidentally left in --- OpenSim/Tests/Common/TestHelpers.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Tests/Common/TestHelpers.cs') diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index a241a3c..d38d692 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs @@ -100,6 +100,12 @@ namespace OpenSim.Tests.Common /// /// Disable logging whilst running the tests. /// + /// + /// Remember, if a regression test throws an exception before completing this will not be invoked if it's at + /// the end of the test. + /// TODO: Always invoke this after every test - probably need to make all test cases inherit from a common + /// TestCase class where this can be done. + /// public static void DisableLogging() { log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream); -- cgit v1.1 From 5bec5bcf714a94129070cf1b6219984496cbd6c2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 27 Jun 2012 00:00:49 +0100 Subject: Automatically disable log4net before each regression test so that logging is confined to a single test if it's turned on. This involves making test classes inherit from a common OpenSimTestCase. This will be applied to more classes as required. --- OpenSim/Tests/Common/TestHelpers.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Tests/Common/TestHelpers.cs') diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index d38d692..30121fe 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs @@ -58,7 +58,7 @@ namespace OpenSim.Tests.Common ")); - private static Stream DisableLoggingConfigStream + private static MemoryStream DisableLoggingConfigStream = new MemoryStream( Encoding.UTF8.GetBytes( // "")); @@ -109,6 +109,7 @@ namespace OpenSim.Tests.Common public static void DisableLogging() { log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream); + DisableLoggingConfigStream.Position = 0; } /// -- cgit v1.1