Files
ddidderr 8af6ab68d3 fix: C allocator contract, shadertoy overloads/MSL stride, minidumps
Closes the remaining library rows of the final completeness audit
(docs/rewrite/notes/final-Z3.md):
- libghostty-vt: OSC parser storage goes through the caller-supplied C
  allocator via a ByteStorage abstraction; ghostty_osc_new reports
  GHOSTTY_OUT_OF_MEMORY and failed grows invalidate the OSC like Zig.
  Tested with a counting/failing/limiting C allocator.
- shadertoy: sampler parameter rewriting is keyed by full signature so
  overloads work; the Metal uniform block keeps std140 strides for
  iChannelTime[4] (MSL offsets checked against the upload layout).
- tripwire.zig ported (named trip points, hit counts, verification) and
  used to port the previously skipped allocation-failure tests that have
  a fallible Rust path; the rest are documented.
- crash: fatal signals capture siginfo + registers and a forked helper
  writes a minidump (minidump-writer) as an envelope attachment, like
  sentry-native/Breakpad; tests parse it with the minidump crate.
- kitty LoadingImage::debug_dump (debug builds) and the Darwin
  Instruments signpost around benchmark runs.

Test Plan:
- cargo test -p ghostty-vt-capi --test c_allocator
- cargo test -p ghostty-crash --test minidump
2026-10-12 08:14:02 +02:00

28 lines
939 B
Rust

//! Compiles `tests/c/alloc_test.c` (a counting / failing / limiting C
//! allocator driving the OSC parser) against the Rust `libghostty-vt`.
#![cfg(unix)]
#![allow(clippy::unwrap_used)]
mod common;
use std::process::Command;
#[test]
fn c_allocator_governs_osc_parser_storage() {
let lib = common::install_native_lib();
let scratch = common::scratch_dir("c_allocator");
let src = common::manifest_dir().join("tests/c/alloc_test.c");
let exe = scratch.join("alloc_test");
// No -DNDEBUG: the test relies on assert().
common::compile_c(&lib, &[&src], &exe, &["-Wall", "-O0"]);
let out = Command::new(&exe).output().expect("run alloc_test");
assert!(
out.status.success(),
"alloc_test failed: {:?}\n{}{}",
out.status,
String::from_utf8_lossy(&out.stdout),
String::from_utf8_lossy(&out.stderr)
);
assert_eq!(String::from_utf8(out.stdout).unwrap(), "ok\n");
}