aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs96
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs22
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs23
-rw-r--r--OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs12
-rw-r--r--OpenSim/Tests/Torture/ObjectTortureTests.cs2
-rw-r--r--OpenSim/Tests/Torture/ScriptTortureTests.cs157
-rw-r--r--bin/config-include/GridCommon.ini.example2
-rw-r--r--prebuild.xml2
14 files changed, 336 insertions, 46 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index a6c234e..ac39b6b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1549,7 +1549,7 @@ namespace OpenSim.Region.Framework.Scenes
1549 PhysActor = null; 1549 PhysActor = null;
1550 } 1550 }
1551 1551
1552 // Basic Physics returns null.. joy joy joy. 1552 // Basic Physics can also return null as well as an exception catch.
1553 if (PhysActor != null) 1553 if (PhysActor != null)
1554 { 1554 {
1555 PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info 1555 PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
@@ -1557,10 +1557,6 @@ namespace OpenSim.Region.Framework.Scenes
1557 DoPhysicsPropertyUpdate(RigidBody, true); 1557 DoPhysicsPropertyUpdate(RigidBody, true);
1558 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1558 PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1559 } 1559 }
1560 else
1561 {
1562 m_log.DebugFormat("[SOP]: physics actor is null for {0} with parent {1}", UUID, this.ParentGroup.UUID);
1563 }
1564 } 1560 }
1565 } 1561 }
1566 } 1562 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index dc64281..ca85d10 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -326,10 +326,8 @@ namespace OpenSim.Region.Framework.Scenes
326 /// <returns></returns> 326 /// <returns></returns>
327 public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource) 327 public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource)
328 { 328 {
329 // m_log.InfoFormat( 329// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
330 // "[PRIM INVENTORY]: " + 330// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
331 // "Starting script {0}, {1} in prim {2}, {3}",
332 // item.Name, item.ItemID, Name, UUID);
333 331
334 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 332 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
335 { 333 {
@@ -362,8 +360,7 @@ namespace OpenSim.Region.Framework.Scenes
362 string msg = String.Format("asset ID {0} could not be found", item.AssetID); 360 string msg = String.Format("asset ID {0} could not be found", item.AssetID);
363 StoreScriptError(item.ItemID, msg); 361 StoreScriptError(item.ItemID, msg);
364 m_log.ErrorFormat( 362 m_log.ErrorFormat(
365 "[PRIM INVENTORY]: " + 363 "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
366 "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
367 item.Name, item.ItemID, m_part.AbsolutePosition, 364 item.Name, item.ItemID, m_part.AbsolutePosition,
368 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); 365 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
369 } 366 }
@@ -499,8 +496,9 @@ namespace OpenSim.Region.Framework.Scenes
499 string msg = String.Format("couldn't be found for prim {0}, {1}", m_part.Name, m_part.UUID); 496 string msg = String.Format("couldn't be found for prim {0}, {1}", m_part.Name, m_part.UUID);
500 StoreScriptError(itemId, msg); 497 StoreScriptError(itemId, msg);
501 m_log.ErrorFormat( 498 m_log.ErrorFormat(
502 "[PRIM INVENTORY]: " + 499 "[PRIM INVENTORY]: Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
503 "Couldn't start script with ID {0} since it {1}", itemId, msg); 500 itemId, m_part.Name, m_part.UUID,
501 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
504 } 502 }
505 503
506 } 504 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index 1abef8d..e4b607d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -53,6 +53,30 @@ namespace OpenSim.Region.Framework.Tests
53 public class TaskInventoryTests 53 public class TaskInventoryTests
54 { 54 {
55 [Test] 55 [Test]
56 public void TestAddTaskInventoryItem()
57 {
58 TestHelpers.InMethod();
59// log4net.Config.XmlConfigurator.Configure();
60
61 Scene scene = SceneHelpers.SetupScene();
62 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
63 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
64 SceneObjectPart sop1 = sog1.RootPart;
65
66 // Create an object embedded inside the first
67 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
68 TaskInventoryItem taskSceneObjectItem
69 = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
70
71 TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId);
72 Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId));
73 Assert.That(addedItem.OwnerID, Is.EqualTo(user1.PrincipalID));
74 Assert.That(addedItem.ParentID, Is.EqualTo(sop1.UUID));
75 Assert.That(addedItem.InvType, Is.EqualTo((int)InventoryType.Object));
76 Assert.That(addedItem.Type, Is.EqualTo((int)AssetType.Object));
77 }
78
79 [Test]
56 public void TestRezObjectFromInventoryItem() 80 public void TestRezObjectFromInventoryItem()
57 { 81 {
58 TestHelpers.InMethod(); 82 TestHelpers.InMethod();
@@ -66,7 +90,7 @@ namespace OpenSim.Region.Framework.Tests
66 // Create an object embedded inside the first 90 // Create an object embedded inside the first
67 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); 91 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
68 TaskInventoryItem taskSceneObjectItem 92 TaskInventoryItem taskSceneObjectItem
69 = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId); 93 = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
70 94
71 scene.AddSceneObject(sog1); 95 scene.AddSceneObject(sog1);
72 96
diff --git a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs
index 130e197..e35f79f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
44 string dirName = myDomain.FriendlyName; 44 string dirName = myDomain.FriendlyName;
45 string ScriptEnginesPath = myDomain.SetupInformation.PrivateBinPath; 45 string ScriptEnginesPath = myDomain.SetupInformation.PrivateBinPath;
46 46
47 string[] pathList = new string[] {"bin", ScriptEnginesPath, 47 string[] pathList = new string[] {"", "bin", ScriptEnginesPath,
48 Path.Combine(ScriptEnginesPath, dirName)}; 48 Path.Combine(ScriptEnginesPath, dirName)};
49 49
50 string assemblyName = args.Name; 50 string assemblyName = args.Name;
@@ -56,6 +56,8 @@ namespace OpenSim.Region.ScriptEngine.Shared
56 string path = Path.Combine(Directory.GetCurrentDirectory(), 56 string path = Path.Combine(Directory.GetCurrentDirectory(),
57 Path.Combine(s, assemblyName))+".dll"; 57 Path.Combine(s, assemblyName))+".dll";
58 58
59// Console.WriteLine("Trying to resolve {0}", path);
60
59 if (File.Exists(path)) 61 if (File.Exists(path))
60 return Assembly.LoadFrom(path); 62 return Assembly.LoadFrom(path);
61 } 63 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
index b1fb6c2..8b88588 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
@@ -28,12 +28,16 @@
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
31using Tools; 33using Tools;
32 34
33namespace OpenSim.Region.ScriptEngine.Shared.CodeTools 35namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
34{ 36{
35 public class CSCodeGenerator : ICodeConverter 37 public class CSCodeGenerator : ICodeConverter
36 { 38 {
39// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40
37 private SYMBOL m_astRoot = null; 41 private SYMBOL m_astRoot = null;
38 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap; 42 private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> m_positionMap;
39 private int m_indentWidth = 4; // for indentation 43 private int m_indentWidth = 4; // for indentation
@@ -87,6 +91,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
87 /// <returns>String containing the generated C# code.</returns> 91 /// <returns>String containing the generated C# code.</returns>
88 public string Convert(string script) 92 public string Convert(string script)
89 { 93 {
94// m_log.DebugFormat("[CS CODE GENERATOR]: Converting to C#\n{0}", script);
95
90 m_warnings.Clear(); 96 m_warnings.Clear();
91 ResetCounters(); 97 ResetCounters();
92 Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true)); 98 Parser p = new LSLSyntax(new yyLSLSyntax(), new ErrorHandler(true));
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 734d4d5..c10143b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -291,6 +291,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
291 public void PerformScriptCompile(string Script, string asset, UUID ownerUUID, 291 public void PerformScriptCompile(string Script, string asset, UUID ownerUUID,
292 out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap) 292 out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap)
293 { 293 {
294// m_log.DebugFormat("[Compiler]: Compiling script\n{0}", Script);
295
294 linemap = null; 296 linemap = null;
295 m_warnings.Clear(); 297 m_warnings.Clear();
296 298
@@ -357,6 +359,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
357 if (Script.StartsWith("//yp", true, CultureInfo.InvariantCulture)) 359 if (Script.StartsWith("//yp", true, CultureInfo.InvariantCulture))
358 language = enumCompileType.yp; 360 language = enumCompileType.yp;
359 361
362// m_log.DebugFormat("[Compiler]: Compile language is {0}", language);
363
360 if (!AllowedCompilers.ContainsKey(language.ToString())) 364 if (!AllowedCompilers.ContainsKey(language.ToString()))
361 { 365 {
362 // Not allowed to compile to this language! 366 // Not allowed to compile to this language!
@@ -417,7 +421,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
417 } 421 }
418 422
419 assembly = CompileFromDotNetText(compileScript, language, asset, assembly); 423 assembly = CompileFromDotNetText(compileScript, language, asset, assembly);
420 return;
421 } 424 }
422 425
423 public string[] GetWarnings() 426 public string[] GetWarnings()
@@ -491,6 +494,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
491 /// <returns>Filename to .dll assembly</returns> 494 /// <returns>Filename to .dll assembly</returns>
492 internal string CompileFromDotNetText(string Script, enumCompileType lang, string asset, string assembly) 495 internal string CompileFromDotNetText(string Script, enumCompileType lang, string asset, string assembly)
493 { 496 {
497// m_log.DebugFormat("[Compiler]: Compiling to assembly\n{0}", Script);
498
494 string ext = "." + lang.ToString(); 499 string ext = "." + lang.ToString();
495 500
496 // Output assembly name 501 // Output assembly name
@@ -531,8 +536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
531 536
532 parameters.IncludeDebugInformation = true; 537 parameters.IncludeDebugInformation = true;
533 538
534 string rootPath = 539 string rootPath = AppDomain.CurrentDomain.BaseDirectory;
535 Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
536 540
537 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, 541 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath,
538 "OpenSim.Region.ScriptEngine.Shared.dll")); 542 "OpenSim.Region.ScriptEngine.Shared.dll"));
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
index b635d5c..7d7bd82 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
@@ -27,44 +27,100 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading;
30using Nini.Config; 31using Nini.Config;
31using NUnit.Framework; 32using NUnit.Framework;
32using OpenSim.Tests.Common.Mock;
33using OpenSim.Region.Framework.Scenes;
34using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Region.CoreModules.Scripting.WorldComm;
36using OpenSim.Region.Framework.Scenes;
35using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock;
36 40
37namespace OpenSim.Region.ScriptEngine.XEngine.Tests 41namespace OpenSim.Region.ScriptEngine.XEngine.Tests
38{ 42{
39 /// <summary> 43 /// <summary>
40 /// Scene presence tests 44 /// XEngine tests.
41 /// </summary> 45 /// </summary>
42 /// Commented out XEngineTests that don't do anything
43 /*
44 [TestFixture] 46 [TestFixture]
45 public class XEngineTest 47 public class XEngineTest
46 { 48 {
47 public Scene scene; 49 private TestScene m_scene;
48 50 private XEngine m_xEngine;
49 public static Random random; 51 private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
50 public TestClient testclient; 52 private OSChatMessage m_osChatMessageReceived;
51 //TestCommunicationsManager cm;
52 53
53 [TestFixtureSetUp] 54 [TestFixtureSetUp]
54 public void Init() 55 public void Init()
55 { 56 {
56 TestCommunicationsManager cm = new TestCommunicationsManager(); 57 //AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory + "/bin");
57 scene = SceneSetupHelpers.SetupScene("My Test", UUID.Random(), 1000, 1000, cm); 58// Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);
58 random = new Random(); 59 m_xEngine = new XEngine();
60
61 // Necessary to stop serialization complaining
62 WorldCommModule wcModule = new WorldCommModule();
63
64 IniConfigSource configSource = new IniConfigSource();
65
66 IConfig startupConfig = configSource.AddConfig("Startup");
67 startupConfig.Set("DefaultScriptEngine", "XEngine");
68
69 IConfig xEngineConfig = configSource.AddConfig("XEngine");
70 xEngineConfig.Set("Enabled", "true");
71
72 // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call
73 // to AssemblyResolver.OnAssemblyResolve fails.
74 xEngineConfig.Set("AppDomainLoading", "false");
75
76 m_scene = SceneHelpers.SetupScene("My Test", UUID.Random(), 1000, 1000, null, configSource);
77 SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule);
78 m_scene.StartScripts();
59 } 79 }
60 80
81 /// <summary>
82 /// Test compilation and starting of a script.
83 /// </summary>
84 /// <remarks>
85 /// This is a less than ideal regression test since it involves an asynchronous operation (in this case,
86 /// compilation of the script).
87 /// </remarks>
61 [Test] 88 [Test]
62 public void T001_XStart() 89 public void TestCompileAndStartScript()
63 { 90 {
64 INonSharedRegionModule xengine = new XEngine(); 91 TestHelpers.InMethod();
65 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), xengine); 92// log4net.Config.XmlConfigurator.Configure();
66 xengine.RegionLoaded(scene); 93
94 UUID userId = TestHelpers.ParseTail(0x1);
95// UUID objectId = TestHelpers.ParseTail(0x2);
96// UUID itemId = TestHelpers.ParseTail(0x3);
97 string itemName = "TestStartScript() Item";
98
99 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, "TestStartScriptPart_", 0x100);
100 m_scene.AddNewSceneObject(so, true);
101
102 InventoryItemBase itemTemplate = new InventoryItemBase();
103// itemTemplate.ID = itemId;
104 itemTemplate.Name = itemName;
105 itemTemplate.Folder = so.UUID;
106 itemTemplate.InvType = (int)InventoryType.LSL;
107
108 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
109
110 m_scene.RezNewScript(userId, itemTemplate);
111
112 m_chatEvent.WaitOne(60000);
113
114 Assert.That(m_osChatMessageReceived, Is.Not.Null, "No chat message received in TestStartScript()");
115 Assert.That(m_osChatMessageReceived.Message, Is.EqualTo("Script running"));
116 }
117
118 private void OnChatFromWorld(object sender, OSChatMessage oscm)
119 {
120// Console.WriteLine("Got chat [{0}]", oscm.Message);
121
122 m_osChatMessageReceived = oscm;
123 m_chatEvent.Set();
67 } 124 }
68 } 125 }
69 */ 126} \ No newline at end of file
70}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 084ef48..02d47bd 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -747,6 +747,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
747 747
748 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) 748 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
749 { 749 {
750// m_log.DebugFormat(
751// "[XEngine]: OnRezScript event triggered for script {0}, startParam {1}, postOnRez {2}, engine {3}, stateSource {4}, script\n{5}",
752// itemID, startParam, postOnRez, engine, stateSource, script);
753
750 if (script.StartsWith("//MRM:")) 754 if (script.StartsWith("//MRM:"))
751 return; 755 return;
752 756
@@ -828,6 +832,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
828 m_CompileDict[itemID] = 0; 832 m_CompileDict[itemID] = 0;
829 } 833 }
830 834
835// m_log.DebugFormat("[XEngine]: Added script {0} to compile queue", itemID);
836
831 if (m_CurrentCompile == null) 837 if (m_CurrentCompile == null)
832 { 838 {
833 // NOTE: Although we use a lockless queue, the lock here 839 // NOTE: Although we use a lockless queue, the lock here
@@ -889,6 +895,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
889 bool postOnRez = (bool)p[4]; 895 bool postOnRez = (bool)p[4];
890 StateSource stateSource = (StateSource)p[5]; 896 StateSource stateSource = (StateSource)p[5];
891 897
898// m_log.DebugFormat("[XEngine]: DoOnRezScript called for script {0}", itemID);
899
892 lock (m_CompileDict) 900 lock (m_CompileDict)
893 { 901 {
894 if (!m_CompileDict.ContainsKey(itemID)) 902 if (!m_CompileDict.ContainsKey(itemID))
@@ -937,7 +945,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
937 { 945 {
938 try 946 try
939 { 947 {
940 lock (m_AddingAssemblies) 948 lock (m_AddingAssemblies)
941 { 949 {
942 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); 950 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap);
943 if (!m_AddingAssemblies.ContainsKey(assembly)) { 951 if (!m_AddingAssemblies.ContainsKey(assembly)) {
@@ -989,6 +997,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
989 } 997 }
990 catch (Exception e) 998 catch (Exception e)
991 { 999 {
1000// m_log.ErrorFormat("[XEngine]: Exception when rezzing script {0}{1}", e.Message, e.StackTrace);
1001
992 // try 1002 // try
993 // { 1003 // {
994 if (!m_ScriptErrors.ContainsKey(itemID)) 1004 if (!m_ScriptErrors.ContainsKey(itemID))
@@ -1464,6 +1474,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1464 string path = Path.Combine(Directory.GetCurrentDirectory(), 1474 string path = Path.Combine(Directory.GetCurrentDirectory(),
1465 Path.Combine(s, assemblyName))+".dll"; 1475 Path.Combine(s, assemblyName))+".dll";
1466 1476
1477// Console.WriteLine("[XEngine]: Trying to resolve {0}", path);
1478
1467 if (File.Exists(path)) 1479 if (File.Exists(path))
1468 return Assembly.LoadFrom(path); 1480 return Assembly.LoadFrom(path);
1469 } 1481 }
@@ -1949,16 +1961,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1949 1961
1950 public void SuspendScript(UUID itemID) 1962 public void SuspendScript(UUID itemID)
1951 { 1963 {
1964// m_log.DebugFormat("[XEngine]: Received request to suspend script with ID {0}", itemID);
1965
1952 IScriptInstance instance = GetInstance(itemID); 1966 IScriptInstance instance = GetInstance(itemID);
1953 if (instance != null) 1967 if (instance != null)
1954 instance.Suspend(); 1968 instance.Suspend();
1969// else
1970// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
1955 } 1971 }
1956 1972
1957 public void ResumeScript(UUID itemID) 1973 public void ResumeScript(UUID itemID)
1958 { 1974 {
1975// m_log.DebugFormat("[XEngine]: Received request to resume script with ID {0}", itemID);
1976
1959 IScriptInstance instance = GetInstance(itemID); 1977 IScriptInstance instance = GetInstance(itemID);
1960 if (instance != null) 1978 if (instance != null)
1961 instance.Resume(); 1979 instance.Resume();
1980// else
1981// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
1962 } 1982 }
1963 1983
1964 public bool HasScript(UUID itemID, out bool running) 1984 public bool HasScript(UUID itemID, out bool running)
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index a25eb66..aa904aa 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -88,9 +88,27 @@ namespace OpenSim.Tests.Common
88 /// <param name="id">ID of the region</param> 88 /// <param name="id">ID of the region</param>
89 /// <param name="x">X co-ordinate of the region</param> 89 /// <param name="x">X co-ordinate of the region</param>
90 /// <param name="y">Y co-ordinate of the region</param> 90 /// <param name="y">Y co-ordinate of the region</param>
91 /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> 91 /// <param name="cache"></param>
92 /// <returns></returns> 92 /// <returns></returns>
93 public static TestScene SetupScene(string name, UUID id, uint x, uint y, CoreAssetCache cache) 93 public static TestScene SetupScene(
94 string name, UUID id, uint x, uint y, CoreAssetCache cache)
95 {
96 return SetupScene(name, id, x, y, cache, new IniConfigSource());
97 }
98
99 /// <summary>
100 /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions
101 /// or a different, to get a brand new scene with new shared region modules.
102 /// </summary>
103 /// <param name="name">Name of the region</param>
104 /// <param name="id">ID of the region</param>
105 /// <param name="x">X co-ordinate of the region</param>
106 /// <param name="y">Y co-ordinate of the region</param>
107 /// <param name="cache"></param>
108 /// <param name="configSource"></param>
109 /// <returns></returns>
110 public static TestScene SetupScene(
111 string name, UUID id, uint x, uint y, CoreAssetCache cache, IConfigSource configSource)
94 { 112 {
95 Console.WriteLine("Setting up test scene {0}", name); 113 Console.WriteLine("Setting up test scene {0}", name);
96 114
@@ -106,7 +124,6 @@ namespace OpenSim.Tests.Common
106 124
107 ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null); 125 ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null);
108 IEstateDataService estateDataService = null; 126 IEstateDataService estateDataService = null;
109 IConfigSource configSource = new IniConfigSource();
110 127
111 TestScene testScene = new TestScene( 128 TestScene testScene = new TestScene(
112 regInfo, acm, scs, simDataService, estateDataService, null, false, configSource, null); 129 regInfo, acm, scs, simDataService, estateDataService, null, false, configSource, null);
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
index a8f0d59..7058d1e 100644
--- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
@@ -72,15 +72,21 @@ namespace OpenSim.Tests.Common
72 /// <param name="sop"></param> 72 /// <param name="sop"></param>
73 /// <param name="itemName"></param> 73 /// <param name="itemName"></param>
74 /// <param name="id"></param> 74 /// <param name="id"></param>
75 public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id) 75 /// <param name="userId"></param>
76 public static TaskInventoryItem AddSceneObject(
77 Scene scene, SceneObjectPart sop, string itemName, UUID id, UUID userId)
76 { 78 {
77 SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero); 79 SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero);
78 AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); 80 AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
79 scene.AssetService.Store(taskSceneObjectAsset); 81 scene.AssetService.Store(taskSceneObjectAsset);
80 TaskInventoryItem taskSceneObjectItem 82 TaskInventoryItem taskSceneObjectItem
81 = new TaskInventoryItem 83 = new TaskInventoryItem
82 { Name = itemName, AssetID = taskSceneObjectAsset.FullID, ItemID = id, 84 { Name = itemName,
83 Type = (int)AssetType.Object, InvType = (int)InventoryType.Object }; 85 AssetID = taskSceneObjectAsset.FullID,
86 ItemID = id,
87 OwnerID = userId,
88 Type = (int)AssetType.Object,
89 InvType = (int)InventoryType.Object };
84 sop.Inventory.AddInventoryItem(taskSceneObjectItem, true); 90 sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
85 91
86 return taskSceneObjectItem; 92 return taskSceneObjectItem;
diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs
index b9764d7..444b7ec 100644
--- a/OpenSim/Tests/Torture/ObjectTortureTests.cs
+++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Tests.Torture
118 118
119 TestScene scene = SceneHelpers.SetupScene(); 119 TestScene scene = SceneHelpers.SetupScene();
120 120
121 Process process = Process.GetCurrentProcess(); 121// Process process = Process.GetCurrentProcess();
122// long startProcessMemory = process.PrivateMemorySize64; 122// long startProcessMemory = process.PrivateMemorySize64;
123 long startGcMemory = GC.GetTotalMemory(true); 123 long startGcMemory = GC.GetTotalMemory(true);
124 DateTime start = DateTime.Now; 124 DateTime start = DateTime.Now;
diff --git a/OpenSim/Tests/Torture/ScriptTortureTests.cs b/OpenSim/Tests/Torture/ScriptTortureTests.cs
new file mode 100644
index 0000000..c0239ba
--- /dev/null
+++ b/OpenSim/Tests/Torture/ScriptTortureTests.cs
@@ -0,0 +1,157 @@
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.Diagnostics;
31using System.Reflection;
32using System.Threading;
33using log4net;
34using Nini.Config;
35using NUnit.Framework;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Region.CoreModules.Scripting.WorldComm;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.ScriptEngine.XEngine;
42using OpenSim.Tests.Common;
43using OpenSim.Tests.Common.Mock;
44
45namespace OpenSim.Tests.Torture
46{
47 /// <summary>
48 /// Script torture tests
49 /// </summary>
50 /// <remarks>
51 /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached,
52 /// how much memory is free, etc. In some cases, later larger tests will apparently take less time than smaller
53 /// earlier tests.
54 /// </remarks>
55 [TestFixture]
56 public class ScriptTortureTests
57 {
58 private TestScene m_scene;
59 private XEngine m_xEngine;
60 private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
61
62 private int m_expectedChatMessages;
63 private List<OSChatMessage> m_osChatMessagesReceived = new List<OSChatMessage>();
64
65 [SetUp]
66 public void Init()
67 {
68 //AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory + "/bin");
69// Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);
70 m_xEngine = new XEngine();
71
72 // Necessary to stop serialization complaining
73 WorldCommModule wcModule = new WorldCommModule();
74
75 IniConfigSource configSource = new IniConfigSource();
76
77 IConfig startupConfig = configSource.AddConfig("Startup");
78 startupConfig.Set("DefaultScriptEngine", "XEngine");
79
80 IConfig xEngineConfig = configSource.AddConfig("XEngine");
81 xEngineConfig.Set("Enabled", "true");
82
83 // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call
84 // to AssemblyResolver.OnAssemblyResolve fails.
85 xEngineConfig.Set("AppDomainLoading", "false");
86
87 m_scene = SceneHelpers.SetupScene("My Test", UUID.Random(), 1000, 1000, null, configSource);
88 SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule);
89
90 m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
91 m_scene.StartScripts();
92 }
93
94 [Test]
95 public void TestCompileAndStart100Scripts()
96 {
97 TestHelpers.InMethod();
98 log4net.Config.XmlConfigurator.Configure();
99
100 TestCompileAndStartScripts(100);
101 }
102
103 private void TestCompileAndStartScripts(int scriptsToCreate)
104 {
105 UUID userId = TestHelpers.ParseTail(0x1);
106
107 m_expectedChatMessages = scriptsToCreate;
108 int startingObjectIdTail = 0x100;
109
110 for (int idTail = startingObjectIdTail;idTail < startingObjectIdTail + scriptsToCreate; idTail++)
111 {
112 AddObjectAndScript(idTail, userId);
113 }
114
115 m_chatEvent.WaitOne(40000 + scriptsToCreate * 1000);
116
117 Assert.That(m_osChatMessagesReceived.Count, Is.EqualTo(m_expectedChatMessages));
118
119 foreach (OSChatMessage msg in m_osChatMessagesReceived)
120 Assert.That(
121 msg.Message,
122 Is.EqualTo("Script running"),
123 string.Format(
124 "Message from {0} was {1} rather than {2}", msg.SenderUUID, msg.Message, "Script running"));
125 }
126
127 private void AddObjectAndScript(int objectIdTail, UUID userId)
128 {
129// UUID itemId = TestHelpers.ParseTail(0x3);
130 string itemName = string.Format("AddObjectAndScript() Item for object {0}", objectIdTail);
131
132 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, "AddObjectAndScriptPart_", objectIdTail);
133 m_scene.AddNewSceneObject(so, true);
134
135 InventoryItemBase itemTemplate = new InventoryItemBase();
136// itemTemplate.ID = itemId;
137 itemTemplate.Name = itemName;
138 itemTemplate.Folder = so.UUID;
139 itemTemplate.InvType = (int)InventoryType.LSL;
140
141 m_scene.RezNewScript(userId, itemTemplate);
142 }
143
144 private void OnChatFromWorld(object sender, OSChatMessage oscm)
145 {
146// Console.WriteLine("Got chat [{0}]", oscm.Message);
147
148 lock (m_osChatMessagesReceived)
149 {
150 m_osChatMessagesReceived.Add(oscm);
151
152 if (m_osChatMessagesReceived.Count == m_expectedChatMessages)
153 m_chatEvent.Set();
154 }
155 }
156 }
157} \ No newline at end of file
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example
index 4195bce..712481d 100644
--- a/bin/config-include/GridCommon.ini.example
+++ b/bin/config-include/GridCommon.ini.example
@@ -14,6 +14,8 @@
14 ;StorageProvider = "OpenSim.Data.MySQL.dll" 14 ;StorageProvider = "OpenSim.Data.MySQL.dll"
15 ;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;" 15 ;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;"
16 ; Uncomment this line if you are using MySQL and want to use a different database for estates 16 ; Uncomment this line if you are using MySQL and want to use a different database for estates
17 ; The usual application for this is to allow estates to be spread out across multiple simulators by share the same database.
18 ; Most people won't need to do this so only uncomment if you know what you're doing.
17 ;EstateConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;" 19 ;EstateConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;"
18 20
19 ; MSSQL 21 ; MSSQL
diff --git a/prebuild.xml b/prebuild.xml
index 20aa24f..7f069bd 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -3318,7 +3318,9 @@
3318 <Reference name="OpenSim.Framework"/> 3318 <Reference name="OpenSim.Framework"/>
3319 <Reference name="OpenSim.Framework.Console"/> 3319 <Reference name="OpenSim.Framework.Console"/>
3320 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 3320 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
3321 <Reference name="OpenSim.Region.CoreModules"/>
3321 <Reference name="OpenSim.Region.Framework"/> 3322 <Reference name="OpenSim.Region.Framework"/>
3323 <Reference name="OpenSim.Region.ScriptEngine.XEngine"/>
3322 <Reference name="OpenSim.Tests.Common"/> 3324 <Reference name="OpenSim.Tests.Common"/>
3323 <Files> 3325 <Files>
3324 <Match pattern="*.cs" recurse="false"/> 3326 <Match pattern="*.cs" recurse="false"/>