apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r373505 - /apr/apr/branches/0.9.x/test/testdir.c
Date Mon, 30 Jan 2006 12:52:32 GMT
Author: trawick
Date: Mon Jan 30 04:52:30 2006
New Revision: 373505

URL: http://svn.apache.org/viewcvs?rev=373505&view=rev
Log:
backport from trunk:

test/testdir.c (test_rmkdir_nocwd): Avoid failures on platforms
where directories in use cannot be removed.


Modified:
    apr/apr/branches/0.9.x/test/testdir.c

Modified: apr/apr/branches/0.9.x/test/testdir.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/0.9.x/test/testdir.c?rev=373505&r1=373504&r2=373505&view=diff
==============================================================================
--- apr/apr/branches/0.9.x/test/testdir.c (original)
+++ apr/apr/branches/0.9.x/test/testdir.c Mon Jan 30 04:52:30 2006
@@ -222,6 +222,7 @@
 static void test_rmkdir_nocwd(CuTest *tc)
 {
     char *cwd, *path;
+    apr_status_t rv;
 
     apr_assert_success(tc, "make temp dir",
                        apr_dir_make("dir3", APR_OS_DEFAULT, p));
@@ -233,13 +234,20 @@
 
     apr_assert_success(tc, "change to temp dir", apr_filepath_set(path, p));
 
-    apr_assert_success(tc, "remove temp dir", apr_dir_remove(path, p));
-
-    CuAssert(tc, "fail to create dir",
-             apr_dir_make_recursive("foobar", APR_OS_DEFAULT, 
-                                    p) != APR_SUCCESS);
+    rv = apr_dir_remove(path, p);
+    /* Some platforms cannot remove a directory which is in use. */
+    if (rv == APR_SUCCESS) {
+        CuAssert(tc, "fail to create dir",
+                 apr_dir_make_recursive("foobar", APR_OS_DEFAULT, 
+                                        p) != APR_SUCCESS);
+    }
 
     apr_assert_success(tc, "restore cwd", apr_filepath_set(cwd, p));
+
+    if (rv) {
+        apr_dir_remove(path, p);
+        CuNotImpl(tc, "cannot remove in-use directory");
+    }
 }
 
 CuSuite *testdir(void)



Mime
View raw message