Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17636 from lydia-duncan/fixChpldocTmpDir
Fix issues with chpldoc temporary directory [reviewed by @ronawho] We started encountering problems in nightly testing where we'd accidentally put chpldoc temporary files in a folder that already had old chpldoc error files, causing us to encounter sporadic failures that matched the old error files. This was because we were failing to clean up old temporary directories after a failure. This change accomplishes two things: 1. It ensures that we clean up the temporary directory for chpldoc, even when we encounter an error 2. It stops using a homegrown strategy to create the temporary directory, instead relying on mkdtemp. We do still perform some computation to determine the start of the temporary directory's name (involving getting the username and attaching the program name and "deleteme" to it) but we no longer use the PID to differentiate, instead relying on mkdtemp's randomization for us. Resolves Cray/chapel-private#1932 Resolves Cray/chapel-private#1678 With this change, I was no longer seeing leftover chpldoc directories in my temp folder, and did not see additional chpl directories (because this does alter how we compute the temporary directory name for chpl compilations, since they share a code path) <details> The variable storing the temporary directory for chpldoc was local, which meant that we'd only remove its contents after a successful run of the compiler. This change replaces that variable with a global variable stored in the same location as the temporary directory used for normal operations, and adjusts the clean up call at the exit of the compiler's operations to clean it up as well (which runs regardless of if the compiler ran successfully or encountered an error). At Elliot's suggestion, use mkdtemp to make a temporary directory, for both chpldoc and chpl programs. Because mkdtemp requires its strings end in six Xs, alter the name we use from "tmpdirloc/chpl[doc]-username-pid.deleteme" to "tmpdirloc/chpl[doc]-username.deleteme-XXXXXX" and remove all references to the PID in this setup. The username stuff seems reasonable to keep and the Xs will be replaced with a unique enough set of characters for our purposes. </details> Testing: Passed a full paratest with futures and a spot check on my Mac with hello.chpl and a chpldoc test that had triggered the leftover directory before
- Loading branch information