cmcfarlen commented on code in PR #13658:
URL: https://github.com/apache/trafficserver/pull/13658#discussion_r3973342486
##########
src/config/unit_tests/test_storage.cc:
##########
@@ -37,12 +39,27 @@ using namespace config;
namespace
{
+// Test cases run as separate, concurrent ctest processes, so they cannot
share one
+// temp directory: a fixed file name would let one case delete another's file
mid-read.
+// A directory per process rather than a unique file name keeps the file names
these
+// tests depend on, e.g. a legacy storage.config finding its sibling
volume.config.
+std::filesystem::path const &
+per_process_temp_dir()
+{
+ static std::filesystem::path const dir = [] {
+ auto d = std::filesystem::temp_directory_path() / ("ats_config_test." +
std::to_string(getpid()));
+ std::filesystem::create_directories(d);
+ return d;
+ }();
Review Comment:
Fixed in 29169dfa6e. The directory now owns its own cleanup via an RAII
static, so it is removed at process exit:
```cpp
~ScopedDir()
{
std::error_code ec; // Best effort: a leftover temp directory must not
fail the run.
std::filesystem::remove_all(_path, ec);
}
```
Verified: cleared the temp dir, ran the 60 config cases at `-j8`, and
`ats_config_test.*` count went 0 → 0 (it was accumulating one empty directory
per test process before).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]