summaryrefslogtreecommitdiff
path: root/test/testutil.c
diff options
context:
space:
mode:
authorrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2004-06-05 22:19:41 +0000
committerrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2004-06-05 22:19:41 +0000
commitdeed06e2c8ce01958e1e209f1ffdeb697301adf1 (patch)
treeee1d002c3e77edcd0e4ce6b56a6a69175943bef9 /test/testutil.c
parent78a7366afdc451b63a2ff1805ee59368d72c0220 (diff)
downloadlibapr-util-deed06e2c8ce01958e1e209f1ffdeb697301adf1.tar.gz
Migrate APR-Util to abts for the test suite. Testuuid is still the only
test using the unified framework for apr-util. git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@59046 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testutil.c')
-rw-r--r--test/testutil.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/testutil.c b/test/testutil.c
new file mode 100644
index 00000000..43835c15
--- /dev/null
+++ b/test/testutil.c
@@ -0,0 +1,44 @@
+/* Copyright 2000-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "abts.h"
+#include "testutil.h"
+#include "apr_pools.h"
+
+apr_pool_t *p;
+
+void apr_assert_success(abts_case* tc, const char* context, apr_status_t rv)
+{
+ if (rv == APR_ENOTIMPL) {
+ ABTS_NOT_IMPL(tc, context);
+ }
+
+ if (rv != APR_SUCCESS) {
+ char buf[STRING_MAX], ebuf[128];
+ sprintf(buf, "%s (%d): %s\n", context, rv,
+ apr_strerror(rv, ebuf, sizeof ebuf));
+ ABTS_FAIL(tc, buf);
+ }
+}
+
+void initialize(void) {
+ apr_initialize();
+ atexit(apr_terminate);
+
+ apr_pool_create(&p, NULL);
+}