aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs24
-rw-r--r--OpenSim/Tests/Torture/ObjectTortureTests.cs126
2 files changed, 145 insertions, 5 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 37b90e1..ab89fe0 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -44,9 +44,6 @@ namespace OpenSim.Tests.Common.Mock
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 // Mock testing variables
48 public List<ImageDataPacket> sentdatapkt = new List<ImageDataPacket>();
49 public List<ImagePacketPacket> sentpktpkt = new List<ImagePacketPacket>();
50 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); 47 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
51 48
52 // TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup 49 // TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup
@@ -61,6 +58,10 @@ namespace OpenSim.Tests.Common.Mock
61 public List<UUID> ReceivedOnlineNotifications { get; private set; } 58 public List<UUID> ReceivedOnlineNotifications { get; private set; }
62 public List<UUID> ReceivedFriendshipTerminations { get; private set; } 59 public List<UUID> ReceivedFriendshipTerminations { get; private set; }
63 60
61 public List<ImageDataPacket> SentImageDataPackets { get; private set; }
62 public List<ImagePacketPacket> SentImagePacketPackets { get; private set; }
63 public List<ImageNotInDatabasePacket> SentImageNotInDatabasePackets { get; private set; }
64
64// disable warning: public events, part of the public API 65// disable warning: public events, part of the public API
65#pragma warning disable 67 66#pragma warning disable 67
66 67
@@ -193,6 +194,7 @@ namespace OpenSim.Tests.Common.Mock
193 public event RegionInfoRequest OnRegionInfoRequest; 194 public event RegionInfoRequest OnRegionInfoRequest;
194 public event EstateCovenantRequest OnEstateCovenantRequest; 195 public event EstateCovenantRequest OnEstateCovenantRequest;
195 public event EstateChangeInfo OnEstateChangeInfo; 196 public event EstateChangeInfo OnEstateChangeInfo;
197 public event EstateManageTelehub OnEstateManageTelehub;
196 198
197 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; 199 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
198 200
@@ -452,6 +454,10 @@ namespace OpenSim.Tests.Common.Mock
452 ReceivedOfflineNotifications = new List<UUID>(); 454 ReceivedOfflineNotifications = new List<UUID>();
453 ReceivedOnlineNotifications = new List<UUID>(); 455 ReceivedOnlineNotifications = new List<UUID>();
454 ReceivedFriendshipTerminations = new List<UUID>(); 456 ReceivedFriendshipTerminations = new List<UUID>();
457
458 SentImageDataPackets = new List<ImageDataPacket>();
459 SentImagePacketPackets = new List<ImagePacketPacket>();
460 SentImageNotInDatabasePackets = new List<ImageNotInDatabasePacket>();
455 } 461 }
456 462
457 /// <summary> 463 /// <summary>
@@ -804,7 +810,7 @@ namespace OpenSim.Tests.Common.Mock
804 im.ImageData.Data = ImageData; 810 im.ImageData.Data = ImageData;
805 im.ImageID.Codec = imageCodec; 811 im.ImageID.Codec = imageCodec;
806 im.Header.Zerocoded = true; 812 im.Header.Zerocoded = true;
807 sentdatapkt.Add(im); 813 SentImageDataPackets.Add(im);
808 } 814 }
809 815
810 public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData) 816 public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
@@ -814,11 +820,15 @@ namespace OpenSim.Tests.Common.Mock
814 im.ImageID.Packet = partNumber; 820 im.ImageID.Packet = partNumber;
815 im.ImageID.ID = imageUuid; 821 im.ImageID.ID = imageUuid;
816 im.ImageData.Data = imageData; 822 im.ImageData.Data = imageData;
817 sentpktpkt.Add(im); 823 SentImagePacketPackets.Add(im);
818 } 824 }
819 825
820 public void SendImageNotFound(UUID imageid) 826 public void SendImageNotFound(UUID imageid)
821 { 827 {
828 ImageNotInDatabasePacket p = new ImageNotInDatabasePacket();
829 p.ImageID.ID = imageid;
830
831 SentImageNotInDatabasePackets.Add(p);
822 } 832 }
823 833
824 public void SendShutdownConnectionNotice() 834 public void SendShutdownConnectionNotice()
@@ -942,6 +952,10 @@ namespace OpenSim.Tests.Common.Mock
942 { 952 {
943 } 953 }
944 954
955 public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
956 {
957 }
958
945 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID) 959 public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
946 { 960 {
947 } 961 }
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