summaryrefslogtreecommitdiffstats
path: root/test/testdir.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 04:59:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 04:59:58 +0000
commitcc13dc44324dd5970d7a239e243a38d5f22cf64f (patch)
treee7429020c9c6aec4b93a84dd63b810f67dacce9c /test/testdir.c
parentAdding debian version 1.7.2-3.2. (diff)
downloadapr-cc13dc44324dd5970d7a239e243a38d5f22cf64f.tar.xz
apr-cc13dc44324dd5970d7a239e243a38d5f22cf64f.zip
Merging upstream version 1.7.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/testdir.c')
-rw-r--r--test/testdir.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/test/testdir.c b/test/testdir.c
index ac1bcfa..95b559d 100644
--- a/test/testdir.c
+++ b/test/testdir.c
@@ -60,43 +60,51 @@ static void test_mkdir_recurs(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, APR_DIR, finfo.filetype);
}
-struct thread_data
-{
- abts_case *tc;
- apr_pool_t *pool;
-};
-
-static void *APR_THREAD_FUNC thread_mkdir_func(apr_thread_t *thd, void *data)
+static void mkdir_func(abts_case *tc, apr_pool_t *pool)
{
- 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 */
static void test_mkdir_recurs_parallel(abts_case *tc, void *data)
{
+#if APR_HAS_THREADS
struct thread_data td1, td2, td3, td4;
apr_thread_t *t1, *t2, *t3, *t4;
apr_status_t s1, s2, s3, s4;
@@ -125,6 +133,11 @@ static void test_mkdir_recurs_parallel(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, APR_SUCCESS, s2);
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 */
}
static void test_remove(abts_case *tc, void *data)