[flang-commits] [flang] [llvm] [flang-rt] Honor TMPDIR/TMP/TEMP/TEMPDIR for OPEN(STATUS='SCRATCH') (PR #199517)
via flang-commits
flang-commits at lists.llvm.org
Mon May 25 04:41:15 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- flang-rt/unittests/Runtime/ScratchTempDir.cpp flang-rt/lib/runtime/file.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang-rt/unittests/Runtime/ScratchTempDir.cpp b/flang-rt/unittests/Runtime/ScratchTempDir.cpp
index fc2a5c453..fbff7c348 100644
--- a/flang-rt/unittests/Runtime/ScratchTempDir.cpp
+++ b/flang-rt/unittests/Runtime/ScratchTempDir.cpp
@@ -7,7 +7,8 @@
//===----------------------------------------------------------------------===//
//
// Verifies that OPEN(STATUS='SCRATCH') honors the TMPDIR/TMP/TEMP/TEMPDIR
-// environment variables on POSIX, matching llvm::sys::path::system_temp_directory.
+// environment variables on POSIX, matching
+// llvm::sys::path::system_temp_directory.
//
//===----------------------------------------------------------------------===//
@@ -118,7 +119,8 @@ TEST_F(ScratchTempDirTests, TmpConsulted) {
TEST_F(ScratchTempDirTests, EmptyTmpdirSkipped) {
TempDirEnvGuard guard;
char tmpDir[]{"/tmp/flang-rt-scratch-test-XXXXXX"};
- ASSERT_NE(::mkdtemp(tmpDir), nullptr) << "mkdtemp failed: " << strerror(errno);
+ ASSERT_NE(::mkdtemp(tmpDir), nullptr)
+ << "mkdtemp failed: " << strerror(errno);
::setenv("TMPDIR", "", 1);
::setenv("TMP", tmpDir, 1);
EXPECT_EQ(OpenScratchUnit(), IostatOk)
@@ -133,7 +135,8 @@ TEST_F(ScratchTempDirTests, EmptyTmpdirSkipped) {
TEST_F(ScratchTempDirTests, FileCreatedInTmpdir) {
TempDirEnvGuard guard;
char tmpDir[]{"/tmp/flang-rt-scratch-test-XXXXXX"};
- ASSERT_NE(::mkdtemp(tmpDir), nullptr) << "mkdtemp failed: " << strerror(errno);
+ ASSERT_NE(::mkdtemp(tmpDir), nullptr)
+ << "mkdtemp failed: " << strerror(errno);
::setenv("TMPDIR", tmpDir, 1);
struct stat before{};
``````````
</details>
https://github.com/llvm/llvm-project/pull/199517
More information about the flang-commits
mailing list