aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-08-05 23:15:30 +0100
committerJustin Clark-Casey (justincc)2013-08-05 23:15:30 +0100
commitf9dc5815c4788aefed7eab01fa79709d3921e22a (patch)
treebbcd85110217c07a5a65abd34762c365941297ff /OpenSim/Region/ClientStack/Linden/UDP
parentminor: move "threads abort" and "force gc" console commands into debug catego... (diff)
downloadopensim-SC_OLD-f9dc5815c4788aefed7eab01fa79709d3921e22a.zip
opensim-SC_OLD-f9dc5815c4788aefed7eab01fa79709d3921e22a.tar.gz
opensim-SC_OLD-f9dc5815c4788aefed7eab01fa79709d3921e22a.tar.bz2
opensim-SC_OLD-f9dc5815c4788aefed7eab01fa79709d3921e22a.tar.xz
For LLImageManagerTests, make tests execute under synchronous fire and forget conditions.
I generally prefer this approach for regression tests because of the complexity of accounting for different threading conditions.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs20
1 files changed, 12 insertions, 8 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
index 6aa8bcc..575e54c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
@@ -54,6 +54,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
54 [TestFixtureSetUp] 54 [TestFixtureSetUp]
55 public void FixtureInit() 55 public void FixtureInit()
56 { 56 {
57 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
58 Util.FireAndForgetMethod = FireAndForgetMethod.None;
59
57 using ( 60 using (
58 Stream resource 61 Stream resource
59 = GetType().Assembly.GetManifestResourceStream( 62 = GetType().Assembly.GetManifestResourceStream(
@@ -73,6 +76,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
73 } 76 }
74 } 77 }
75 78
79 [TestFixtureTearDown]
80 public void TearDown()
81 {
82 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
83 // threads. Possibly, later tests should be rewritten not to worry about such things.
84 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
85 }
86
76 [SetUp] 87 [SetUp]
77 public override void SetUp() 88 public override void SetUp()
78 { 89 {
@@ -106,14 +117,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
106 args.requestSequence = 1; 117 args.requestSequence = 1;
107 118
108 llim.EnqueueReq(args); 119 llim.EnqueueReq(args);
109 120 llim.ProcessImageQueue(20);
110 // We now have to wait and hit the processing wheel, because the decoding is async
111 int i = 10;
112 while (i-- > 0)
113 {
114 llim.ProcessImageQueue(20);
115 Thread.Sleep(100);
116 }
117 121
118 Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1)); 122 Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1));
119 } 123 }