Test suite: add --config-dir isolation, --smoke-test alias, and a cold-start/close gate step

Adopted from Andre's RemSound-smoke-test-agent-brief.md - the gaps our pack didn't
already cover:

- --config-dir <folder>: redirect ALL user state (config, profiles, logs, cue
  sounds) to an explicit folder for this process only, applied at the very start of
  Program.Main before the layout migration runs. Lets a test exercise a real build
  without touching the user's live settings (the brief's safety rule 1). Works with
  every command. AppConfig gains SetUserDataDirectoryOverride / an override on
  UserDataDirectory; CommandLine.TryGetConfigDir parses it early.
- --smoke-test / --smoketest: alias for --selftest, matching the brief's vocabulary.
- run-tests.ps1: a cold-start + clean-close smoke (brief baseline steps 3-4) -
  launches the GUI minimized against an isolated --config-dir, confirms it stays up,
  that it used the isolated folder (real settings untouched), and that --close shuts
  it down with no orphan process. SKIPs cleanly if a RemSound instance is already
  running (machine-wide single-instance lock).

Manual + --help updated for both switches.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-06-12 23:12:22 +01:00
co-authored by Claude Opus 4.8
parent 141c5e8ce1
commit 832ed40bf7
6 changed files with 93 additions and 5 deletions
+17 -1
View File
@@ -226,7 +226,23 @@ public sealed class AppConfig
/// / the earlier <c>config\</c> folder so the install root stays tidy and the auto-updater can
/// exclude one folder to leave ALL user state (including custom cue WAVs) untouched.</summary>
public const string UserDataFolderName = "user settings and logs";
public static string UserDataDirectory => Path.Combine(AppContext.BaseDirectory, UserDataFolderName);
/// <summary>Process-wide override for <see cref="UserDataDirectory"/>. Null = the default
/// folder next to the exe. Set once at startup from the <c>--config-dir</c> switch so the test
/// suite (and a portable layout) can point ALL user state - config, profiles, logs, cue sounds -
/// at an explicit throwaway folder without touching the user's real settings. Must be set before
/// anything reads config/profiles/logs/sounds.</summary>
private static string? _userDataDirectoryOverride;
/// <summary>Redirect every user-state folder to <paramref name="path"/> for this process only.
/// Call before <see cref="MigrateLegacyLayoutIfNeeded"/> / any config read. Idempotent.</summary>
public static void SetUserDataDirectoryOverride(string path)
{
if (!string.IsNullOrWhiteSpace(path)) _userDataDirectoryOverride = Path.GetFullPath(path);
}
public static string UserDataDirectory =>
_userDataDirectoryOverride ?? Path.Combine(AppContext.BaseDirectory, UserDataFolderName);
/// <summary>Where the per-machine log files are written.</summary>
public static string LogsDirectory => Path.Combine(UserDataDirectory, "logs");