diff options
author | Justin Clark-Casey (justincc) | 2013-01-22 01:23:10 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-01-22 01:23:10 +0000 |
commit | c6ba27d096a3008bc0128aebddf4d2e9708d2498 (patch) | |
tree | db37f203009f1d9a017c9d90249782cc53c1a977 | |
parent | factor out common code in existing co-op termination regression tests (diff) | |
download | opensim-SC_OLD-c6ba27d096a3008bc0128aebddf4d2e9708d2498.zip opensim-SC_OLD-c6ba27d096a3008bc0128aebddf4d2e9708d2498.tar.gz opensim-SC_OLD-c6ba27d096a3008bc0128aebddf4d2e9708d2498.tar.bz2 opensim-SC_OLD-c6ba27d096a3008bc0128aebddf4d2e9708d2498.tar.xz |
Fix bug in generating termination checks in compound statement for loop.
Add regression test for this case.
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs | 28 |
2 files changed, 27 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 002f9b8..985e598 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | |||
@@ -445,7 +445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
445 | if (previousSymbol is GlobalFunctionDefinition | 445 | if (previousSymbol is GlobalFunctionDefinition |
446 | || previousSymbol is WhileStatement | 446 | || previousSymbol is WhileStatement |
447 | || previousSymbol is DoWhileStatement | 447 | || previousSymbol is DoWhileStatement |
448 | || previousSymbol is ForLoopStatement | 448 | || previousSymbol is ForLoop |
449 | || previousSymbol is StateEvent) | 449 | || previousSymbol is StateEvent) |
450 | retstr += GenerateIndentedLine(m_coopTerminationCheck); | 450 | retstr += GenerateIndentedLine(m_coopTerminationCheck); |
451 | } | 451 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs index 952ae40..c83a6ba 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs | |||
@@ -76,12 +76,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests | |||
76 | xEngineConfig.Set("AppDomainLoading", "false"); | 76 | xEngineConfig.Set("AppDomainLoading", "false"); |
77 | 77 | ||
78 | xEngineConfig.Set("ScriptStopStrategy", "co-op"); | 78 | xEngineConfig.Set("ScriptStopStrategy", "co-op"); |
79 | xEngineConfig.Set("WriteScriptSourceToDebugFile", true); | ||
79 | 80 | ||
80 | // This is not currently used at all for co-op termination. Bumping up to demonstrate that co-op termination | 81 | // This is not currently used at all for co-op termination. Bumping up to demonstrate that co-op termination |
81 | // has an effect - without it tests will fail due to a 120 second wait for the event to finish. | 82 | // has an effect - without it tests will fail due to a 120 second wait for the event to finish. |
82 | xEngineConfig.Set("WaitForEventCompletionOnScriptStop", 120000); | 83 | xEngineConfig.Set("WaitForEventCompletionOnScriptStop", 120000); |
83 | 84 | ||
84 | m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource); | 85 | m_scene = new SceneHelpers().SetupScene("My Test", TestHelpers.ParseTail(0x9999), 1000, 1000, configSource); |
85 | SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine); | 86 | SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine); |
86 | m_scene.StartScripts(); | 87 | m_scene.StartScripts(); |
87 | } | 88 | } |
@@ -113,7 +114,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests | |||
113 | } | 114 | } |
114 | 115 | ||
115 | [Test] | 116 | [Test] |
116 | public void TestStopOnLongForLoop() | 117 | public void TestStopOnLongSingleStatementForLoop() |
117 | { | 118 | { |
118 | TestHelpers.InMethod(); | 119 | TestHelpers.InMethod(); |
119 | // TestHelpers.EnableLogging(); | 120 | // TestHelpers.EnableLogging(); |
@@ -133,6 +134,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests | |||
133 | TestStop(script); | 134 | TestStop(script); |
134 | } | 135 | } |
135 | 136 | ||
137 | [Test] | ||
138 | public void TestStopOnLongCompoundStatementForLoop() | ||
139 | { | ||
140 | TestHelpers.InMethod(); | ||
141 | // TestHelpers.EnableLogging(); | ||
142 | |||
143 | string script = | ||
144 | @"default | ||
145 | { | ||
146 | state_entry() | ||
147 | { | ||
148 | llSay(0, ""Thin Lizzy""); | ||
149 | integer i = 0; | ||
150 | for (i = 0; i < 2147483647; i++) | ||
151 | { | ||
152 | llSay(0, ""Iter "" + (string)i); | ||
153 | } | ||
154 | } | ||
155 | }"; | ||
156 | |||
157 | TestStop(script); | ||
158 | } | ||
159 | |||
136 | private void TestStop(string script) | 160 | private void TestStop(string script) |
137 | { | 161 | { |
138 | UUID userId = TestHelpers.ParseTail(0x1); | 162 | UUID userId = TestHelpers.ParseTail(0x1); |