-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Zig build system does not fail when a test fails #15009
Comments
After #14647:
|
That does seem to be the issue. Seems you now need: test_step.dependOn(&exe_tests.run().step); Would be nice if |
Agreed! And I'm sure this will be called out in the release notes when theyre written, because I also found this to be a rather nefarious breaking change (a good breaking change would break everyones tests. this one sadly makes them all pass!) |
I agree it is nefarious - perhaps addTest could be renamed to addTestExecutable and the previous name could be a compile error that explains the new behavior. |
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 ziglang#15009
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 ziglang#15009
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
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. Use the new Build.addRunArtifact function, instead of the deprecated CompileStep.run method. Add a RunStep to exe_tests and lib_tests. In the addCliTests function in tests/test.zig: - set the new RunStep.is_test_command field to true, when running the `zig build test` command. See ziglang#15104. - Remove an empty line in the addCliTests function in tests/tests.zig. Closes ziglang#15009
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. Use the new Build.addRunArtifact function, instead of the deprecated CompileStep.run method. Add a RunStep to exe_tests and lib_tests. In the addCliTests function in tests/test.zig: - set the new RunStep.is_test_command field to true, when running the `zig build test` command. See ziglang#15104. - Remove an empty line in the addCliTests function in tests/tests.zig. Closes ziglang#15009
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. Use the new Build.addRunArtifact function, instead of the deprecated CompileStep.run method. Add a RunStep to exe_tests and lib_tests. In the addCliTests function in tests/test.zig: - set the new RunStep.is_test_command field to true, when running the `zig build test` command. See ziglang#15104. - Remove an empty line in the addCliTests function in tests/tests.zig. Closes ziglang#15009
I'm trying to get my tests to run after upgrading to Zig
|
@nurpax if you run If the run step shows as cached it means the code hasn't changed so the tests won't run again, but the summary will include the number of passed test cases from the prior execution. To force the tests to always run you would need to add |
If I run the test.exe from the zig-cache dir, here's what it prints:
Adding
Without -fsummary, it prints nothing. It's a little confusing. |
Yes, but it could still be mitigated like #15009 (comment) suggests. I'll leave it to Andrew to decide. |
I apologize for handling this upgrade poorly. I should have done it in a strategy that caused compile errors in the build script rather than changing the behavior silently. However, I think the opportunity to handle the upgrade more smoothly has passed, and so I am going to merely improve the doc comments for |
Zig Version
0.11.0-dev.2165+8f481dfc3
Steps to Reproduce and Observed Behavior
Expected Behavior
I expect to get a stack trace in my terminal showing the test failure. Instead, the command silently exits with a successful status code.
Running
zig build test --verbose
we can see that it seems to be actually running the test:If I take the same command, remove
--listen=-
, this works just fine:The text was updated successfully, but these errors were encountered: