2
0

testutil.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
  2. * applicable.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include "abts.h"
  19. #include "testutil.h"
  20. #include "apr_pools.h"
  21. apr_pool_t *p;
  22. void apr_assert_success(abts_case* tc, const char* context, apr_status_t rv)
  23. {
  24. if (rv == APR_ENOTIMPL) {
  25. ABTS_NOT_IMPL(tc, context);
  26. }
  27. if (rv != APR_SUCCESS) {
  28. char buf[STRING_MAX], ebuf[128];
  29. sprintf(buf, "%s (%d): %s\n", context, rv,
  30. apr_strerror(rv, ebuf, sizeof ebuf));
  31. ABTS_FAIL(tc, buf);
  32. }
  33. }
  34. void initialize(void) {
  35. if (apr_initialize() != APR_SUCCESS) {
  36. abort();
  37. }
  38. atexit(apr_terminate);
  39. apr_pool_create(&p, NULL);
  40. apr_pool_tag(p, "apr-util global test pool");
  41. }