From 4b1e292ae448ab519d0681b49da7420130b5f312 Mon Sep 17 00:00:00 2001 From: Manlio Perillo Date: Sat, 29 Apr 2023 16:25:58 +0200 Subject: test: fix deadlock on windows when running tests The deadlock was caused by setting stdout behavior to ignore, when spawning the patch command. When the patch command writes to devnull it causes some errors and a deadlock. The cause of the bug is probably Zig using `\Device\Null` from `ntdll` while git-bash uses `NUL` from `kernel32`. --- test/tests.zig | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/tests.zig b/test/tests.zig index f91c4fd..f166fc2 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -336,7 +336,6 @@ fn heal(allocator: Allocator, exercises: []const Exercise, outdir: []const u8) ! const argv = &.{ "patch", "-i", patch, "-o", output, file }; var child = std.process.Child.init(argv, allocator); - child.stdout_behavior = .Ignore; // the POSIX standard says that stdout is not used _ = try child.spawnAndWait(); } } -- cgit v1.2.3 From 11d2279f4fb736c701c23c6420cb82657e2e61f4 Mon Sep 17 00:00:00 2001 From: Manlio Perillo Date: Sat, 29 Apr 2023 16:50:28 +0200 Subject: test: make the patch command silent The POSIX standard says that the patch command should not use stdout, but GNU patch writes the message: patching file patches/healed/xxx.zig (read from exercises/xxx.zig). Add the -s flag to suppress these messages. Note that the heal function from test/tests.zig is called when running `zig build -Dhealed` because it is executed in the configure phase. --- test/tests.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/tests.zig b/test/tests.zig index f166fc2..f9ad9c4 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -333,7 +333,7 @@ fn heal(allocator: Allocator, exercises: []const Exercise, outdir: []const u8) ! }; const output = try join(allocator, &.{ outdir, ex.main_file }); - const argv = &.{ "patch", "-i", patch, "-o", output, file }; + const argv = &.{ "patch", "-i", patch, "-o", output, "-s", file }; var child = std.process.Child.init(argv, allocator); _ = try child.spawnAndWait(); -- cgit v1.2.3