[libcxx-commits] [libcxx] b5e228f - [libcxx] [test] Fix the temp_directory_path test for windows
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 15 10:25:34 PDT 2021
Author: Martin Storsjö
Date: 2021-03-15T19:24:56+02:00
New Revision: b5e228fc00b18b1ce2ac823fe61b03b07600a9ad
URL: https://github.com/llvm/llvm-project/commit/b5e228fc00b18b1ce2ac823fe61b03b07600a9ad
DIFF: https://github.com/llvm/llvm-project/commit/b5e228fc00b18b1ce2ac823fe61b03b07600a9ad.diff
LOG: [libcxx] [test] Fix the temp_directory_path test for windows
Check a different set of env vars, don't check the exact value
of the fallback path. (GetTempPath falls back to returning the Windows
folder if nothing better is available in env vars.)
The test still fails one check on windows (due to relying on perms::none),
which will be addressed separately.
Differential Revision: https://reviews.llvm.org/D98139
Added:
Modified:
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
index c99614267a21..32748ded1428 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
@@ -55,10 +55,16 @@ TEST_CASE(basic_tests)
std::string name;
path p;
} cases[] = {
+#ifdef _WIN32
+ {"TMP", env.create_dir("dir1")},
+ {"TEMP", env.create_dir("dir2")},
+ {"USERPROFILE", env.create_dir("dir3")}
+#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 @@ TEST_CASE(basic_tests)
std::error_code ec = GetTestEC();
path ret = temp_directory_path(ec);
TEST_CHECK(!ec);
+#ifndef _WIN32
+ // On Windows, the function falls back to the Windows folder.
TEST_CHECK(ret == "/tmp");
+#endif
TEST_CHECK(is_directory(ret));
}
}
More information about the libcxx-commits
mailing list