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 --- 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 @@ -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) diff --git a/libcxx/test/support/filesystem_test_helper.h b/libcxx/test/support/filesystem_test_helper.h --- a/libcxx/test/support/filesystem_test_helper.h +++ b/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() {