You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by br...@apache.org on 2020/05/06 16:14:56 UTC

svn commit: r1877443 - /apr/apr/trunk/test/testdir.c

Author: brane
Date: Wed May  6 16:14:55 2020
New Revision: 1877443

URL: http://svn.apache.org/viewvc?rev=1877443&view=rev
Log:
testdir: Following up to r1877439, make sure that the test data gets
         populated correctly when threads are disabled.

Modified:
    apr/apr/trunk/test/testdir.c

Modified: apr/apr/trunk/test/testdir.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testdir.c?rev=1877443&r1=1877442&r2=1877443&view=diff
==============================================================================
--- apr/apr/trunk/test/testdir.c (original)
+++ apr/apr/trunk/test/testdir.c Wed May  6 16:14:55 2020
@@ -63,39 +63,44 @@ static void test_mkdir_recurs(abts_case
     ABTS_INT_EQUAL(tc, APR_DIR, finfo.filetype);
 }
 
-#if APR_HAS_THREADS
-struct thread_data
+static void mkdir_func(abts_case *tc, apr_pool_t *pool)
 {
-    abts_case *tc;
-    apr_pool_t *pool;
-};
-
-static void *APR_THREAD_FUNC thread_mkdir_func(apr_thread_t *thd, void *data)
-{
-    struct thread_data *td = data;
     apr_status_t s1, s2, s3, s4, s5;
 
     s1 = apr_dir_make_recursive("data/prll/one/thwo/three",
                                 APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_UEXECUTE,
-                                td->pool);
+                                pool);
     s2 = apr_dir_make_recursive("data/prll/four/five/six/seven/eight",
                                 APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_UEXECUTE,
-                                td->pool);
+                                pool);
     s3 = apr_dir_make_recursive("data/prll/nine/ten",
                                 APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_UEXECUTE,
-                                td->pool);
+                                pool);
     s4 = apr_dir_make_recursive("data/prll/11/12/13/14/15/16/17/18/19/20",
                                 APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_UEXECUTE,
-                                td->pool);
+                                pool);
     s5 = apr_dir_make_recursive("data/fortytwo",
                                 APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_UEXECUTE,
-                                td->pool);
+                                pool);
 
-    ABTS_INT_EQUAL(td->tc, APR_SUCCESS, s1);
-    ABTS_INT_EQUAL(td->tc, APR_SUCCESS, s2);
-    ABTS_INT_EQUAL(td->tc, APR_SUCCESS, s3);
-    ABTS_INT_EQUAL(td->tc, APR_SUCCESS, s4);
-    ABTS_INT_EQUAL(td->tc, APR_SUCCESS, s5);
+    ABTS_INT_EQUAL(tc, APR_SUCCESS, s1);
+    ABTS_INT_EQUAL(tc, APR_SUCCESS, s2);
+    ABTS_INT_EQUAL(tc, APR_SUCCESS, s3);
+    ABTS_INT_EQUAL(tc, APR_SUCCESS, s4);
+    ABTS_INT_EQUAL(tc, APR_SUCCESS, s5);
+}
+
+#if APR_HAS_THREADS
+struct thread_data
+{
+    abts_case *tc;
+    apr_pool_t *pool;
+};
+
+static void *APR_THREAD_FUNC thread_mkdir_func(apr_thread_t *thd, void *data)
+{
+    struct thread_data *td = data;
+    mkdir_func(td->tc, td->pool);
     return NULL;
 }
 #endif  /* APR_HAS_THREADS */
@@ -132,6 +137,8 @@ static void test_mkdir_recurs_parallel(a
     ABTS_INT_EQUAL(tc, APR_SUCCESS, s3);
     ABTS_INT_EQUAL(tc, APR_SUCCESS, s4);
 #else
+    /* Create the test directories for test_removeall anwyay. */
+    mkdir_func(tc, p);
     ABTS_SKIP(tc, data, "This test requires APR thread support.");
 #endif  /* APR_HAS_THREADS */
 }