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.
This commit is contained in:
Andrew Kelley 2023-03-10 14:32:49 -07:00
parent 2c326c87b1
commit 2956232b42
2 changed files with 6 additions and 1 deletions

View File

@ -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,
},

View File

@ -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(.{