[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
Sun Mar 7 02:00:38 PST 2021

mstorsjo created this revision.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Check a different set of env vars, don't check the exact value
of the fallback path. (GetTempPath falls back to returning c:\windows
if nothing better is available in env vars.)

  rG LLVM Github Monorepo



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")}
         {"TMPDIR", env.create_dir("dir1")},
         {"TMP", env.create_dir("dir2")},
         {"TEMP", env.create_dir("dir3")},
         {"TEMPDIR", env.create_dir("dir4")}
     for (auto& TC : cases) {
         PutEnv(TC.name, TC.p);
@@ -116,7 +122,10 @@
         std::error_code ec = GetTestEC();
         path ret = temp_directory_path(ec);
+#ifndef _WIN32
+        // On windows, a different fallback is used.
         TEST_CHECK(ret == "/tmp");

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

More information about the libcxx-commits mailing list