[libcxx-commits] [PATCH] D89681: [libcxx] [test] Use _putenv instead of setenv on windows
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 19 14:08:03 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG93671fffb5ef: [libcxx] [test] Use _putenv instead of setenv/unsetenv on windows (authored by mstorsjo).
Changed prior to commit:
https://reviews.llvm.org/D89681?vs=299026&id=299162#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89681/new/
https://reviews.llvm.org/D89681
Files:
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
libcxx/test/support/filesystem_test_helper.h
Index: libcxx/test/support/filesystem_test_helper.h
===================================================================
--- libcxx/test/support/filesystem_test_helper.h
+++ libcxx/test/support/filesystem_test_helper.h
@@ -45,11 +45,24 @@
inline int link(const char *oldname, const char* newname) {
return !CreateHardLinkA(newname, oldname, NULL);
}
+ inline int setenv(const char *var, const char *val, int overwrite) {
+ (void)overwrite;
+ return ::_putenv((std::string(var) + "=" + std::string(val)).c_str());
+ }
+ inline int unsetenv(const char *var) {
+ return ::_putenv((std::string(var) + "=").c_str());
+ }
#else
using ::mkdir;
using ::ftruncate;
inline int symlink(const char* oldname, const char* newname, bool is_dir) { (void)is_dir; return ::symlink(oldname, newname); }
using ::link;
+ inline int setenv(const char *var, const char *val, int overwrite) {
+ return ::setenv(var, val, overwrite);
+ }
+ inline int unsetenv(const char *var) {
+ return ::unsetenv(var);
+ }
#endif
inline std::string getcwd() {
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
@@ -26,11 +26,11 @@
using namespace fs;
void PutEnv(std::string var, fs::path value) {
- assert(::setenv(var.c_str(), value.string().c_str(), /* overwrite */ 1) == 0);
+ assert(utils::setenv(var.c_str(), value.string().c_str(), /* overwrite */ 1) == 0);
}
void UnsetEnv(std::string var) {
- assert(::unsetenv(var.c_str()) == 0);
+ assert(utils::unsetenv(var.c_str()) == 0);
}
TEST_SUITE(filesystem_temp_directory_path_test_suite)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89681.299162.patch
Type: text/x-patch
Size: 1970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201019/bb307427/attachment.bin>
More information about the libcxx-commits
mailing list