test(chat): real two-scene llListen runtime regression (#199)

This commit is contained in:
OpenGenesis (MPL 2.0) authored and GitHub committed 2026-10-13 23:32:40 +02:00
1 parent 689c65ce9f
commit 16d7069690
7 files changed
+204 -1

No files matched your search

+4
View File
@@ -459,6 +459,10 @@ jobs:
shell: bash
run: dotnet build --configuration Release OpenSim.sln
- name: Runtime regression cross-region llListen delivery (two scenes)
shell: bash
run: dotnet run --configuration Release --project tools/ci/CrossRegionListenRuntimeRegression/CrossRegionListenRuntimeRegression.csproj
- name: Runtime LSL core conformance (0.9.3.11)
shell: bash
run: dotnet run --configuration Release --project tools/ci/LslConformanceRegression/LslConformanceRegression.csproj
+8 -1
View File
@@ -42,9 +42,16 @@ namespace OpenSim.Tests.Common
{
public class TestClient : IClientAPI, IClientCore
{
// Keep the test transport synchronized with the viewer geometry
// properties added to the production IClientAPI.
public float FOV { get; set; }
public int viewHeight { get; set; }
public int viewWidth { get; set; }
public ViewerFlags ViewerFlags { get; private set; }
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.AutoReset);
private Scene m_scene;
@@ -59,6 +59,11 @@ namespace OpenSim.Tests.Common
return items;
}
public XInventoryFolder[] GetFolder(string field, string val)
{
return GetFolders(new string[] { field }, new string[] { val });
}
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
{
// Console.WriteLine(
@@ -79,6 +79,28 @@ erzeugen; bei fehlendem NexBus funktioniert der lokale Fall weiterhin.
zwei Würfeln mit `llListen`, Grenzabstand 5 m und Out-of-Range-Test
bei >20 m nötig.
## Automatisierter Zwei-Regionen-Laufzeittest
`tools/ci/CrossRegionListenRuntimeRegression` initialisiert zwei echte
OpenSimulator-`Scene`-Instanzen in einem Prozess, mit einem gemeinsamen
`ChatModule`, unabhängigen `WorldCommModule`-Instanzen, Avatar-
`TestClient` und zwei Script-Listenern auf der Nachbarregion.
Es werden unter anderem die korrekte Weiterleitung von öffentlichem
`Beep` und `/7 Beep`, exakt ein `listen`-Ereignis je Würfel, der
Nachrichtenfilter, die 20-Meter-Grenze und die 10-Meter-`Whisper`-
Reichweite tatsächlich ausgeführt und geprüft.
Der Test läuft **nach** dem CI-Release-Build und verwendet die gerade
kompilierten Server-Assemblies. Veraltete Test-Mocks wurden für das
aktuelle `IClientAPI`, `IXInventoryData` und .NET 8 aktualisiert.
Die beiden anderen, hier nicht benötigten Legacy-Mocks sind aus
diesem isolierten Testprojekt ausgeschlossen.
**Abgrenzung:** Dieser PASS deckt nur benachbarte Regionen im selben
Simulatorprozess ab. NexBus-Transport über zwei reale Simulatorprozesse,
Viewer-Verhalten und Live-Skripte bleiben separate CHAT01/CHAT02-Gates.
## CHAT01/CHAT02: Reproduzierbarer Inworld-Test
Benutze `tools/diagnostics/ogl_cross_region_chat_smoke.lsl`.
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>OpenSim.Tests.Common</AssemblyName>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<NoWarn>CS0067;CS0436</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Content Include="../../../bin/data/avataranimations.xml" Link="data/avataranimations.xml" CopyToOutputDirectory="PreserveNewest" />
<Compile Include="../../../OpenSim/Tests/Common/**/*.cs"
Exclude="../../../OpenSim/Tests/Common/**/obj/**;../../../OpenSim/Tests/Common/**/bin/**;../../../OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs;../../../OpenSim/Tests/Common/Mock/MockScriptEngine.cs" />
<!-- The OpenSim test helpers predate modern SDK projects and reference
runtime service assemblies from the built simulator distribution. -->
<LocalAssemblies Include="../../../bin/*.dll" />
<Reference Include="@(LocalAssemblies->'%(FullPath)')">
<Private>true</Private>
</Reference>
</ItemGroup>
</Project>
@@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.CoreModules.Avatar.Chat;
using OpenSim.Region.CoreModules.Scripting.WorldComm;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
internal static class Program
{
private static int m_checks;
private static void Check(bool ok, string name)
{
++m_checks;
if (!ok) throw new InvalidOperationException("Cross-region llListen: " + name);
}
public static int Main()
{
// SceneHelpers loads local OpenSim test data plugins by DLL name.
Environment.CurrentDirectory = AppContext.BaseDirectory;
try
{
Run();
Console.WriteLine("Cross-region llListen (real ChatModule + WorldCommModule): PASS (" +
m_checks + " checks)");
return 0;
}
catch (Exception error)
{
Console.Error.WriteLine("Cross-region llListen runtime: FAIL\n" + error);
return 1;
}
}
private static void Run()
{
SceneHelpers setup = new SceneHelpers();
TestScene west = setup.SetupScene("Chat West", UUID.Random(), 1000, 1010);
TestScene east = setup.SetupScene("Chat East", UUID.Random(), 1001, 1010);
IniConfigSource config = new IniConfigSource();
config.AddConfig("Chat");
config.AddConfig("LL-Functions");
ChatModule chat = new ChatModule();
WorldCommModule receiver = new WorldCommModule();
WorldCommModule local = new WorldCommModule();
SceneHelpers.SetupSceneModules(new Scene[] { west, east }, config, chat);
SceneHelpers.SetupSceneModules(west, config, receiver);
SceneHelpers.SetupSceneModules(east, config, local);
UUID avatarId = UUID.Random();
ScenePresence speaker = SceneHelpers.AddScenePresence(east, avatarId);
speaker.Flying = true;
speaker.AbsolutePosition = new Vector3(3, 128, 25);
TestClient client = (TestClient)speaker.ControllingClient;
SceneObjectGroup cubeA = SceneHelpers.AddSceneObject(west, "cube A", UUID.Random());
SceneObjectGroup cubeB = SceneHelpers.AddSceneObject(west, "cube B", UUID.Random());
cubeA.AbsolutePosition = new Vector3(253, 128, 25);
cubeB.AbsolutePosition = new Vector3(244, 128, 25);
UUID scriptA = UUID.Random();
UUID scriptB = UUID.Random();
Check(receiver.Listen(scriptA, cubeA.RootPart.UUID, 0, "", UUID.Zero, "Beep") > 0,
"cube A public listen registration");
Check(receiver.Listen(scriptB, cubeB.RootPart.UUID, 0, "", UUID.Zero, "Beep") > 0,
"cube B public listen registration");
Check(receiver.Listen(scriptA, cubeA.RootPart.UUID, 7, "", UUID.Zero, "Beep") > 0,
"cube A private listen registration");
Check(receiver.Listen(scriptB, cubeB.RootPart.UUID, 7, "", UUID.Zero, "Beep") > 0,
"cube B private listen registration");
Dictionary<string, int> hits = new Dictionary<string, int>();
west.EventManager.OnScriptListenEvent +=
(id, channel, name, source, message) =>
{
string key = id + ":" + channel;
hits[key] = hits.TryGetValue(key, out int previous) ? previous + 1 : 1;
Check(source == avatarId, "sender identity preserved");
Check(message == "Beep", "message payload preserved");
};
int GetHits(UUID script, int channel) =>
hits.TryGetValue(script + ":" + channel, out int count) ? count : 0;
Check(client.Chat(0, ChatTypeEnum.Say, "Beep"), "border chat dispatch");
Check(GetHits(scriptA, 0) == 1 && GetHits(scriptB, 0) == 1,
"both cubes heard border say exactly once");
Check(client.Chat(7, ChatTypeEnum.Say, "Beep"), "private border chat dispatch");
Check(GetHits(scriptA, 7) == 1 && GetHits(scriptB, 7) == 1,
"both cubes heard private channel exactly once");
client.Chat(0, ChatTypeEnum.Say, "NotBeep");
Check(GetHits(scriptA, 0) == 1 && GetHits(scriptB, 0) == 1,
"message filter still applied");
speaker.AbsolutePosition = new Vector3(30, 128, 25);
client.Chat(0, ChatTypeEnum.Say, "Beep");
client.Chat(7, ChatTypeEnum.Say, "Beep");
Check(GetHits(scriptA, 0) == 1 && GetHits(scriptB, 0) == 1 &&
GetHits(scriptA, 7) == 1 && GetHits(scriptB, 7) == 1,
"beyond 20m: no listen delivery");
speaker.AbsolutePosition = new Vector3(3, 128, 25);
client.Chat(0, ChatTypeEnum.Whisper, "Beep");
Check(GetHits(scriptA, 0) == 2 && GetHits(scriptB, 0) == 1,
"10m whisper correctly reaches near cube only");
client.Chat(0, ChatTypeEnum.Region, "Beep");
Check(GetHits(scriptA, 0) == 2 && GetHits(scriptB, 0) == 1,
"regionwide chat not relayed to neighbour listeners");
receiver.RemoveRegion(west);
client.Chat(0, ChatTypeEnum.Say, "Beep");
Check(GetHits(scriptA, 0) == 2 && GetHits(scriptB, 0) == 1,
"region removal detaches script listener delivery");
local.RemoveRegion(east);
chat.RemoveRegion(west);
chat.RemoveRegion(east);
}
}
+16
View File
@@ -60,4 +60,20 @@ doc=read("doc/NexVerse/CROSS_REGION_LSL_CHAT_09312.md")
for marker in ("CHAT01/CHAT02:", "ogl_cross_region_chat_smoke.lsl",
"zwei unabhängigen OpenSim-Prozessen", "NexBus deaktiviert"):
assert marker in doc, "missing live acceptance step: " + marker
runtime=read("tools/ci/CrossRegionListenRuntimeRegression/Program.cs")
runtime_project=read("tools/ci/CrossRegionListenRuntimeRegression/CrossRegionListenRuntimeRegression.csproj")
workflow=read(".github/workflows/nexjast-ci.yml")
for marker in (
"SceneHelpers.SetupSceneModules(new Scene[] { west, east }, config, chat)",
"receiver.Listen(scriptA,",
"receiver.Listen(scriptB,",
"client.Chat(0, ChatTypeEnum.Say, \"Beep\")",
"client.Chat(7, ChatTypeEnum.Say, \"Beep\")",
"client.Chat(0, ChatTypeEnum.Whisper, \"Beep\")",
"beyond 20m: no listen delivery",
"both cubes heard private channel exactly once",
):
assert marker in runtime, "missing executed llListen regression: " + marker
assert "OpenSim.Tests.Common" in runtime_project
assert "Runtime regression cross-region llListen delivery" in workflow
print("OGL cross-region chat wiring and fail-closed NexBus configuration: OK")