diff options
author | nat-goodspeed <nat@lindenlab.com> | 2024-03-28 14:58:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-28 14:58:11 -0400 |
commit | 5e576c98f7df1a82cfb68f4cf817e0fe16f2e465 (patch) | |
tree | fa50e02d11aa8320ae86799b66e20aa157a45f9a /indra/newview/tests | |
parent | 55c32761a0be05c7d4b4e17765e2d341efb0ebe6 (diff) | |
parent | 53ce38b106a086a4e3bc1ed0663bb47b0f0d967c (diff) |
Merge pull request #1079 from secondlife/lua-hangfix
Terminate Lua scripts hanging in `LL.get_event_next()`.
Diffstat (limited to 'indra/newview/tests')
-rw-r--r-- | indra/newview/tests/llluamanager_test.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/newview/tests/llluamanager_test.cpp b/indra/newview/tests/llluamanager_test.cpp index e10dedcf53..b907ac6619 100644 --- a/indra/newview/tests/llluamanager_test.cpp +++ b/indra/newview/tests/llluamanager_test.cpp @@ -418,4 +418,24 @@ namespace tut auto [count, result] = future.get(); ensure_equals("leap.lua: " + result.asString(), count, 0); } + + template<> template<> + void object::test<7>() + { + set_test_name("stop hanging Lua script"); + const std::string lua( + "-- hanging Lua script should terminate\n" + "\n" + "LL.get_event_next()\n" + ); + LuaState L; + auto future = LLLUAmanager::startScriptLine(L, lua); + // Poke LLTestApp to send its preliminary shutdown message. + mApp.setQuitting(); + // but now we have to give the startScriptLine() coroutine a chance to run + auto [count, result] = future.get(); + ensure_equals("killed Lua script terminated normally", count, -1); + ensure_equals("unexpected killed Lua script error", + result.asString(), "viewer is stopping"); + } } // namespace tut |