Prevent tests from creating temporary files in the source tree - #3498
Open
justsmth wants to merge 1 commit into
Open
Prevent tests from creating temporary files in the source tree#3498justsmth wants to merge 1 commit into
justsmth wants to merge 1 commit into
Conversation
The POSIX branch of createTempFILEpath passed a bare relative template to mkstemp, so temp files landed in the CWD -- and util/all_tests.go chdirs to the top of the checkout so tests can find their data files, so runs accumulated hundreds of awslcTestTmpFile* files there. Build the template under TMPDIR (falling back to /tmp), matching createTempDirPath and the Windows branch. prepare_unix_domain_socket leaked most of them: it called createTempFILEpath only to get a unique name, then used <tempdir>/<name> as the socket path, so the file mkstemp created was never written or removed. The temp dir is already unique, so use a fixed leaf name and drop the call. That also drops a latent assumption that createTempFILEpath returns a relative name, untrue on Windows.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3498 +/- ##
==========================================
- Coverage 78.15% 78.13% -0.03%
==========================================
Files 700 700
Lines 125599 125606 +7
Branches 17374 17375 +1
==========================================
- Hits 98162 98136 -26
- Misses 26566 26598 +32
- Partials 871 872 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dougch
approved these changes
Sep 10, 2026
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.
Context and motivation
On POSIX systems,
createTempFILEpathpassed a relative template tomkstemp, causing test runs to accumulateawslcTestTmpFile*files in the source tree. The Unix-domain socket tests were the primary source because they created a file only to obtain a unique name, then used a different path for the socket without removing the original file.Description of changes
Create POSIX temporary files under
TMPDIR, falling back to/tmp. For Unix-domain sockets, use a fixed filename inside the already-unique temporary directory instead of creating an unused file to reserve a name.Testing
No tests were added because the affected paths are already covered by the existing test suites. Built
crypto_test,ssl_test, andtool_openssl_test; all tests completed without failures. Verified that the affected socket and file tests no longer createawslcTestTmpFile*files in the source tree.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.