aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.nant/local.include11
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs19
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs6
-rw-r--r--OpenSim/Tests/Torture/ObjectTortureTests.cs126
-rw-r--r--bin/OpenSim.Tests.Torture.dll.config33
-rw-r--r--prebuild.xml34
8 files changed, 227 insertions, 5 deletions
diff --git a/.nant/local.include b/.nant/local.include
index 0c23e50..4fa3e4d 100644
--- a/.nant/local.include
+++ b/.nant/local.include
@@ -111,6 +111,17 @@
111 <delete dir="%temp%"/> 111 <delete dir="%temp%"/>
112</target> 112</target>
113 113
114<target name="torture" depends="build, find-nunit">
115 <setenv name="MONO_THREADS_PER_CPU" value="100" />
116
117 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.torture">
118 <arg value="./bin/OpenSim.Tests.Torture.dll" />
119 </exec>
120
121 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.torture)==0}" />
122 <delete dir="%temp%"/>
123</target>
124
114<target name="find-nunit"> 125<target name="find-nunit">
115 <exec program="which" failonerror="false" 126 <exec program="which" failonerror="false"
116 resultproperty="hasnunit2"> 127 resultproperty="hasnunit2">
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 6e26c0e..80bff17 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -439,6 +439,7 @@ namespace OpenSim
439 { 439 {
440 scene.SnmpService.BootInfo("Grid Registration in progress", scene); 440 scene.SnmpService.BootInfo("Grid Registration in progress", scene);
441 } 441 }
442
442 try 443 try
443 { 444 {
444 scene.RegisterRegionWithGrid(); 445 scene.RegisterRegionWithGrid();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4daabd2..9b31fac 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2006,6 +2006,7 @@ namespace OpenSim.Region.Framework.Scenes
2006 /// If true, the object is made persistent into the scene. 2006 /// If true, the object is made persistent into the scene.
2007 /// If false, the object will not persist over server restarts 2007 /// If false, the object will not persist over server restarts
2008 /// </param> 2008 /// </param>
2009 /// <returns>true if the object was added. false if not</returns>
2009 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 2010 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
2010 { 2011 {
2011 return AddNewSceneObject(sceneObject, attachToBackup, true); 2012 return AddNewSceneObject(sceneObject, attachToBackup, true);
@@ -2023,6 +2024,7 @@ namespace OpenSim.Region.Framework.Scenes
2023 /// If true, updates for the new scene object are sent to all viewers in range. 2024 /// If true, updates for the new scene object are sent to all viewers in range.
2024 /// If false, it is left to the caller to schedule the update 2025 /// If false, it is left to the caller to schedule the update
2025 /// </param> 2026 /// </param>
2027 /// <returns>true if the object was added. false if not</returns>
2026 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 2028 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
2027 { 2029 {
2028 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) 2030 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates))
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index ea2caaf..aecca27 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -395,11 +395,28 @@ namespace OpenSim.Region.Framework.Scenes
395 /// </returns> 395 /// </returns>
396 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 396 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
397 { 397 {
398 if (sceneObject == null || sceneObject.RootPart.UUID == UUID.Zero) 398 if (sceneObject == null)
399 {
400 m_log.ErrorFormat("[SCENEGRAPH]: Tried to add null scene object");
401 return false;
402 }
403 if (sceneObject.UUID == UUID.Zero)
404 {
405 m_log.ErrorFormat(
406 "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}",
407 sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero);
408
399 return false; 409 return false;
410 }
400 411
401 if (Entities.ContainsKey(sceneObject.UUID)) 412 if (Entities.ContainsKey(sceneObject.UUID))
413 {
414// m_log.DebugFormat(
415// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()",
416// m_parentScene.RegionInfo.RegionName, sceneObject.UUID);
417
402 return false; 418 return false;
419 }
403 420
404// m_log.DebugFormat( 421// m_log.DebugFormat(
405// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", 422// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 01e5dbe..7ed41f2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4395,9 +4395,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4395 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), 4395 Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f),
4396 Util.Clip((float)color.y, 0.0f, 1.0f), 4396 Util.Clip((float)color.y, 0.0f, 1.0f),
4397 Util.Clip((float)color.z, 0.0f, 1.0f)); 4397 Util.Clip((float)color.z, 0.0f, 1.0f));
4398 m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); 4398 m_host.SetText(text.Length > 254 ? text.Remove(255) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
4399 m_host.ParentGroup.HasGroupChanged = true; 4399 //m_host.ParentGroup.HasGroupChanged = true;
4400 m_host.ParentGroup.ScheduleGroupForFullUpdate(); 4400 //m_host.ParentGroup.ScheduleGroupForFullUpdate();
4401 } 4401 }
4402 4402
4403 public LSL_Float llWater(LSL_Vector offset) 4403 public LSL_Float llWater(LSL_Vector offset)
diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs
new file mode 100644
index 0000000..cdbaa66
--- /dev/null
+++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs
@@ -0,0 +1,126 @@
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.Diagnostics;
30using System.Reflection;
31using log4net;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock;
38
39namespace OpenSim.Tests.Torture
40{
41 /// <summary>
42 /// Object torture tests
43 /// </summary>
44 /// <remarks>
45 /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached,
46 /// how much memory is free, etc. In some cases, later larger tests will apparently take less time than smaller
47 /// earlier tests.
48 /// </remarks>
49 [TestFixture]
50 public class ObjectTortureTests
51 {
52// [Test]
53// public void Test0000Clean()
54// {
55// TestHelpers.InMethod();
56//// log4net.Config.XmlConfigurator.Configure();
57//
58// TestAddObjects(200000);
59// }
60
61 [Test]
62 public void Test0001TenThousandObjects()
63 {
64 TestHelpers.InMethod();
65// log4net.Config.XmlConfigurator.Configure();
66
67 TestAddObjects(10000);
68 }
69
70 [Test]
71 public void Test0002OneHundredThousandObjects()
72 {
73 TestHelpers.InMethod();
74// log4net.Config.XmlConfigurator.Configure();
75
76 TestAddObjects(100000);
77 }
78
79 [Test]
80 public void Test0003TwoHundredThousandObjects()
81 {
82 TestHelpers.InMethod();
83// log4net.Config.XmlConfigurator.Configure();
84
85 TestAddObjects(200000);
86 }
87
88 private void TestAddObjects(int objectsToAdd)
89 {
90 UUID ownerId = new UUID("F0000000-0000-0000-0000-000000000000");
91
92 TestScene scene = SceneHelpers.SetupScene();
93
94 Process process = Process.GetCurrentProcess();
95// long startProcessMemory = process.PrivateMemorySize64;
96 long startGcMemory = GC.GetTotalMemory(true);
97 DateTime start = DateTime.Now;
98
99 for (int i = 1; i <= objectsToAdd; i++)
100 {
101 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId, "part_", i);
102 Assert.That(scene.AddNewSceneObject(so, false), Is.True, string.Format("Object {0} was not created", i));
103 }
104
105 TimeSpan elapsed = DateTime.Now - start;
106// long processMemoryAlloc = process.PrivateMemorySize64 - startProcessMemory;
107 long processGcAlloc = GC.GetTotalMemory(false) - startGcMemory;
108
109 for (int i = 1; i <= objectsToAdd; i++)
110 {
111 Assert.That(
112 scene.GetSceneObjectGroup(TestHelpers.ParseTail(i)),
113 Is.Not.Null,
114 string.Format("Object {0} could not be retrieved", i));
115 }
116
117// Console.WriteLine(
118// "Took {0}ms, {1}MB to create {2} single prim scene objects",
119// elapsed.Milliseconds, processGcAlloc / 1024 / 1024, objectsToAdd);
120
121 Console.WriteLine(
122 "Took {0}MB to create {1} single prim scene objects",
123 processGcAlloc / 1024 / 1024, objectsToAdd);
124 }
125 }
126} \ No newline at end of file
diff --git a/bin/OpenSim.Tests.Torture.dll.config b/bin/OpenSim.Tests.Torture.dll.config
new file mode 100644
index 0000000..a3f681d
--- /dev/null
+++ b/bin/OpenSim.Tests.Torture.dll.config
@@ -0,0 +1,33 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<configuration>
3 <configSections>
4 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
5 </configSections>
6 <runtime>
7 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8 <dependentAssembly>
9 <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
10 <bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
11 <bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
12 <bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
13 </dependentAssembly>
14 </assemblyBinding>
15 </runtime>
16 <log4net>
17 <!-- A1 is set to be a ConsoleAppender -->
18 <appender name="A1" type="log4net.Appender.ConsoleAppender">
19
20 <!-- A1 uses PatternLayout -->
21 <layout type="log4net.Layout.PatternLayout">
22 <!-- Print the date in ISO 8601 format -->
23 <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
24 </layout>
25 </appender>
26
27 <!-- Set root logger level to DEBUG and its only appender to A1 -->
28 <root>
29 <level value="DEBUG" />
30 <appender-ref ref="A1" />
31 </root>
32 </log4net>
33</configuration>
diff --git a/prebuild.xml b/prebuild.xml
index 7b3181b..aab61ad 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -2854,7 +2854,6 @@
2854 </Files> 2854 </Files>
2855 </Project> 2855 </Project>
2856 2856
2857
2858 <Project frameworkVersion="v3_5" name="OpenSim.Framework.Tests" path="OpenSim/Framework/Tests" type="Library"> 2857 <Project frameworkVersion="v3_5" name="OpenSim.Framework.Tests" path="OpenSim/Framework/Tests" type="Library">
2859 <Configuration name="Debug"> 2858 <Configuration name="Debug">
2860 <Options> 2859 <Options>
@@ -3291,6 +3290,39 @@
3291 </Files> 3290 </Files>
3292 </Project> 3291 </Project>
3293 3292
3293 <Project frameworkVersion="v3_5" name="OpenSim.Tests.Torture" path="OpenSim/Tests/Torture" type="Library">
3294 <Configuration name="Debug">
3295 <Options>
3296 <OutputPath>../../../bin/</OutputPath>
3297 </Options>
3298 </Configuration>
3299 <Configuration name="Release">
3300 <Options>
3301 <OutputPath>../../../bin/</OutputPath>
3302 </Options>
3303 </Configuration>
3304
3305 <ReferencePath>../../../bin/</ReferencePath>
3306 <Reference name="System"/>
3307 <Reference name="System.Xml"/>
3308 <Reference name="System.Data"/>
3309 <Reference name="log4net" path="../../../bin/"/>
3310 <Reference name="Nini" path="../../../bin/"/>
3311 <Reference name="nunit.framework" path="../../../bin/"/>
3312 <Reference name="OpenMetaverse" path="../../../bin/"/>
3313 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
3314 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
3315 <Reference name="XMLRPC" path="../../../bin/"/>
3316 <Reference name="OpenSim.Framework"/>
3317 <Reference name="OpenSim.Framework.Console"/>
3318 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
3319 <Reference name="OpenSim.Region.Framework"/>
3320 <Reference name="OpenSim.Tests.Common"/>
3321 <Files>
3322 <Match pattern="*.cs" recurse="false"/>
3323 </Files>
3324 </Project>
3325
3294 <?include file="addon-modules/*/prebuild*.xml" ?> 3326 <?include file="addon-modules/*/prebuild*.xml" ?>
3295 3327
3296 </Solution> 3328 </Solution>