Repository navigation
Fix temp file race on Windows and show failures logs in CI - #32
Merged
Merged
Conversation
Problem: on MinGW, tmpfile_open() gets a name from GetTempFileName(), which creates an empty file to reserve it, and then deletes that file and creates it again with fopen(). Between the two another process calling GetTempFileName() at the same time can receive the same name, since the name is derived from the current system time, and both processes end up writing their temporary data into the same file. This happens when the tests run in parallel, where every test process creates its temporary files right as it starts, and shows up as a test failing at random on the Windows CI. Solution: open the file GetTempFileName() created, without deleting it first.
Problem: when a test fails on CI, the log only shows its name and exit status. What the test printed, such as which assertion failed, goes to build/meson-logs/testlog.txt, which is lost with the runner. Solution: run the tests with --print-errorlogs, so the output of failing tests is printed in the job log, and upload build/meson-logs/ as an artifact when a job fails. AI-assisted
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hopefully, this fixes the CI failure seen in #30 (comment).
Ideally, the temporary file should have a non-predictable unique filename. I tried to implement that, but it seemed non-trivial, and I don't have a Windows machine to test it on, so I dropped it.
I also changed the CI configuration to display test failures and upload Meson logs on failure, so it is easier to debug CI failures in the future.