-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
lib/init-exe, lib/init-lib: ensure tests runs again #15064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When running
|
On aarch64-macos, the Was this the reason why the |
The only reason I can think for the However the error also occurs when setting the |
3bdfca2
to
586856f
Compare
After commit ede5dcf (make the build runner and test runner talk to each other), the std.Build.addTest function no longer runs tests, but the build.zig files in init-exe and init-lib where not updated. Rename main_tests to lib_tests and "Run library tests" to "Run unit tests", for consistency with init-exe. Add a RunStep to exe_tests and lib_tests, using the new Build.addRunArtifact function. Remove an empty line in the addCliTests function in tests/tests.zig. Closes ziglang#15009
586856f
to
a200e9d
Compare
I have replaced the use of |
@Vexu when you have time, can you help me finding the reason for the Thanks, |
I forgot to replace, in |
@perillo Try to reduce the problem to a minimal reducible example beforehand. Then use strace to identify, if the call to fork itself fails. You might want to apply filters. If the timing itself remains unconclusive, you could try the bigger guns like ftrace https://opensource.com/article/21/7/linux-kernel-ftrace. If that still remains unconclusive, you could go deeper with the backend-instrumentation https://wiki.st.com/stm32mpu/wiki/Linux_tracing,_monitoring_and_debugging, but I doubt this will be necessary. Ideally Zig would provide |
Thanks for the suggestion. The problem is that I see only |
Here is an independent example: build.zigconst std = @import("std");
pub fn build(b: *std.Build) void {
const step = b.step("test-bug", "Test bug");
const tmp_path = b.makeTempPath();
const init_lib = b.addSystemCommand(&.{ b.zig_exe, "init-lib" });
init_lib.cwd = tmp_path;
init_lib.setName("zig init-lib");
const run_test = b.addSystemCommand(&.{ b.zig_exe, "build", "test" });
run_test.cwd = tmp_path;
run_test.setName("zig build test");
run_test.expectStdOutEqual("");
run_test.step.dependOn(&init_lib.step);
const cleanup = b.addRemoveDirTree(tmp_path);
cleanup.step.dependOn(&run_test.step);
step.dependOn(&cleanup.step);
} $ zig build test-bug
info: Created build.zig
info: Created src/main.zig
info: Next, try `zig build --help` or `zig build test`
zig build test: error: run test: error: unable to spawn /home/manlio/src/zig/src/test.localhost/zig-issues/15009/zig-cache/tmp/4ef82da693a614fa/zig-cache/o/8b79ec684c28526ca0bb5087766c89f2/test: NotDir
Build Summary: 1/3 steps succeeded; 1 failed (disable with -fno-summary)
test transitive failure
└─ run test failure
└─ zig test Debug native success 1s MaxRSS:176M
error: the following build command failed with exit code 1:
/home/manlio/src/zig/src/test.localhost/zig-issues/15009/zig-cache/tmp/4ef82da693a614fa/zig-cache/o/3fc433ac561724a230acd8502d78eccc/build /home/manlio/src/contrib/zig/github.com/perillo/zig/build/stage3/bin/zig /home/manlio/src/zig/src/test.localhost/zig-issues/15009/zig-cache/tmp/4ef82da693a614fa /home/manlio/src/zig/src/test.localhost/zig-issues/15009/zig-cache/tmp/4ef82da693a614fa/zig-cache /home/manlio/.cache/zig test
zig build test: error: the following command exited with code 1 (expected exited with code 0):
cd /home/manlio/src/zig/src/test.localhost/zig-issues/15009/zig-cache/tmp/4ef82da693a614fa && /home/manlio/src/contrib/zig/github.com/perillo/zig/build/stage3/bin/zig build test
Build Summary: 1/4 steps succeeded; 1 failed (disable with -fno-summary)
test-bug transitive failure
└─ RemoveDir /home/manlio/src/zig/src/test.localhost/zig-issues/15009/zig-cache/tmp/4ef82da693a614fa transitive failure
└─ zig build test failure
└─ zig init-lib success 19ms MaxRSS:60M
error: the following build command failed with exit code 1:
/home/manlio/src/zig/src/test.localhost/zig-issues/15009/zig-cache/o/426c8df43d3110df2fe824c5f8e2df95/build /home/manlio/src/contrib/zig/github.com/perillo/zig/build/stage3/bin/zig /home/manlio/src/zig/src/test.localhost/zig-issues/15009 /home/manlio/src/zig/src/test.localhost/zig-issues/15009/zig-cache /home/manlio/.cache/zig test-bug |
Closed for #15129 |
After commit ede5dcf (make the build runner and test runner talk to each other), the std.Build.addTest function no longer runs tests, but the build.zig files in init-exe and init-lib where not updated.
Rename main_tests to lib_tests in init-lib, for consistency with the exe_tests variable in init-exe.
Add a RunStep to exe_tests and lib_tests.
Remove an empty line in the addCliTests function in tests/tests.zig.
Closes #15009