Commit 1afa6e260e

Andrew Kelley <andrew@ziglang.org>
2025-01-14 06:00:17
build: respect -Duse-llvm option when doing behavior tests
1 parent 4cc9cfa
Changed files (2)
test/tests.zig
@@ -1375,6 +1375,7 @@ const ModuleTestOptions = struct {
     skip_single_threaded: bool,
     skip_non_native: bool,
     skip_libc: bool,
+    use_llvm: ?bool = null,
     max_rss: usize = 0,
     no_builtin: bool = false,
     build_options: ?*std.Build.Step.Options = null,
@@ -1411,6 +1412,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
         if (options.skip_single_threaded and test_target.single_threaded == true)
             continue;
 
+        if (options.use_llvm) |use_llvm| {
+            if (test_target.use_llvm != use_llvm) continue;
+        }
+
         // TODO get compiler-rt tests passing for self-hosted backends.
         if ((target.cpu.arch != .x86_64 or target.ofmt != .elf) and
             test_target.use_llvm == false and mem.eql(u8, options.name, "compiler-rt"))
build.zig
@@ -447,6 +447,7 @@ pub fn build(b: *std.Build) !void {
         .skip_single_threaded = skip_single_threaded,
         .skip_non_native = skip_non_native,
         .skip_libc = skip_libc,
+        .use_llvm = use_llvm,
         .max_rss = 1 * 1024 * 1024 * 1024,
     }));
 
@@ -462,6 +463,7 @@ pub fn build(b: *std.Build) !void {
         .skip_single_threaded = true,
         .skip_non_native = skip_non_native,
         .skip_libc = skip_libc,
+        .use_llvm = use_llvm,
     }));
 
     test_modules_step.dependOn(tests.addModuleTests(b, .{
@@ -476,6 +478,7 @@ pub fn build(b: *std.Build) !void {
         .skip_single_threaded = true,
         .skip_non_native = skip_non_native,
         .skip_libc = true,
+        .use_llvm = use_llvm,
         .no_builtin = true,
     }));
 
@@ -491,6 +494,7 @@ pub fn build(b: *std.Build) !void {
         .skip_single_threaded = true,
         .skip_non_native = skip_non_native,
         .skip_libc = true,
+        .use_llvm = use_llvm,
         .no_builtin = true,
     }));
 
@@ -506,6 +510,7 @@ pub fn build(b: *std.Build) !void {
         .skip_single_threaded = skip_single_threaded,
         .skip_non_native = skip_non_native,
         .skip_libc = skip_libc,
+        .use_llvm = use_llvm,
         // I observed a value of 4572626944 on the M2 CI.
         .max_rss = 5029889638,
     }));