From 457e906bb36f416627ae142c5add5e95ec803582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Fri, 23 Oct 2026 11:03:41 +0200 Subject: [PATCH] build: add -Dskip-cbe option for skipping CBE tests --- build.zig | 7 +++++++ test/tests.zig | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/build.zig b/build.zig index ed8b16da95710fd2d401cc9fc0c59c08b3462369..ffc7b37d589a99a0c00d13621be289b7d45ea37b 100644 --- a/build.zig +++ b/build.zig @@ -129,6 +129,7 @@ pub fn build(b: *std.Build) !void { const skip_darwin = b.option(bool, "skip-darwin", "Main test suite skips targets with darwin OSs") orelse false; const skip_linux = b.option(bool, "skip-linux", "Main test suite skips targets with linux OS") orelse false; const skip_llvm = b.option(bool, "skip-llvm", "Main test suite skips targets that use LLVM backend") orelse false; + const skip_cbe = b.option(bool, "skip-cbe", "Main test suite skips targets that use C backend") orelse false; const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; @@ -532,6 +533,7 @@ pub fn build(b: *std.Build) !void { .skip_darwin = skip_darwin, .skip_linux = skip_linux, .skip_llvm = skip_llvm, + .skip_cbe = skip_cbe, .skip_libc = skip_libc, .max_rss = 4_000_000_000, })); @@ -558,6 +560,7 @@ pub fn build(b: *std.Build) !void { .skip_darwin = skip_darwin, .skip_linux = skip_linux, .skip_llvm = skip_llvm, + .skip_cbe = skip_cbe, .skip_libc = true, .no_builtin = true, .max_rss = 4_000_000_000, @@ -585,6 +588,7 @@ pub fn build(b: *std.Build) !void { .skip_darwin = skip_darwin, .skip_linux = skip_linux, .skip_llvm = skip_llvm, + .skip_cbe = skip_cbe, .skip_libc = skip_libc, .max_rss = 9_600_000_000, })); @@ -611,6 +615,7 @@ pub fn build(b: *std.Build) !void { .skip_darwin = skip_darwin, .skip_linux = skip_linux, .skip_llvm = skip_llvm, + .skip_cbe = skip_cbe, .skip_libc = skip_libc, .no_builtin = true, .max_rss = 4_000_000_000, @@ -658,6 +663,7 @@ pub fn build(b: *std.Build) !void { .skip_darwin = skip_darwin, .skip_linux = skip_linux, .skip_llvm = skip_llvm, + .skip_cbe = skip_cbe, .max_rss = 4_300_000_000, })); test_step.dependOn(tests.addLinkTests(b, .{ @@ -798,6 +804,7 @@ pub fn build(b: *std.Build) !void { .skip_darwin = skip_darwin, .skip_linux = skip_linux, .skip_llvm = skip_llvm, + .skip_cbe = skip_cbe, .llvm_has_m68k = llvm_has_m68k, .llvm_has_csky = llvm_has_csky, .llvm_has_arc = llvm_has_arc, diff --git a/test/tests.zig b/test/tests.zig index 2ae4b8c9fb7f1627fcfdd428241d3eb0d645ad10..0dffc39e323e7b5a640ad0d90edf7e6659fa313a 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -2508,6 +2508,7 @@ pub const ModuleTestOptions = struct { skip_darwin: bool, skip_linux: bool, skip_llvm: bool, + skip_cbe: bool, skip_libc: bool, max_rss: u64 = 0, no_builtin: bool = false, @@ -2579,6 +2580,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { const would_use_llvm = wouldUseLlvm(test_target.use_llvm, test_target.target, test_target.optimize_mode); if (options.skip_llvm and would_use_llvm) continue; + if (options.skip_cbe and target.ofmt == .c) continue; const triple_txt = resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"); @@ -2854,6 +2856,7 @@ const CAbiTestOptions = struct { skip_darwin: bool, skip_linux: bool, skip_llvm: bool, + skip_cbe: bool, max_rss: u64 = 0, }; @@ -2886,6 +2889,7 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step { for (options.optimize_modes) |optimize_mode| { const would_use_llvm = wouldUseLlvm(c_abi_target.use_llvm, c_abi_target.target, optimize_mode); if (options.skip_llvm and would_use_llvm) continue; + if (options.skip_cbe and target.ofmt == .c) continue; const test_mod = b.createModule(.{ .root_source_file = b.path("test/c_abi/main.zig"), @@ -3071,6 +3075,7 @@ pub const RunnerOptions = struct { skip_darwin: bool, skip_linux: bool, skip_llvm: bool, + skip_cbe: bool, llvm_has_m68k: bool, llvm_has_csky: bool, llvm_has_arc: bool, @@ -3147,6 +3152,9 @@ pub fn addRunnerTests( .xtensa => if (!options.llvm_has_xtensa) continue, } } + if (test_target.backend == .cbe) { + if (options.skip_cbe) continue; + } const target_str = b.fmt("{f}", .{test_target}); -- 2.54.0