Files
recordingtest/src/Recordingtest.Runner/Program.cs
minsung 190cc6e596 feat: engine-state normalizer profile + sort_array_elements rule (#10)
- Rules.SortArrayElements: sort JSON arrays lexicographically (post-mask_guids order-independence)
- Normalizer output: UnsafeRelaxedJsonEscaping to preserve <GUID>/<TS>/<VOLATILE> tokens
- profiles/engine-state.yaml: normalize_paths + mask_guids + sort_array_elements + round_floats(2dp) + sort_json_keys
- RunnerOptions.SidecarProfile: default "engine-state", overridable via --sidecar-profile
- TestRunner.CaptureAndDiffSidecar: uses SidecarProfile instead of main Profile
- 4 new normalizer tests (136 total)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 16:28:57 +09:00

63 lines
2.5 KiB
C#

namespace Recordingtest.Runner;
public static class Program
{
public static int Main(string[] args)
{
var options = new RunnerOptions();
string? sidecarUrl = null;
bool noSidecar = false;
for (int i = 0; i < args.Length; i++)
{
switch (args[i])
{
case "--scenarios": options.ScenariosDir = args[++i]; break;
case "--baselines": options.BaselinesDir = args[++i]; break;
case "--out": options.OutDir = args[++i]; break;
case "--profile": options.Profile = args[++i]; break;
case "--no-launch": options.NoLaunch = true; break;
case "--sidecar-url": sidecarUrl = args[++i]; break;
case "--no-sidecar": noSidecar = true; break;
case "--sidecar-profile": options.SidecarProfile = args[++i]; break;
case "-h":
case "--help":
Console.WriteLine("Usage: Recordingtest.Runner --scenarios <dir> --baselines <dir> --out <dir>");
Console.WriteLine(" [--profile <name>] [--no-launch]");
Console.WriteLine(" [--sidecar-url http://localhost:38080] [--no-sidecar]");
Console.WriteLine(" [--sidecar-profile engine-state]");
return 0;
}
}
if (string.IsNullOrEmpty(options.ScenariosDir) ||
string.IsNullOrEmpty(options.BaselinesDir) ||
string.IsNullOrEmpty(options.OutDir))
{
Console.Error.WriteLine("Missing required args. Use --help.");
return 2;
}
// engine-bridge v3 — default to the well-known localhost bridge port
// unless the caller explicitly opts out or overrides the URL.
IEngineStateSnapshotClient? sidecar = null;
if (!noSidecar)
{
sidecar = new HttpEngineStateSnapshotClient(
sidecarUrl ?? HttpEngineStateSnapshotClient.DefaultBaseUrl);
}
var runner = new TestRunner();
var report = runner.RunAll(
options,
new DefaultHostFactory(),
new DefaultNormalizer(),
new DefaultDiffer(),
sidecarClient: sidecar);
(sidecar as IDisposable)?.Dispose();
Console.WriteLine($"Total: {report.Total}, Passed: {report.Passed}, Failed: {report.Failed}, Errored: {report.Errored}");
return TestRunner.ToExitCode(report);
}
}