terminal: disable integrity checks under Valgrind

pull/8319/head
Mitchell Hashimoto 2025-08-20 14:05:09 -07:00
parent fec0defd04
commit 4fa7b412d4
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
4 changed files with 16 additions and 0 deletions

View File

@ -1078,3 +1078,4 @@ jobs:
- name: valgrind
run: |
nix develop -c zig build test-valgrind -Dtest-filter="OSC"
nix develop -c zig build test-valgrind -Dtest-filter="Parser"

View File

@ -233,6 +233,11 @@ pub fn deinit(self: *Screen) void {
/// ensure they're also calling page integrity checks if necessary.
pub fn assertIntegrity(self: *const Screen) void {
if (build_config.slow_runtime_safety) {
// We don't run integrity checks on Valgrind because its soooooo slow,
// Valgrind is our integrity checker, and we run these during unit
// tests (non-Valgrind) anyways so we're verifying anyways.
if (std.valgrind.runningOnValgrind() > 0) return;
assert(self.cursor.x < self.pages.cols);
assert(self.cursor.y < self.pages.rows);

View File

@ -346,6 +346,11 @@ pub const Page = struct {
// used for the same reason as styles above.
//
// We don't run integrity checks on Valgrind because its soooooo slow,
// Valgrind is our integrity checker, and we run these during unit
// tests (non-Valgrind) anyways so we're verifying anyways.
if (std.valgrind.runningOnValgrind() > 0) return;
if (build_config.slow_runtime_safety) {
if (self.pause_integrity_checks > 0) return;
}

View File

@ -454,6 +454,11 @@ const SlidingWindow = struct {
fn assertIntegrity(self: *const SlidingWindow) void {
if (comptime !std.debug.runtime_safety) return;
// We don't run integrity checks on Valgrind because its soooooo slow,
// Valgrind is our integrity checker, and we run these during unit
// tests (non-Valgrind) anyways so we're verifying anyways.
if (std.valgrind.runningOnValgrind() > 0) return;
// Integrity check: verify our data matches our metadata exactly.
var meta_it = self.meta.iterator(.forward);
var data_len: usize = 0;