Commit 2956232b42

Andrew Kelley <andrew@ziglang.org>
2023-03-10 22:32:49
standalone tests: avoid running on strange target
Without this, aarch64-linux tried to compile this test for aarch64-windows with the same CPU settings, which is not an intended test combination.
1 parent 2c326c8
Changed files (2)
test/standalone.zig
@@ -5,6 +5,8 @@ pub const SimpleCase = struct {
     target: std.zig.CrossTarget = .{},
     is_test: bool = false,
     is_exe: bool = true,
+    /// Run only on this OS.
+    os_filter: ?std.Target.Os.Tag = null,
 };
 
 pub const BuildCase = struct {
@@ -50,7 +52,7 @@ pub const simple_cases = [_]SimpleCase{
 
     .{
         .src_path = "test/standalone/issue_9402/main.zig",
-        .target = .{ .os_tag = .windows },
+        .os_filter = .windows,
         .link_libc = true,
     },
 
test/tests.zig
@@ -571,6 +571,9 @@ pub fn addStandaloneTests(
     for (standalone.simple_cases) |case| {
         for (optimize_modes) |optimize| {
             if (!case.all_modes and optimize != .Debug) continue;
+            if (case.os_filter) |os_tag| {
+                if (os_tag != builtin.os.tag) continue;
+            }
 
             if (case.is_exe) {
                 const exe = b.addExecutable(.{