Commit 3539cad176

Alex Rønne Petersen <alex@alexrp.com>
2025-10-04 20:53:19
test: remove standalone sigpipe test
This should be restored, but there's no point keeping disabled code that's just going to bitrot. https://github.com/ziglang/zig/issues/25466
1 parent d9cd4d0
Changed files (3)
test
test/standalone/sigpipe/breakpipe.zig
@@ -1,19 +0,0 @@
-const std = @import("std");
-const build_options = @import("build_options");
-
-pub const std_options: std.Options = .{
-    .keep_sigpipe = build_options.keep_sigpipe,
-};
-
-pub fn main() !void {
-    const pipe = try std.posix.pipe();
-    std.posix.close(pipe[0]);
-    _ = std.posix.write(pipe[1], "a") catch |err| switch (err) {
-        error.BrokenPipe => {
-            try std.fs.File.stdout().writeAll("BrokenPipe\n");
-            std.posix.exit(123);
-        },
-        else => |e| return e,
-    };
-    unreachable;
-}
test/standalone/sigpipe/build.zig
@@ -1,44 +0,0 @@
-const std = @import("std");
-const posix = std.posix;
-
-pub fn build(b: *std.build.Builder) !void {
-    const test_step = b.step("test", "Test it");
-    b.default_step = test_step;
-
-    // TODO signal handling code has no business being in a build script.
-    // this logic needs to move to a file called parent.zig which is
-    // added as an executable.
-
-    //if (!std.os.have_sigpipe_support) {
-    //    return;
-    //}
-
-    // This test runs "breakpipe" as a child process and that process
-    // depends on inheriting a SIGPIPE disposition of "default".
-    {
-        const act = posix.Sigaction{
-            .handler = .{ .handler = posix.SIG.DFL },
-            .mask = posix.sigemptyset(),
-            .flags = 0,
-        };
-        try posix.sigaction(posix.SIG.PIPE, &act, null);
-    }
-
-    for ([_]bool{ false, true }) |keep_sigpipe| {
-        const options = b.addOptions();
-        options.addOption(bool, "keep_sigpipe", keep_sigpipe);
-        const exe = b.addExecutable(.{
-            .name = "breakpipe",
-            .root_source_file = b.path("breakpipe.zig"),
-        });
-        exe.addOptions("build_options", options);
-        const run = b.addRunArtifact(exe);
-        if (keep_sigpipe) {
-            run.addCheck(.{ .expect_term = .{ .Signal = std.posix.SIG.PIPE } });
-        } else {
-            run.addCheck(.{ .expect_stdout_exact = "BrokenPipe\n" });
-            run.addCheck(.{ .expect_term = .{ .Exited = 123 } });
-        }
-        test_step.dependOn(&run.step);
-    }
-}
test/standalone/build.zig.zon
@@ -138,11 +138,6 @@
         .issue_12706 = .{
             .path = "issue_12706",
         },
-        // TODO This test is disabled for doing naughty things in the build script.
-        // The logic needs to get moved to a child process instead of build.zig.
-        //.sigpipe = .{
-        //    .path = "sigpipe",
-        //},
         .strip_empty_loop = .{
             .path = "strip_empty_loop",
         },