summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2015-10-24 15:15:39 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-11-11 12:10:45 +0100
commit20a2be57d764f58c4a6532310331e26a3273ada8 (patch)
tree3658c8bce6bb65d3ac3318e5b07cb1bd944ad0dc /src
parent9c62d6619b87f1255ef6515280a20552fca9d925 (diff)
downloadsssd-20a2be57d764f58c4a6532310331e26a3273ada8.tar.gz
sssd-20a2be57d764f58c4a6532310331e26a3273ada8.tar.xz
sssd-20a2be57d764f58c4a6532310331e26a3273ada8.zip
TESTS: Check return value of check_leaks_pop
Reviewed-by: Petr Cech <pcech@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/tests/cmocka/test_child_common.c3
-rw-r--r--src/tests/cwrap/test_become_user.c5
-rw-r--r--src/tests/cwrap/test_responder_common.c6
-rw-r--r--src/tests/krb5_utils-tests.c6
-rw-r--r--src/tests/leak_check.c6
5 files changed, 16 insertions, 10 deletions
diff --git a/src/tests/cmocka/test_child_common.c b/src/tests/cmocka/test_child_common.c
index f8fd762fe..bf500fa5a 100644
--- a/src/tests/cmocka/test_child_common.c
+++ b/src/tests/cmocka/test_child_common.c
@@ -76,7 +76,8 @@ static int child_test_teardown(void **state)
struct child_test_ctx);
talloc_free(child_tctx);
- check_leaks_pop(global_talloc_context);
+
+ assert_true(check_leaks_pop(global_talloc_context));
assert_true(leak_check_teardown());
return 0;
}
diff --git a/src/tests/cwrap/test_become_user.c b/src/tests/cwrap/test_become_user.c
index 48e16d4c7..feb688952 100644
--- a/src/tests/cwrap/test_become_user.c
+++ b/src/tests/cwrap/test_become_user.c
@@ -120,9 +120,10 @@ void test_switch_user(void **state)
assert_int_equal(getgid(), 0);
talloc_free(saved_creds);
- check_leaks_pop(tmp_ctx);
+ assert_true(check_leaks_pop(tmp_ctx));
talloc_free(tmp_ctx);
- check_leaks_pop(global_talloc_context);
+
+ assert_true(check_leaks_pop(global_talloc_context));
assert_true(leak_check_teardown());
}
diff --git a/src/tests/cwrap/test_responder_common.c b/src/tests/cwrap/test_responder_common.c
index 2c92ff080..024065bc1 100644
--- a/src/tests/cwrap/test_responder_common.c
+++ b/src/tests/cwrap/test_responder_common.c
@@ -60,7 +60,7 @@ void test_uid_csv_to_uid_list(void **state)
assert_int_equal(list[2], 3);
talloc_free(list);
- check_leaks_pop(tmp_ctx);
+ assert_true(check_leaks_pop(tmp_ctx));
talloc_free(tmp_ctx);
}
@@ -83,7 +83,7 @@ void test_name_csv_to_uid_list(void **state)
assert_int_equal(list[1], 10001);
talloc_free(list);
- check_leaks_pop(tmp_ctx);
+ assert_true(check_leaks_pop(tmp_ctx));
talloc_free(tmp_ctx);
}
@@ -102,7 +102,7 @@ void test_csv_to_uid_list_neg(void **state)
ret = csv_string_to_uid_array(tmp_ctx, "nosuchuser", true, &count, &list);
assert_int_not_equal(ret, EOK);
- check_leaks_pop(tmp_ctx);
+ assert_true(check_leaks_pop(tmp_ctx));
talloc_free(tmp_ctx);
}
diff --git a/src/tests/krb5_utils-tests.c b/src/tests/krb5_utils-tests.c
index c2db5af9a..ea40feb45 100644
--- a/src/tests/krb5_utils-tests.c
+++ b/src/tests/krb5_utils-tests.c
@@ -634,7 +634,7 @@ START_TEST(test_parse_krb5_map_user)
name_to_primary[0].krb_primary == NULL);
talloc_free(name_to_primary);
- check_leaks_pop(mem_ctx);
+ fail_unless(check_leaks_pop(mem_ctx));
}
/* valid input */
{
@@ -653,7 +653,7 @@ START_TEST(test_parse_krb5_map_user)
compare_map_id_name_to_krb_primary(name_to_primary, expected,
sizeof(expected)/sizeof(const char*)/2);
talloc_free(name_to_primary);
- check_leaks_pop(mem_ctx);
+ fail_unless(check_leaks_pop(mem_ctx));
}
/* invalid input */
{
@@ -677,7 +677,7 @@ START_TEST(test_parse_krb5_map_user)
ret = parse_krb5_map_user(mem_ctx, "joe:j:user", &name_to_primary);
fail_unless(ret == EINVAL);
- check_leaks_pop(mem_ctx);
+ fail_unless(check_leaks_pop(mem_ctx));
}
talloc_free(mem_ctx);
diff --git a/src/tests/leak_check.c b/src/tests/leak_check.c
index 1eaa2cd09..79c8f05f6 100644
--- a/src/tests/leak_check.c
+++ b/src/tests/leak_check.c
@@ -131,7 +131,11 @@ bool
leak_check_teardown(void)
{
bool res;
- check_leaks_pop(global_talloc_context);
+ res = check_leaks_pop(global_talloc_context);
+ if (!res) {
+ _set_leak_err_msg("check_leaks_pop failed in leak_check_teardown");
+ }
+
if (snapshot_stack != NULL) {
_set_leak_err_msg("Exiting with a non-empty stack");
return false;