aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-08-29 23:04:00 +0100
committerJustin Clark-Casey (justincc)2012-08-29 23:04:00 +0100
commitec726413ddcd8632efb2603b968554647419708d (patch)
tree5b7a448f2921047e0f97695b80e017c4ccb3ec90
parentimplementing rule tracking (diff)
downloadopensim-SC_OLD-ec726413ddcd8632efb2603b968554647419708d.zip
opensim-SC_OLD-ec726413ddcd8632efb2603b968554647419708d.tar.gz
opensim-SC_OLD-ec726413ddcd8632efb2603b968554647419708d.tar.bz2
opensim-SC_OLD-ec726413ddcd8632efb2603b968554647419708d.tar.xz
Add VectorRenderModuleStressTests that contains a long running test that generates thousands of vector textures concurrently.
Intended for use if there are future issues with mono crashes whilst generate dynamic textures. This test is triggered via a new test-stress nant target. Not run by default.
-rw-r--r--.nant/local.include13
-rw-r--r--OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs132
-rw-r--r--prebuild.xml40
3 files changed, 184 insertions, 1 deletions
diff --git a/.nant/local.include b/.nant/local.include
index 6d3e972..181c875 100644
--- a/.nant/local.include
+++ b/.nant/local.include
@@ -135,6 +135,17 @@
135 <delete dir="%temp%"/> 135 <delete dir="%temp%"/>
136</target> 136</target>
137 137
138<target name="test-stress" depends="build, find-nunit">
139 <setenv name="MONO_THREADS_PER_CPU" value="100" />
140
141 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.stress">
142 <arg value="./bin/OpenSim.Tests.Stress.dll" />
143 </exec>
144
145 <fail message="Failures reported in stress tests." unless="${int::parse(testresult.opensim.tests.stress)==0}" />
146 <delete dir="%temp%"/>
147</target>
148
138<target name="torture" depends="build, find-nunit"> 149<target name="torture" depends="build, find-nunit">
139 <setenv name="MONO_THREADS_PER_CPU" value="100" /> 150 <setenv name="MONO_THREADS_PER_CPU" value="100" />
140 151
@@ -142,7 +153,7 @@
142 <arg value="./bin/OpenSim.Tests.Torture.dll" /> 153 <arg value="./bin/OpenSim.Tests.Torture.dll" />
143 </exec> 154 </exec>
144 155
145 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.torture)==0}" /> 156 <fail message="Failures reported in torture tests." unless="${int::parse(testresult.opensim.tests.torture)==0}" />
146 <delete dir="%temp%"/> 157 <delete dir="%temp%"/>
147</target> 158</target>
148 159
diff --git a/OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs b/OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs
new file mode 100644
index 0000000..1f220c0
--- /dev/null
+++ b/OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs
@@ -0,0 +1,132 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Linq;
32using System.Reflection;
33using System.Threading;
34using log4net.Config;
35using NUnit.Framework;
36using OpenMetaverse;
37using OpenMetaverse.Assets;
38using OpenSim.Framework;
39using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
40using OpenSim.Region.CoreModules.Scripting.VectorRender;
41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Serialization;
43using OpenSim.Tests.Common;
44using OpenSim.Tests.Common.Mock;
45
46namespace OpenSim.Tests.Stress
47{
48 [TestFixture]
49 public class VectorRenderModuleStressTests : OpenSimTestCase
50 {
51 public Scene Scene { get; private set; }
52 public DynamicTextureModule Dtm { get; private set; }
53 public VectorRenderModule Vrm { get; private set; }
54
55 private void SetupScene(bool reuseTextures)
56 {
57 Scene = new SceneHelpers().SetupScene();
58
59 Dtm = new DynamicTextureModule();
60 Dtm.ReuseTextures = reuseTextures;
61
62 Vrm = new VectorRenderModule();
63
64 SceneHelpers.SetupSceneModules(Scene, Dtm, Vrm);
65 }
66
67 [Test]
68 public void TestConcurrentRepeatedDraw()
69 {
70 int threads = 4;
71 TestHelpers.InMethod();
72
73 SetupScene(false);
74
75 List<Drawer> drawers = new List<Drawer>();
76
77 for (int i = 0; i < threads; i++)
78 {
79 Drawer d = new Drawer(this, i);
80 drawers.Add(d);
81 Console.WriteLine("Starting drawer {0}", i);
82 Util.FireAndForget(o => d.Draw());
83 }
84
85 Thread.Sleep(10 * 60 * 1000);
86
87 drawers.ForEach(d => d.Ready = false);
88 drawers.ForEach(d => Console.WriteLine("Drawer {0} drew {1} textures", d.Number, d.Pass + 1));
89 }
90
91 class Drawer
92 {
93 public int Number { get; private set; }
94 public int Pass { get; private set; }
95 public bool Ready { get; set; }
96
97 private VectorRenderModuleStressTests m_tests;
98
99 public Drawer(VectorRenderModuleStressTests tests, int number)
100 {
101 m_tests = tests;
102 Number = number;
103 Ready = true;
104 }
105
106 public void Draw()
107 {
108 SceneObjectGroup so = SceneHelpers.AddSceneObject(m_tests.Scene);
109
110 while (Ready)
111 {
112 UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
113
114 // Ensure unique text
115 string text = string.Format("{0:D2}{1}", Number, Pass);
116
117 m_tests.Dtm.AddDynamicTextureData(
118 m_tests.Scene.RegionInfo.RegionID,
119 so.UUID,
120 m_tests.Vrm.GetContentType(),
121 string.Format("PenColour BLACK; MoveTo 40,220; FontSize 32; Text {0};", text),
122 "",
123 0);
124
125 Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
126
127 Pass++;
128 }
129 }
130 }
131 }
132} \ No newline at end of file
diff --git a/prebuild.xml b/prebuild.xml
index 1765899..d9c1607 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3250,6 +3250,46 @@
3250 </Files> 3250 </Files>
3251 </Project> 3251 </Project>
3252 3252
3253 <Project frameworkVersion="v3_5" name="OpenSim.Tests.Stress" path="OpenSim/Tests/Stress" type="Library">
3254 <Configuration name="Debug">
3255 <Options>
3256 <OutputPath>../../../bin/</OutputPath>
3257 </Options>
3258 </Configuration>
3259 <Configuration name="Release">
3260 <Options>
3261 <OutputPath>../../../bin/</OutputPath>
3262 </Options>
3263 </Configuration>
3264
3265 <ReferencePath>../../../bin/</ReferencePath>
3266 <Reference name="System"/>
3267 <Reference name="System.Xml"/>
3268 <Reference name="System.Data"/>
3269 <Reference name="log4net" path="../../../bin/"/>
3270 <Reference name="Nini" path="../../../bin/"/>
3271 <Reference name="nunit.framework" path="../../../bin/"/>
3272 <Reference name="OpenMetaverse" path="../../../bin/"/>
3273 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
3274 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
3275 <Reference name="XMLRPC" path="../../../bin/"/>
3276 <Reference name="OpenSim.Framework"/>
3277 <Reference name="OpenSim.Framework.Communications"/>
3278 <Reference name="OpenSim.Framework.Console"/>
3279 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
3280 <Reference name="OpenSim.Region.CoreModules"/>
3281 <Reference name="OpenSim.Region.Framework"/>
3282 <Reference name="OpenSim.Region.OptionalModules"/>
3283 <Reference name="OpenSim.Region.ScriptEngine.Shared"/>
3284 <Reference name="OpenSim.Region.ScriptEngine.XEngine"/>
3285 <Reference name="OpenSim.Services.Interfaces"/>
3286 <Reference name="OpenSim.Services.AvatarService"/>
3287 <Reference name="OpenSim.Tests.Common"/>
3288 <Files>
3289 <Match pattern="*.cs" recurse="false"/>
3290 </Files>
3291 </Project>
3292
3253 <Project frameworkVersion="v3_5" name="OpenSim.Tests.Torture" path="OpenSim/Tests/Torture" type="Library"> 3293 <Project frameworkVersion="v3_5" name="OpenSim.Tests.Torture" path="OpenSim/Tests/Torture" type="Library">
3254 <Configuration name="Debug"> 3294 <Configuration name="Debug">
3255 <Options> 3295 <Options>