tinymux/tests
Stephen Dennis c502af6192 fix(restart): preserve the -p and -e command-line values across @restart (#2199)
do_restart() rebuilds its exec argv from mudconf.pid_file and
mudconf.log_dir.  Both were read in three places and written in NONE:

    predicates.cpp   the execl                                  <- read
    engine_com.cpp   GetConfig -> DRIVER_CONFIG.pid_file         <- read
    engine_com.cpp   GetConfig -> DRIVER_CONFIG.log_dir          <- read

There is no `pid_file` or `log_dir` config directive either, so nothing in
netmux.conf could populate them.  Both are driver-owned CLI values --
driver.cpp says so outright ("pid_file is driver-owned -- set from CLI or
default") -- and the engine had no way to learn them.  So every @restart on
every site exec'd with an empty -p and -e.

Impact is quiet, which is why it lasted: a site running

    netmux -p /var/run/mux/netmux.pid

has its pidfile revert to the default netmux.pid in the working directory
after the first restart, and stops maintaining the configured path.  The
pid inside the stale file stays correct, because execve preserves it, so
nothing breaks until something else moves.  Same for -e.

The fingerprint is visible in ps on any restarted 2.14: `-p` with nothing
after it.

Fix follows #817's precedent exactly -- driver-owned strings the engine
needs, handed over at bridge init:

  - g_driver_pid_file / g_driver_log_dir replace two file-static CLI
    variables in driver.cpp (pErrorBasename was also a poor name for
    something that is a log directory).  Globals for the same reason
    g_version is one: the CDriverControl bridge is a different TU.
  - mux_IDriverControl gains GetInvocationPaths.  IID bumped D4D6 -> D4D7;
    the comment now records both bumps and why a vtable change needs one.
  - conn_bridge_init caches them into mudconf.  Safe there because
    Startup() runs after LoadGame(), so cf_init() cannot wipe them
    afterwards.  Pointers are stored, not copied: they are driver-owned
    storage that lives for the process, and nothing in the engine frees or
    reassigns either field.
  - CScriptDriverControl implements it too, returning empty strings.
    muxscript writes no pidfile and has no @restart; an invented default
    would only be wrong somewhere later.

The argv is now built dynamically and omits an option it has no value for.
-c, -p and -e are all CLI_REQUIRED, so a bare flag makes the successor log
"Option 'x' requires an argument, but none was found."  Populating the
fields alone would have left that warning for any site that supplies only
one of the two -- which is what test-scenario showed, since run.sh passes
-p and not -e.

Verified on a live restart, reading the successor's argv (execve replaces
argv and preserves the pid, so this is direct evidence):

    boot:     ./bin/netmux -c netmux.conf -p custom-name.pid -e logs
    restart:  netmux -c netmux.conf -p custom-name.pid -e logs
    ok - successor kept -p custom-name.pid
    ok - successor kept -e logs
    ok - no missing-argument warning in the log

Catch-verified by removing only the bridge caching:

    restart:  netmux -c netmux.conf -p
    not ok - successor lost the -p value
    not ok - successor lost the -e value
    not ok - successor logged a missing-argument warning:
          15:Warning: Option '-p' requires an argument, but none was found.

tests/scenario/restart_helpers.py gains the assertion; it already pays for
a restart, so this costs no extra cycle.  It skips if the server under test
was not started with -p.

Clean rebuild, since the IDriverControl vtable changed.

make test: 36 targets, 34 passed, 2 skipped (NLS), 0 failed
config: jit=yes stubslave=yes nls=no realitylvls=yes wodrealms=yes

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 11:39:34 -06:00
..
alarm test(build): track header dependencies in the standalone harnesses (#1952) 2026-08-02 00:06:02 -06:00
blob test(blob): check both committed copies of softlib.rv64, not just one 2026-08-03 16:53:45 -06:00
buildconfig test(config): state the build configuration a green run was green under (#1946) 2026-08-01 23:15:26 -06:00
codiff test(codiff): validate the host leg by running it, not by probing a symbol (#2055) 2026-08-04 15:06:16 -06:00
color_ops perf(engine): shuffle() locates each word once instead of re-walking (#2057) 2026-08-04 17:02:46 -06:00
comsys_cmdparity chore: ignore tests/comsys_cmdparity/work/ 2026-07-28 21:33:09 +00:00
comsys_conformance test(smoke): absent features skip instead of failing — Windows is green (#1641) 2026-07-28 20:48:16 -06:00
comsys_handoff fix(comsys): the module honours all five MOGRIFY hooks and CHATFORMAT (#1572) 2026-07-27 17:53:36 -06:00
comsys_mogrify fix(comsys): the module honours all five MOGRIFY hooks and CHATFORMAT (#1572) 2026-07-27 17:53:36 -06:00
config test(config): accept Phase 0's loud LIMITED at the lowered-limit case (#1751) 2026-07-29 05:59:51 -06:00
db test(build): track header dependencies in the standalone harnesses (#1952) 2026-08-02 00:06:02 -06:00
dbt fix(dbt): guard the x64 budget-check backpatch against a full code buffer 2026-08-06 06:47:42 -06:00
digest feat(#2136): flip fargs to const UTF8 * const — and convert every site the compiler surfaced 2026-08-06 14:34:23 -06:00
format test(build): track header dependencies in the standalone harnesses (#1952) 2026-08-02 00:06:02 -06:00
growth fix(jit): FOLD review — forced first application, u() oversized arm, arity ceiling (#2122) 2026-08-05 18:22:21 -06:00
hir fix(#2166): a single-input PHI is its input — emit_phi resolves it, superblock backstops 2026-08-06 20:51:31 -06:00
libmux test(libmux): track header dependencies so the new guard can fire (#1952) 2026-08-01 23:42:17 -06:00
luajit fix(lua/jit): tonumber fast path must reject int64-overflowing literals (#1866) 2026-07-31 09:20:59 -06:00
narrowing fix(engine): clamp @poor's limit and widen hasquota's stored quota (#1402) 2026-07-27 06:02:12 -06:00
netaddr test(build): track header dependencies in the standalone harnesses (#1952) 2026-08-02 00:06:02 -06:00
nfc test(nfc): add unit tests for utf8_normalize_nfc 2026-08-03 12:38:41 -06:00
nls fix(test): test-nls-plural no longer links, breaking make test (#1653, #1702) 2026-07-28 21:22:29 -06:00
parity213 Merge master into fix/1247-fmand-abort 2026-07-26 12:03:36 -06:00
perf test(perf): commit a Linux-x86_64 rvbench baseline (#2046) 2026-08-05 05:04:15 +00:00
poison test: make test-poison — run the smoke suite against a hostile allocator (#2149) 2026-08-06 10:31:50 -06:00
profile Merge pull request #2093 from brazilofmux/fix/profile-cleanup-real-pid 2026-08-05 07:46:13 -06:00
scenario fix(restart): preserve the -p and -e command-line values across @restart (#2199) 2026-08-07 11:39:34 -06:00
shacrypt feat(passwords): portable sha-crypt ($5$/$6$) on both platforms, rounds policy, safe auto-upgrade (#1962) 2026-08-02 15:08:58 -06:00
slave fix(test-slave): assert peak from the slave's own report, not a ppid sample (#1912) 2026-08-01 04:35:28 +00:00
stress test(stress): live network+queue stress harness (defensive) 2026-07-21 19:04:57 -06:00
stubslave test(stubslave): deterministic muxscript teardown-recursion regression (#1939) 2026-08-01 21:29:27 -06:00
table test(build): track header dependencies in the standalone harnesses (#1952) 2026-08-02 00:06:02 -06:00
build-msvc.sh feat(libmux): mux_table layout helpers for multi-column notifies (#1667) 2026-07-28 14:10:05 +00:00