From 933bfd4282f99e7f59ab025bbff53454c0ae2f5c Mon Sep 17 00:00:00 2001 From: Justus Klausecker Date: Fri, 6 Mar 2026 00:08:13 +0100 Subject: [PATCH] tests: pass on `-Dsanitize-thread` to unit tests --- build.zig | 5 +++++ test/tests.zig | 2 ++ 2 files changed, 7 insertions(+) diff --git a/build.zig b/build.zig index 06ba1aab65..0fa924e7cd 100644 --- a/build.zig +++ b/build.zig @@ -478,6 +478,7 @@ pub fn build(b: *std.Build) !void { .desc = "Run the behavior tests", .optimize_modes = optimization_modes, .include_paths = &.{}, + .sanitize_thread = sanitize_thread, .skip_single_threaded = skip_single_threaded, .skip_non_native = skip_non_native, .test_only = test_only, @@ -503,6 +504,7 @@ pub fn build(b: *std.Build) !void { .desc = "Run the compiler_rt tests", .optimize_modes = optimization_modes, .include_paths = &.{}, + .sanitize_thread = sanitize_thread, .skip_single_threaded = true, .skip_non_native = skip_non_native, .test_only = test_only, @@ -529,6 +531,7 @@ pub fn build(b: *std.Build) !void { .desc = "Run the zig libc implementation unit tests", .optimize_modes = optimization_modes, .include_paths = &.{}, + .sanitize_thread = sanitize_thread, .skip_single_threaded = true, .skip_non_native = skip_non_native, .test_only = test_only, @@ -555,6 +558,7 @@ pub fn build(b: *std.Build) !void { .desc = "Run the standard library tests", .optimize_modes = optimization_modes, .include_paths = &.{}, + .sanitize_thread = sanitize_thread, .skip_single_threaded = skip_single_threaded, .skip_non_native = skip_non_native, .test_only = test_only, @@ -578,6 +582,7 @@ pub fn build(b: *std.Build) !void { .root_module = addCompilerMod(b, .{ .optimize = optimize, .target = target, + .sanitize_thread = sanitize_thread, .single_threaded = single_threaded, }), .filters = test_filters, diff --git a/test/tests.zig b/test/tests.zig index 0eaf0b1eaf..5e0d22682e 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -2334,6 +2334,7 @@ pub const ModuleTestOptions = struct { skip_libc: bool, max_rss: usize = 0, no_builtin: bool = false, + sanitize_thread: ?bool = null, build_options: ?*Step.Options = null, pub const TestOnly = union(enum) { @@ -2462,6 +2463,7 @@ fn addOneModuleTest( .link_libc = test_target.link_libc, .pic = test_target.pic, .strip = test_target.strip, + .sanitize_thread = options.sanitize_thread, .single_threaded = test_target.single_threaded, }), .max_rss = max_rss,