Commit 181a89e728

Ali Cheraghi <alichraghi@proton.me>
2025-02-20 22:39:46
build: add spirv to test matrix
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
1 parent a0eec9c
Changed files (2)
lib
test
lib/compiler/test_runner.zig
@@ -22,6 +22,11 @@ const crippled = switch (builtin.zig_backend) {
 pub fn main() void {
     @disableInstrumentation();
 
+    if (builtin.cpu.arch.isSpirV()) {
+        // SPIR-V needs an special test-runner
+        return;
+    }
+
     if (crippled) {
         return mainSimple() catch @panic("test failure\n");
     }
test/tests.zig
@@ -140,6 +140,15 @@ const test_targets = blk: {
             .use_llvm = false,
             .use_lld = false,
         },
+        .{
+            .target = std.Target.Query.parse(.{
+                .arch_os_abi = "spirv64-vulkan",
+                .cpu_features = "vulkan_v1_2+int8+int16+int64+float16+float64",
+            }) catch unreachable,
+            .use_llvm = false,
+            .use_lld = false,
+            .skip_modules = &.{ "c-import", "universal-libc", "std" },
+        },
         // https://github.com/ziglang/zig/issues/13623
         //.{
         //    .target = .{
@@ -1583,6 +1592,10 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
             run.setName(b.fmt("run test {s}", .{qualified_name}));
 
             step.dependOn(&run.step);
+        } else if (target.cpu.arch.isSpirV()) {
+            // Don't run spirv binaries
+            _ = these_tests.getEmittedBin();
+            step.dependOn(&these_tests.step);
         } else {
             const run = b.addRunArtifact(these_tests);
             run.skip_foreign_checks = true;