fluffos/testsuite/clone/replace_parent.lpc
Yucong Sun 12d99317d8 Testsuite coverage round 2: ctest test named "testsuite"; save_object overflow fixed
The ctest registration is now simply `testsuite` (label too; CI steps
run `ctest -LE testsuite` / `-L testsuite`), with README/AGENTS updated.

New coverage, and what it caught:

- save_object.lpc's ".lpc" case caught a REAL heap-buffer-overflow on
  CI's clang+ASan RelWithDebInfo job: save_object() sized its buffer
  for the stripped name + ".o" but strcpy'd the UNSTRIPPED path -- the
  4-byte ".lpc" strip overflows the 2-byte ".o" headroom (the legacy
  ".c" strip fit by coincidence; DEBUGMALLOC padding hid it from local
  ASan Debug runs). Fixed with a bounded copy, plus the pre-existing
  file[len-sel] underflow read guarded. Verified in the exact failing
  configuration (clang RelWithDebInfo sanitizer: file case + full suite).

- replace_program.lpc (new; the efun had NO testsuite coverage): pins
  name matching -- extension-less resolves the inherited program's real
  .lpc file, explicit ".lpc" matches exactly, explicit ".c" of an
  .lpc-compiled parent errors, non-inherited program errors. This
  surfaced that pending replace_ob_t records tripped check_memory()
  between test files: they legitimately live until the backend's
  replace_programs() sweep, so they get a dedicated whitelisted
  TAG_REPLACE_OB (same pattern as TAG_SCRATCHPAD) instead of
  TAG_TEMPORARY.

- dual_extension.lpc: the inherit-retry loop keeps the caller's exact
  spelling (a ".c" child inheriting an unloaded parent must reload as
  ".c", not fall back to its .lpc twin -- pins load_object's
  raw-spelling retry), and function_exists() strips a real ".c" suffix.

- restore_object.lpc: ".lpc"/".c" argument spellings resolve the same
  ".o" save file.

- std/harness.lpc: self-test of the failure-recording machinery
  (record/query/pop round-trip via the new master::pop_failure(), and
  the per-assertion check counter).

Verified: testsuite x3 + ctest 297/297 (ASan Debug), full ctest
(RelWithDebInfo), and the clang RelWithDebInfo sanitizer build.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:48:48 -04:00

2 lines
93 B
Text

// Fixture for /single/tests/efuns/replace_program.lpc.
string pwhich() { return "parent"; }