[libcxx-commits] [libcxx] 4c402ae - [libcxx] [test] Don't leave test dirs behind in fs.op.current_path on Windows

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 22 14:41:20 PDT 2021


Author: Martin Storsjö
Date: 2021-03-22T23:41:10+02:00
New Revision: 4c402ae880cf9a922f0d95e637a596792e05ac1e

URL: https://github.com/llvm/llvm-project/commit/4c402ae880cf9a922f0d95e637a596792e05ac1e
DIFF: https://github.com/llvm/llvm-project/commit/4c402ae880cf9a922f0d95e637a596792e05ac1e.diff

LOG: [libcxx] [test] Don't leave test dirs behind in fs.op.current_path on Windows

Fix nesting of static_env and CWDGuard, restore the cwd (with
CWDGuard) before cleaning up the static_env.

Previously, every test run left 2 directories behind in the temp dir.

Differential Revision: https://reviews.llvm.org/D98954

Added: 
    

Modified: 
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
index 4b8d9d4ec1f8f..5e90c4452a9db 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
@@ -51,8 +51,8 @@ TEST_CASE(current_path_test)
 
 TEST_CASE(current_path_after_change_test)
 {
-    CWDGuard guard;
     static_test_env static_env;
+    CWDGuard guard;
     const path new_path = static_env.Dir;
     current_path(new_path);
     TEST_CHECK(current_path() == new_path);
@@ -60,8 +60,8 @@ TEST_CASE(current_path_after_change_test)
 
 TEST_CASE(current_path_is_file_test)
 {
-    CWDGuard guard;
     static_test_env static_env;
+    CWDGuard guard;
     const path p = static_env.File;
     std::error_code ec;
     const path old_p = current_path();
@@ -72,8 +72,8 @@ TEST_CASE(current_path_is_file_test)
 
 TEST_CASE(set_to_non_absolute_path)
 {
-    CWDGuard guard;
     static_test_env static_env;
+    CWDGuard guard;
     const path base = static_env.Dir;
     current_path(base);
     const path p = static_env.Dir2.filename();


        


More information about the libcxx-commits mailing list