summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-04-01 13:22:49 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-04-17 11:43:22 +0200
commit4139a7a731f2831963a42b26aac111422be28792 (patch)
treec69d00109216ecaae36d54f3877946d89e16de17 /src
parent714ba5f50551a42df324714358dc379b351d4a53 (diff)
downloadsssd-4139a7a731f2831963a42b26aac111422be28792.tar.gz
sssd-4139a7a731f2831963a42b26aac111422be28792.tar.bz2
sssd-4139a7a731f2831963a42b26aac111422be28792.zip
Make leak checks usable in tests that do not utilize check
* Remove check-specific failure reporting from common_check.c * Check-specific abstraction over memleak checks * Rename common_check.c to leak_check.c
Diffstat (limited to 'src')
-rw-r--r--src/tests/common.h9
-rw-r--r--src/tests/common_check.c86
-rw-r--r--src/tests/common_check.h36
-rw-r--r--src/tests/crypto-tests.c8
-rw-r--r--src/tests/fail_over-tests.c12
-rw-r--r--src/tests/ipa_hbac-tests.c6
-rw-r--r--src/tests/leak_check.c132
-rw-r--r--src/tests/pac_responder-tests.c6
-rw-r--r--src/tests/refcount-tests.c8
-rw-r--r--src/tests/resolv-tests.c48
-rw-r--r--src/tests/sss_idmap-tests.c18
-rw-r--r--src/tests/util-tests.c6
12 files changed, 237 insertions, 138 deletions
diff --git a/src/tests/common.h b/src/tests/common.h
index 61dcbf41..e7fc812c 100644
--- a/src/tests/common.h
+++ b/src/tests/common.h
@@ -33,17 +33,18 @@
extern TALLOC_CTX *global_talloc_context;
#define check_leaks(ctx, bytes) _check_leaks((ctx), (bytes), __location__)
-void _check_leaks(TALLOC_CTX *ctx,
+bool _check_leaks(TALLOC_CTX *ctx,
size_t bytes,
const char *location);
void check_leaks_push(TALLOC_CTX *ctx);
#define check_leaks_pop(ctx) _check_leaks_pop((ctx), __location__)
-void _check_leaks_pop(TALLOC_CTX *ctx, const char *location);
+bool _check_leaks_pop(TALLOC_CTX *ctx, const char *location);
-void leak_check_setup(void);
-void leak_check_teardown(void);
+bool leak_check_setup(void);
+bool leak_check_teardown(void);
+const char *check_leaks_err_msg(void);
void tests_set_cwd(void);
diff --git a/src/tests/common_check.c b/src/tests/common_check.c
index d845923f..94ca40ff 100644
--- a/src/tests/common_check.c
+++ b/src/tests/common_check.c
@@ -1,7 +1,7 @@
/*
SSSD
- Common utilities for check-based tests using talloc.
+ Memory leak/growth checks for check-based tests using talloc.
Authors:
Martin Nagy <mnagy@redhat.com>
@@ -22,88 +22,18 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdio.h>
#include <check.h>
-#include "tests/common.h"
-#include "util/util.h"
-#include "util/dlinklist.h"
-
-TALLOC_CTX *global_talloc_context = NULL;
-
-
-struct size_snapshot {
- struct size_snapshot *prev;
- struct size_snapshot *next;
-
- TALLOC_CTX *ctx;
- size_t bytes_allocated;
-};
-
-static struct size_snapshot *snapshot_stack;
-
-void
-_check_leaks(TALLOC_CTX *ctx, size_t bytes, const char *location)
-{
- size_t bytes_allocated;
-
- bytes_allocated = talloc_total_size(ctx);
- if (bytes_allocated != bytes) {
- fprintf(stderr, "Leak report for %s:\n", location);
- talloc_report_full(ctx, stderr);
- fail("%s: memory leaks detected, %d bytes still allocated",
- location, bytes_allocated - bytes);
- }
-}
-
-void
-check_leaks_push(TALLOC_CTX *ctx)
-{
- struct size_snapshot *snapshot;
-
- snapshot = talloc(NULL, struct size_snapshot);
- snapshot->ctx = ctx;
- snapshot->bytes_allocated = talloc_total_size(ctx);
- DLIST_ADD(snapshot_stack, snapshot);
-}
-
-void
-_check_leaks_pop(TALLOC_CTX *ctx, const char *location)
-{
- struct size_snapshot *snapshot;
- TALLOC_CTX *old_ctx;
- size_t bytes_allocated;
-
- if (snapshot_stack == NULL) {
- fail("%s: trying to pop an empty stack");
- }
- snapshot = snapshot_stack;
- DLIST_REMOVE(snapshot_stack, snapshot);
-
- old_ctx = snapshot->ctx;
- bytes_allocated = snapshot->bytes_allocated;
-
- fail_if(old_ctx != ctx, "Bad push/pop order");
-
- talloc_zfree(snapshot);
- _check_leaks(old_ctx, bytes_allocated, location);
-}
+#include "tests/common.h"
-void
-leak_check_setup(void)
+void ck_leak_check_setup(void)
{
- talloc_enable_null_tracking();
- global_talloc_context = talloc_new(NULL);
- fail_unless(global_talloc_context != NULL, "talloc_new failed");
- check_leaks_push(global_talloc_context);
+ fail_unless(leak_check_setup() == true,
+ "Cannot set up leaks test: %s\n", check_leaks_err_msg());
}
-void
-leak_check_teardown(void)
+void ck_leak_check_teardown(void)
{
- check_leaks_pop(global_talloc_context);
- if (snapshot_stack != NULL) {
- fail("Exiting with a non-empty stack");
- }
- check_leaks(global_talloc_context, 0);
+ fail_unless(leak_check_teardown() == true,
+ "Cannot tear down leaks test: %s\n", check_leaks_err_msg());
}
diff --git a/src/tests/common_check.h b/src/tests/common_check.h
new file mode 100644
index 00000000..51c3c3f4
--- /dev/null
+++ b/src/tests/common_check.h
@@ -0,0 +1,36 @@
+/*
+ SSSD
+
+ Memory leak/growth checks for check-based tests using talloc.
+
+ Authors:
+ Martin Nagy <mnagy@redhat.com>
+
+ Copyright (C) Red Hat, Inc 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __TESTS_COMMON_CHECK_H__
+#define __TESTS_COMMON_CHECK_H__
+
+#include "tests/common.h"
+
+void ck_leak_check_setup(void);
+void ck_leak_check_teardown(void);
+
+#define ck_leaks_push(ctx) check_leaks_push(ctx)
+#define ck_leaks_pop(ctx) fail_unless(check_leaks_pop(ctx) == true, check_leaks_err_msg())
+
+#endif /* __TESTS_COMMON_CHECK_H__ */
diff --git a/src/tests/crypto-tests.c b/src/tests/crypto-tests.c
index 8932d8f5..87184594 100644
--- a/src/tests/crypto-tests.c
+++ b/src/tests/crypto-tests.c
@@ -26,7 +26,7 @@
#include <check.h>
#include "util/util.h"
-#include "tests/common.h"
+#include "tests/common_check.h"
/* interfaces under test */
#include "util/crypto/sss_crypto.h"
@@ -68,7 +68,7 @@ START_TEST(test_encrypt_decrypt)
test_ctx = talloc_new(NULL);
fail_if(test_ctx == NULL);
- check_leaks_push(test_ctx);
+ ck_leaks_push(test_ctx);
for (i=0; password[i]; i++) {
ret = sss_password_encrypt(test_ctx, password[i], strlen(password[i])+1,
@@ -84,7 +84,7 @@ START_TEST(test_encrypt_decrypt)
talloc_free(ctpwd);
}
- check_leaks_pop(test_ctx);
+ ck_leaks_pop(test_ctx);
talloc_free(test_ctx);
}
END_TEST
@@ -163,7 +163,7 @@ Suite *crypto_suite(void)
Suite *s = suite_create("sss_crypto");
TCase *tc = tcase_create("sss crypto tests");
- tcase_add_checked_fixture(tc, leak_check_setup, leak_check_teardown);
+ tcase_add_checked_fixture(tc, ck_leak_check_setup, ck_leak_check_teardown);
/* Do some testing */
#ifdef HAVE_NSS
tcase_add_test(tc, test_nss_init);
diff --git a/src/tests/fail_over-tests.c b/src/tests/fail_over-tests.c
index 93dda3a7..c0002596 100644
--- a/src/tests/fail_over-tests.c
+++ b/src/tests/fail_over-tests.c
@@ -32,7 +32,7 @@
#include <tevent.h>
#include "resolv/async_resolv.h"
-#include "tests/common.h"
+#include "tests/common_check.h"
#include "util/util.h"
/* Interface under test */
@@ -107,13 +107,13 @@ START_TEST(test_fo_new_service)
struct fo_service *services[10];
ctx = setup_test();
- check_leaks_push(ctx);
+ ck_leaks_push(ctx);
for (i = 0; i < 10; i++) {
char buf[16];
sprintf(buf, "service_%d", i);
- check_leaks_push(ctx);
+ ck_leaks_push(ctx);
ret = fo_new_service(ctx->fo_ctx, buf, NULL, &services[i]);
fail_if(ret != EOK);
}
@@ -129,13 +129,13 @@ START_TEST(test_fo_new_service)
fail_if(ret != EOK);
fail_if(service != services[i]);
talloc_free(service);
- check_leaks_pop(ctx);
+ ck_leaks_pop(ctx);
ret = fo_get_service(ctx->fo_ctx, buf, &service);
fail_if(ret != ENOENT);
}
- check_leaks_pop(ctx);
+ ck_leaks_pop(ctx);
talloc_free(ctx);
}
END_TEST
@@ -264,7 +264,7 @@ create_suite(void)
TCase *tc = tcase_create("FAIL_OVER Tests");
- tcase_add_checked_fixture(tc, leak_check_setup, leak_check_teardown);
+ tcase_add_checked_fixture(tc, ck_leak_check_setup, ck_leak_check_teardown);
/* Do some testing */
tcase_add_test(tc, test_fo_new_service);
tcase_add_test(tc, test_fo_resolve_service);
diff --git a/src/tests/ipa_hbac-tests.c b/src/tests/ipa_hbac-tests.c
index 330e49e7..3c64fe04 100644
--- a/src/tests/ipa_hbac-tests.c
+++ b/src/tests/ipa_hbac-tests.c
@@ -26,7 +26,7 @@
#include <sys/stat.h>
#include <talloc.h>
-#include "tests/common.h"
+#include "tests/common_check.h"
#include "providers/ipa/ipa_hbac.h"
#define HBAC_TEST_USER "testuser"
@@ -815,8 +815,8 @@ Suite *hbac_test_suite (void)
TCase *tc_hbac = tcase_create("HBAC_rules");
tcase_add_checked_fixture(tc_hbac,
- leak_check_setup,
- leak_check_teardown);
+ ck_leak_check_setup,
+ ck_leak_check_teardown);
tcase_add_test(tc_hbac, ipa_hbac_test_allow_all);
tcase_add_test(tc_hbac, ipa_hbac_test_allow_user);
diff --git a/src/tests/leak_check.c b/src/tests/leak_check.c
new file mode 100644
index 00000000..89dac357
--- /dev/null
+++ b/src/tests/leak_check.c
@@ -0,0 +1,132 @@
+/*
+ SSSD
+
+ Common utilities for check-based tests using talloc.
+
+ Authors:
+ Martin Nagy <mnagy@redhat.com>
+
+ Copyright (C) Red Hat, Inc 2009
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdio.h>
+#include <check.h>
+#include "tests/common.h"
+#include "util/util.h"
+#include "util/dlinklist.h"
+
+TALLOC_CTX *global_talloc_context = NULL;
+char leak_err_msg[256];
+
+struct size_snapshot {
+ struct size_snapshot *prev;
+ struct size_snapshot *next;
+
+ TALLOC_CTX *ctx;
+ size_t bytes_allocated;
+};
+
+static struct size_snapshot *snapshot_stack;
+
+#define _set_leak_err_msg(fmt, ...) do { \
+ snprintf(leak_err_msg, sizeof(leak_err_msg), \
+ fmt, ##__VA_ARGS__); \
+} while(0);
+
+const char *check_leaks_err_msg(void)
+{
+ return leak_err_msg;
+}
+
+bool
+_check_leaks(TALLOC_CTX *ctx, size_t bytes, const char *location)
+{
+ size_t bytes_allocated;
+
+ bytes_allocated = talloc_total_size(ctx);
+ if (bytes_allocated != bytes) {
+ fprintf(stderr, "Leak report for %s:\n", location);
+ talloc_report_full(ctx, stderr);
+ _set_leak_err_msg("%s: memory leaks detected, %zd bytes still allocated",
+ location, bytes_allocated - bytes);
+ return false;
+ }
+
+ return true;
+}
+
+void
+check_leaks_push(TALLOC_CTX *ctx)
+{
+ struct size_snapshot *snapshot;
+
+ snapshot = talloc(NULL, struct size_snapshot);
+ snapshot->ctx = ctx;
+ snapshot->bytes_allocated = talloc_total_size(ctx);
+ DLIST_ADD(snapshot_stack, snapshot);
+}
+
+bool
+_check_leaks_pop(TALLOC_CTX *ctx, const char *location)
+{
+ struct size_snapshot *snapshot;
+ TALLOC_CTX *old_ctx;
+ size_t bytes_allocated;
+
+ if (snapshot_stack == NULL) {
+ _set_leak_err_msg("%s: trying to pop an empty stack", location);
+ return false;
+ }
+
+ snapshot = snapshot_stack;
+ DLIST_REMOVE(snapshot_stack, snapshot);
+
+ old_ctx = snapshot->ctx;
+ bytes_allocated = snapshot->bytes_allocated;
+
+ if (old_ctx != ctx) {
+ _set_leak_err_msg("Bad push/pop order");
+ return false;
+ }
+
+ talloc_zfree(snapshot);
+ return _check_leaks(old_ctx, bytes_allocated, location);
+}
+
+bool
+leak_check_setup(void)
+{
+ talloc_enable_null_tracking();
+ global_talloc_context = talloc_new(NULL);
+ if (global_talloc_context == NULL) {
+ _set_leak_err_msg("talloc_new failed");
+ return false;
+ }
+
+ check_leaks_push(global_talloc_context);
+ return true;
+}
+
+bool
+leak_check_teardown(void)
+{
+ check_leaks_pop(global_talloc_context);
+ if (snapshot_stack != NULL) {
+ _set_leak_err_msg("Exiting with a non-empty stack");
+ return false;
+ }
+ return check_leaks(global_talloc_context, 0);
+}
diff --git a/src/tests/pac_responder-tests.c b/src/tests/pac_responder-tests.c
index 4b6f03f5..ed8c9170 100644
--- a/src/tests/pac_responder-tests.c
+++ b/src/tests/pac_responder-tests.c
@@ -27,7 +27,7 @@
#include <util/data_blob.h>
#include <gen_ndr/security.h>
-#include "tests/common.h"
+#include "tests/common_check.h"
#include "responder/pac/pacsrv.h"
#include "lib/idmap/sss_idmap.h"
@@ -488,8 +488,8 @@ Suite *idmap_test_suite (void)
TCase *tc_pac = tcase_create("PAC responder tests");
tcase_add_checked_fixture(tc_pac,
- leak_check_setup,
- leak_check_teardown);
+ ck_leak_check_setup,
+ ck_leak_check_teardown);
tcase_add_checked_fixture(tc_pac,
pac_setup,
diff --git a/src/tests/refcount-tests.c b/src/tests/refcount-tests.c
index d93f1561..9713d478 100644
--- a/src/tests/refcount-tests.c
+++ b/src/tests/refcount-tests.c
@@ -28,7 +28,7 @@
#include <tevent.h>
#include <popt.h>
-#include "tests/common.h"
+#include "tests/common_check.h"
#include "util/util.h"
/* Interface under test */
@@ -146,7 +146,7 @@ START_TEST(test_refcount_swap)
tmp_ctx = talloc_new(NULL);
- check_leaks_push(tmp_ctx);
+ ck_leaks_push(tmp_ctx);
container1 = talloc(tmp_ctx, struct container);
container2 = talloc(tmp_ctx, struct container);
@@ -170,7 +170,7 @@ START_TEST(test_refcount_swap)
CHECK_FILLER(container2->foo);
talloc_free(container2);
- check_leaks_pop(tmp_ctx);
+ ck_leaks_pop(tmp_ctx);
talloc_free(tmp_ctx);
}
END_TEST
@@ -182,7 +182,7 @@ Suite *create_suite(void)
TCase *tc = tcase_create("REFCOUNT Tests");
/* Do some testing */
- tcase_add_checked_fixture(tc, leak_check_setup, leak_check_teardown);
+ tcase_add_checked_fixture(tc, ck_leak_check_setup, ck_leak_check_teardown);
tcase_add_test(tc, test_refcount_basic);
tcase_add_test(tc, test_refcount_swap);
diff --git a/src/tests/resolv-tests.c b/src/tests/resolv-tests.c
index 61308e38..dd212c05 100644
--- a/src/tests/resolv-tests.c
+++ b/src/tests/resolv-tests.c
@@ -33,7 +33,7 @@
#include "tests/common.h"
#include "util/util.h"
-#include "tests/common.h"
+#include "tests/common_check.h"
/* Interface under test */
#include "resolv/async_resolv.h"
@@ -118,7 +118,7 @@ START_TEST(test_copy_hostent)
ctx = talloc_new(global_talloc_context);
fail_if(ctx == NULL);
- check_leaks_push(ctx);
+ ck_leaks_push(ctx);
rhe = resolv_copy_hostent_ares(ctx, &he, AF_INET, &attl, 2);
@@ -151,7 +151,7 @@ START_TEST(test_copy_hostent)
talloc_free(rhe);
- check_leaks_pop(ctx);
+ ck_leaks_pop(ctx);
}
END_TEST
@@ -203,7 +203,7 @@ START_TEST(test_resolv_ip_addr)
return;
}
- check_leaks_push(test_ctx);
+ ck_leaks_push(test_ctx);
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_ONLY,
default_host_dbs);
@@ -217,7 +217,7 @@ START_TEST(test_resolv_ip_addr)
ret = test_loop(test_ctx);
}
- check_leaks_pop(test_ctx);
+ ck_leaks_pop(test_ctx);
fail_unless(ret == EOK);
talloc_zfree(test_ctx);
@@ -272,7 +272,7 @@ START_TEST(test_resolv_localhost)
return;
}
- check_leaks_push(test_ctx);
+ ck_leaks_push(test_ctx);
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_FIRST,
default_host_dbs);
@@ -286,7 +286,7 @@ START_TEST(test_resolv_localhost)
ret = test_loop(test_ctx);
}
- check_leaks_pop(test_ctx);
+ ck_leaks_pop(test_ctx);
fail_unless(ret == EOK);
talloc_zfree(test_ctx);
@@ -328,7 +328,7 @@ START_TEST(test_resolv_negative)
return;
}
- check_leaks_push(test_ctx);
+ ck_leaks_push(test_ctx);
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_FIRST,
default_host_dbs);
@@ -342,7 +342,7 @@ START_TEST(test_resolv_negative)
ret = test_loop(test_ctx);
}
- check_leaks_pop(test_ctx);
+ ck_leaks_pop(test_ctx);
fail_unless(ret != EOK);
fail_unless(test_ctx->error == ARES_ENOTFOUND);
@@ -366,7 +366,7 @@ static void test_internet(struct tevent_req *req)
test_ctx->done = true;
tmp_ctx = talloc_new(test_ctx);
- check_leaks_push(tmp_ctx);
+ ck_leaks_push(tmp_ctx);
switch (test_ctx->tested_function) {
case TESTING_HOSTNAME:
@@ -417,7 +417,7 @@ static void test_internet(struct tevent_req *req)
} else if (srv_replies != NULL) {
talloc_free(srv_replies);
}
- check_leaks_pop(tmp_ctx);
+ ck_leaks_pop(tmp_ctx);
}
START_TEST(test_resolv_internet)
@@ -434,7 +434,7 @@ START_TEST(test_resolv_internet)
}
test_ctx->tested_function = TESTING_HOSTNAME;
- check_leaks_push(test_ctx);
+ ck_leaks_push(test_ctx);
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_FIRST,
default_host_dbs);
@@ -449,7 +449,7 @@ START_TEST(test_resolv_internet)
}
fail_unless(ret == EOK);
- check_leaks_pop(test_ctx);
+ ck_leaks_pop(test_ctx);
talloc_zfree(test_ctx);
}
END_TEST
@@ -464,7 +464,7 @@ START_TEST(test_resolv_internet_txt)
fail_if(ret != EOK, "Could not set up test");
test_ctx->tested_function = TESTING_TXT;
- check_leaks_push(test_ctx);
+ ck_leaks_push(test_ctx);
req = resolv_gettxt_send(test_ctx, test_ctx->ev, test_ctx->resolv, txt_host);
fail_if(req == NULL, "Function resolv_gettxt_send failed");
@@ -473,7 +473,7 @@ START_TEST(test_resolv_internet_txt)
ret = test_loop(test_ctx);
fail_unless(ret == EOK);
- check_leaks_pop(test_ctx);
+ ck_leaks_pop(test_ctx);
talloc_zfree(test_ctx);
}
@@ -489,7 +489,7 @@ START_TEST(test_resolv_internet_srv)
fail_if(ret != EOK, "Could not set up test");
test_ctx->tested_function = TESTING_SRV;
- check_leaks_push(test_ctx);
+ ck_leaks_push(test_ctx);
req = resolv_getsrv_send(test_ctx, test_ctx->ev, test_ctx->resolv, srv_host);
fail_if(req == NULL, "Function resolv_getsrv_send failed");
@@ -498,7 +498,7 @@ START_TEST(test_resolv_internet_srv)
ret = test_loop(test_ctx);
fail_unless(ret == EOK);
- check_leaks_pop(test_ctx);
+ ck_leaks_pop(test_ctx);
talloc_zfree(test_ctx);
}
@@ -600,7 +600,7 @@ START_TEST(test_resolv_sort_srv_reply)
return;
}
- check_leaks_push(test_ctx);
+ ck_leaks_push(test_ctx);
/* prepare linked list with reversed values */
for (i = 0; i<num_replies; i++) {
@@ -667,7 +667,7 @@ START_TEST(test_resolv_sort_srv_reply)
/* check for leaks */
- check_leaks_pop(test_ctx);
+ ck_leaks_pop(test_ctx);
talloc_zfree(test_ctx);
}
END_TEST
@@ -687,7 +687,7 @@ START_TEST(test_resolv_free_req)
return;
}
- check_leaks_push(test_ctx);
+ ck_leaks_push(test_ctx);
req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
test_ctx->resolv, hostname, IPV4_FIRST,
default_host_dbs);
@@ -716,7 +716,7 @@ START_TEST(test_resolv_free_req)
}
ret = test_loop(test_ctx);
- check_leaks_pop(test_ctx);
+ ck_leaks_pop(test_ctx);
fail_unless(ret == EOK);
done:
@@ -737,7 +737,7 @@ static void test_timeout(struct tevent_req *req)
test_ctx->done = true;
tmp_ctx = talloc_new(test_ctx);
- check_leaks_push(tmp_ctx);
+ ck_leaks_push(tmp_ctx);
fail_unless(test_ctx->tested_function == TESTING_HOSTNAME);
recv_status = resolv_gethostbyname_recv(req, tmp_ctx,
@@ -745,7 +745,7 @@ static void test_timeout(struct tevent_req *req)
talloc_zfree(req);
fail_unless(recv_status == ETIMEDOUT);
fail_unless(status == ARES_ETIMEOUT);
- check_leaks_pop(tmp_ctx);
+ ck_leaks_pop(tmp_ctx);
talloc_free(tmp_ctx);
}
@@ -788,7 +788,7 @@ Suite *create_resolv_suite(void)
TCase *tc_resolv = tcase_create("RESOLV Tests");
- tcase_add_checked_fixture(tc_resolv, leak_check_setup, leak_check_teardown);
+ tcase_add_checked_fixture(tc_resolv, ck_leak_check_setup, ck_leak_check_teardown);
/* Do some testing */
tcase_add_test(tc_resolv, test_copy_hostent);
tcase_add_test(tc_resolv, test_resolv_ip_addr);
diff --git a/src/tests/sss_idmap-tests.c b/src/tests/sss_idmap-tests.c
index e6d75372..eb204137 100644
--- a/src/tests/sss_idmap-tests.c
+++ b/src/tests/sss_idmap-tests.c
@@ -24,7 +24,7 @@
#include "lib/idmap/sss_idmap.h"
#include "lib/idmap/sss_idmap_private.h"
-#include "tests/common.h"
+#include "tests/common_check.h"
#define IDMAP_RANGE_MIN 1234
#define IDMAP_RANGE_MAX 9876
@@ -492,8 +492,8 @@ Suite *idmap_test_suite (void)
TCase *tc_init = tcase_create("IDMAP init tests");
tcase_add_checked_fixture(tc_init,
- leak_check_setup,
- leak_check_teardown);
+ ck_leak_check_setup,
+ ck_leak_check_teardown);
tcase_add_test(tc_init, idmap_test_init_malloc);
tcase_add_test(tc_init, idmap_test_init_talloc);
@@ -503,8 +503,8 @@ Suite *idmap_test_suite (void)
TCase *tc_dom = tcase_create("IDMAP domain tests");
tcase_add_checked_fixture(tc_dom,
- leak_check_setup,
- leak_check_teardown);
+ ck_leak_check_setup,
+ ck_leak_check_teardown);
tcase_add_checked_fixture(tc_dom,
idmap_ctx_setup,
idmap_ctx_teardown);
@@ -515,8 +515,8 @@ Suite *idmap_test_suite (void)
TCase *tc_conv = tcase_create("IDMAP SID conversion tests");
tcase_add_checked_fixture(tc_conv,
- leak_check_setup,
- leak_check_teardown);
+ ck_leak_check_setup,
+ ck_leak_check_teardown);
tcase_add_checked_fixture(tc_conv,
idmap_ctx_setup,
idmap_ctx_teardown);
@@ -536,8 +536,8 @@ Suite *idmap_test_suite (void)
TCase *tc_map = tcase_create("IDMAP mapping tests");
tcase_add_checked_fixture(tc_map,
- leak_check_setup,
- leak_check_teardown);
+ ck_leak_check_setup,
+ ck_leak_check_teardown);
tcase_add_checked_fixture(tc_map,
idmap_ctx_setup,
idmap_ctx_teardown);
diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c
index e7e04e65..4b0d5009 100644
--- a/src/tests/util-tests.c
+++ b/src/tests/util-tests.c
@@ -31,7 +31,7 @@
#include "util/util.h"
#include "util/sss_utf8.h"
#include "util/murmurhash3.h"
-#include "tests/common.h"
+#include "tests/common_check.h"
#define FILENAME_TEMPLATE "tests-atomicio-XXXXXX"
char *filename;
@@ -815,8 +815,8 @@ Suite *util_suite(void)
TCase *tc_util = tcase_create("util");
tcase_add_checked_fixture(tc_util,
- leak_check_setup,
- leak_check_teardown);
+ ck_leak_check_setup,
+ ck_leak_check_teardown);
tcase_add_test (tc_util, test_diff_string_lists);
tcase_add_test (tc_util, test_sss_filter_sanitize);
tcase_add_test (tc_util, test_size_t_overflow);