aboutsummaryrefslogtreecommitdiff
path: root/test/standalone/empty_env/build.zig
blob: 592566d62ccf5541fdc8148e00cf0d96c027bc6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const std = @import("std");
const builtin = @import("builtin");

pub fn build(b: *std.Build) void {
    const test_step = b.step("test", "Test it");
    b.default_step = test_step;

    const optimize: std.builtin.OptimizeMode = .Debug;

    if (builtin.os.tag == .windows and std.process.hasEnvVarConstant("ConEmuHWND")) {
        // ConEmu injects environment variables into processes before they are executed
        // depending on user settings. This obviously invalidates the test, so skipping
        // it is the best option.
        return;
    }

    if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64) {
        // https://github.com/ziglang/zig/issues/13685
        return;
    }

    const main = b.addExecutable(.{
        .name = "main",
        .root_module = b.createModule(.{
            .root_source_file = b.path("main.zig"),
            .target = b.graph.host,
            .optimize = optimize,
        }),
    });

    const run = b.addRunArtifact(main);
    run.clearEnvironment();
    run.disable_zig_progress = true;

    test_step.dependOn(&run.step);
}