diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Performance/NPCPerformanceTests.cs (renamed from OpenSim/Tests/Torture/NPCTortureTests.cs) | 6 | ||||
-rw-r--r-- | OpenSim/Tests/Performance/ObjectPerformanceTests.cs (renamed from OpenSim/Tests/Torture/ObjectTortureTests.cs) | 6 | ||||
-rw-r--r-- | OpenSim/Tests/Performance/ScriptPerformanceTests.cs (renamed from OpenSim/Tests/Torture/ScriptTortureTests.cs) | 6 | ||||
-rw-r--r-- | OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs | 132 |
4 files changed, 141 insertions, 9 deletions
diff --git a/OpenSim/Tests/Torture/NPCTortureTests.cs b/OpenSim/Tests/Performance/NPCPerformanceTests.cs index 731df68..627765b 100644 --- a/OpenSim/Tests/Torture/NPCTortureTests.cs +++ b/OpenSim/Tests/Performance/NPCPerformanceTests.cs | |||
@@ -47,10 +47,10 @@ using OpenSim.Services.AvatarService; | |||
47 | using OpenSim.Tests.Common; | 47 | using OpenSim.Tests.Common; |
48 | using OpenSim.Tests.Common.Mock; | 48 | using OpenSim.Tests.Common.Mock; |
49 | 49 | ||
50 | namespace OpenSim.Tests.Torture | 50 | namespace OpenSim.Tests.Performance |
51 | { | 51 | { |
52 | /// <summary> | 52 | /// <summary> |
53 | /// NPC torture tests | 53 | /// NPC performance tests |
54 | /// </summary> | 54 | /// </summary> |
55 | /// <remarks> | 55 | /// <remarks> |
56 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, | 56 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, |
@@ -58,7 +58,7 @@ namespace OpenSim.Tests.Torture | |||
58 | /// earlier tests. | 58 | /// earlier tests. |
59 | /// </remarks> | 59 | /// </remarks> |
60 | [TestFixture] | 60 | [TestFixture] |
61 | public class NPCTortureTests | 61 | public class NPCPerformanceTests |
62 | { | 62 | { |
63 | private TestScene scene; | 63 | private TestScene scene; |
64 | private AvatarFactoryModule afm; | 64 | private AvatarFactoryModule afm; |
diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Performance/ObjectPerformanceTests.cs index 195d47b..2264d86 100644 --- a/OpenSim/Tests/Torture/ObjectTortureTests.cs +++ b/OpenSim/Tests/Performance/ObjectPerformanceTests.cs | |||
@@ -36,10 +36,10 @@ using OpenSim.Region.Framework.Scenes; | |||
36 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | 37 | using OpenSim.Tests.Common.Mock; |
38 | 38 | ||
39 | namespace OpenSim.Tests.Torture | 39 | namespace OpenSim.Tests.Performance |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// Object torture tests | 42 | /// Object performance tests |
43 | /// </summary> | 43 | /// </summary> |
44 | /// <remarks> | 44 | /// <remarks> |
45 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, | 45 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, |
@@ -47,7 +47,7 @@ namespace OpenSim.Tests.Torture | |||
47 | /// earlier tests. | 47 | /// earlier tests. |
48 | /// </remarks> | 48 | /// </remarks> |
49 | [TestFixture] | 49 | [TestFixture] |
50 | public class ObjectTortureTests | 50 | public class ObjectPerformanceTests |
51 | { | 51 | { |
52 | [TearDown] | 52 | [TearDown] |
53 | public void TearDown() | 53 | public void TearDown() |
diff --git a/OpenSim/Tests/Torture/ScriptTortureTests.cs b/OpenSim/Tests/Performance/ScriptPerformanceTests.cs index 24f278f..d708abd 100644 --- a/OpenSim/Tests/Torture/ScriptTortureTests.cs +++ b/OpenSim/Tests/Performance/ScriptPerformanceTests.cs | |||
@@ -42,10 +42,10 @@ using OpenSim.Region.ScriptEngine.XEngine; | |||
42 | using OpenSim.Tests.Common; | 42 | using OpenSim.Tests.Common; |
43 | using OpenSim.Tests.Common.Mock; | 43 | using OpenSim.Tests.Common.Mock; |
44 | 44 | ||
45 | namespace OpenSim.Tests.Torture | 45 | namespace OpenSim.Tests.Performance |
46 | { | 46 | { |
47 | /// <summary> | 47 | /// <summary> |
48 | /// Script torture tests | 48 | /// Script performance tests |
49 | /// </summary> | 49 | /// </summary> |
50 | /// <remarks> | 50 | /// <remarks> |
51 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, | 51 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, |
@@ -53,7 +53,7 @@ namespace OpenSim.Tests.Torture | |||
53 | /// earlier tests. | 53 | /// earlier tests. |
54 | /// </remarks> | 54 | /// </remarks> |
55 | [TestFixture] | 55 | [TestFixture] |
56 | public class ScriptTortureTests | 56 | public class ScriptPerformanceTests |
57 | { | 57 | { |
58 | private TestScene m_scene; | 58 | private TestScene m_scene; |
59 | private XEngine m_xEngine; | 59 | private XEngine m_xEngine; |
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Linq; | ||
32 | using System.Reflection; | ||
33 | using System.Threading; | ||
34 | using log4net.Config; | ||
35 | using NUnit.Framework; | ||
36 | using OpenMetaverse; | ||
37 | using OpenMetaverse.Assets; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Region.CoreModules.Scripting.DynamicTexture; | ||
40 | using OpenSim.Region.CoreModules.Scripting.VectorRender; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
43 | using OpenSim.Tests.Common; | ||
44 | using OpenSim.Tests.Common.Mock; | ||
45 | |||
46 | namespace 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 | ||