zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 933bfd4282f99e7f59ab025bbff53454c0ae2f5c (tree)
parent 823f9039f1cad8093cd276cf003a42996d39b74a
Author: Justus Klausecker <justus@klausecker.de>
Date:   Fri,  6 Mar 2026 00:08:13 +0100

tests: pass on `-Dsanitize-thread` to unit tests

Diffstat:
Mbuild.zig | 5+++++
Mtest/tests.zig | 2++
2 files changed, 7 insertions(+), 0 deletions(-)

diff --git 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 @@ -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,