summaryrefslogtreecommitdiff
path: root/test/testglobalmutex.c
diff options
context:
space:
mode:
authorrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2004-05-13 00:50:20 +0000
committerrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2004-05-13 00:50:20 +0000
commit4ac08957a95bed976c28b0a04f27f89c88d6b7f0 (patch)
tree7efbac56f447f9a37ff68adec5fe28a9ec5cbb79 /test/testglobalmutex.c
parent51e9d33da3e0900f25feac8a48463eedbc58a4dd (diff)
downloadlibapr-4ac08957a95bed976c28b0a04f27f89c88d6b7f0.tar.gz
Move the APR test suite from CuTest to abts. The output is cleaner,
and it prints output while running the test. Also, if a test fails the rest of the test function is run, allowing for proper cleanup. Finally, it is possible to call the same function multiple times with different data, and each call is considered a separate test. This is the first of a multi-step process to get a more useful test suite. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@65091 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testglobalmutex.c')
-rw-r--r--test/testglobalmutex.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/testglobalmutex.c b/test/testglobalmutex.c
index 5b9bd7ee6..7a2d345e6 100644
--- a/test/testglobalmutex.c
+++ b/test/testglobalmutex.c
@@ -17,9 +17,9 @@
#include "apr_thread_proc.h"
#include "apr_global_mutex.h"
#include "apr_errno.h"
-#include "test_apr.h"
+#include "testutil.h"
-static void launch_child(CuTest *tc, apr_proc_t *proc, apr_pool_t *p)
+static void launch_child(abts_case *tc, apr_proc_t *proc, apr_pool_t *p)
{
apr_procattr_t *procattr;
const char *args[2];
@@ -42,19 +42,19 @@ static void launch_child(CuTest *tc, apr_proc_t *proc, apr_pool_t *p)
apr_assert_success(tc, "Couldn't launch program", rv);
}
-static int wait_child(CuTest *tc, apr_proc_t *proc)
+static int wait_child(abts_case *tc, apr_proc_t *proc)
{
int exitcode;
apr_exit_why_e why;
- CuAssert(tc, "Error waiting for child process",
+ abts_assert(tc, "Error waiting for child process",
apr_proc_wait(proc, &exitcode, &why, APR_WAIT) == APR_CHILD_DONE);
- CuAssert(tc, "child didn't terminate normally", why == APR_PROC_EXIT);
+ abts_assert(tc, "child didn't terminate normally", why == APR_PROC_EXIT);
return exitcode;
}
-static void test_exclusive(CuTest *tc)
+static void test_exclusive(abts_case *tc, void *data)
{
apr_proc_t p1, p2, p3, p4;
apr_status_t rv;
@@ -75,14 +75,14 @@ static void test_exclusive(CuTest *tc)
x += wait_child(tc, &p3);
x += wait_child(tc, &p4);
- CuAssertIntEquals(tc, MAX_COUNTER, x);
+ abts_int_equal(tc, MAX_COUNTER, x);
}
-CuSuite *testglobalmutex(void)
+abts_suite *testglobalmutex(abts_suite *suite)
{
- CuSuite *suite = CuSuiteNew("Global Mutex");
+ suite = ADD_SUITE(suite)
- SUITE_ADD_TEST(suite, test_exclusive);
+ abts_run_test(suite, test_exclusive, NULL);
return suite;
}