[libcxx-commits] [PATCH] D98139: [libcxx] [test] Fix temp_directory_path for windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 8 12:10:57 PST 2021


mstorsjo updated this revision to Diff 329095.
mstorsjo added a comment.

Clarified the comment as requested


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98139/new/

https://reviews.llvm.org/D98139

Files:
  libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp


Index: libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
===================================================================
--- libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
+++ libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
@@ -55,10 +55,16 @@
       std::string name;
       path p;
     } cases[] = {
+#ifdef _WIN32
+        {"TMP", env.create_dir("dir2")},
+        {"TEMP", env.create_dir("dir3")},
+        {"USERPROFILE", env.create_dir("dir4")}
+#else
         {"TMPDIR", env.create_dir("dir1")},
         {"TMP", env.create_dir("dir2")},
         {"TEMP", env.create_dir("dir3")},
         {"TEMPDIR", env.create_dir("dir4")}
+#endif
     };
     for (auto& TC : cases) {
         PutEnv(TC.name, TC.p);
@@ -112,7 +118,10 @@
         std::error_code ec = GetTestEC();
         path ret = temp_directory_path(ec);
         TEST_CHECK(!ec);
+#ifndef _WIN32
+        // On Windows, the function falls back to C:\Windows instead.
         TEST_CHECK(ret == "/tmp");
+#endif
         TEST_CHECK(is_directory(ret));
     }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98139.329095.patch
Type: text/x-patch
Size: 1193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210308/cfbbdf00/attachment.bin>


More information about the libcxx-commits mailing list