Re: [SSSD] [PATCH] TEST: recent_valid filter testing

2015-11-01 Thread Petr Cech

On 10/27/2015 09:42 AM, Petr Cech wrote:

The removed tests were:
  * users_by_filter_valid
  * users_by_filter_multiple_domains_valid
  * groups_by_filter_valid
  * groups_by_filter_multiple_domains_valid


Hello,

another patch set is attached.

This patch set covers groups_by_filter_valid by two new tests:
 * group_by_recent_filter_valid
 * groups_by_recent_filter_valid

The first of them tests the recent filter. The second tests interface 
ability to return more groups.



I looked at multiple_domains tests too. But I am afraid I misunderstood 
their purpose. Because users/groups are set with the same domains. I 
will look at it once again.


Regards,

Petr
>From 9c2cf658b62734df71650b568bd1c6be6c4c6e43 Mon Sep 17 00:00:00 2001
From: Petr Cech 
Date: Sun, 1 Nov 2015 07:09:28 -0500
Subject: [PATCH 4/6] TEST: Add test_group_by_recent_filter_valid

Test groups_by_filter_valid() was removed in past. We will add two new
tests instead of it. Logic of those tests is connected to RECENT
filter. It returns only records which have been wrote or updated after
filter was created (or another given time).

groups_by_filter_valid() --> group_by_recent_filter_valid()
 grous_by_recent_filter_valid()

The first of new tests, group_by_recent_filter_valid(), counts with two
groups. One is stored before filter request creation and the second
group is stored after filter request creation. So filter returns only
one group.

The second of new tests, groups_by_recent_filter_valid(), counts with
three users. One is stored before filter request creation and two
groups are stored after filter request creation. So filter returns two
groups.

This patch adds group_by_recent_filter_valid().

Resolves:
https://fedorahosted.org/sssd/ticket/2730
---
 src/tests/cmocka/test_responder_cache_req.c | 45 +
 1 file changed, 45 insertions(+)

diff --git a/src/tests/cmocka/test_responder_cache_req.c b/src/tests/cmocka/test_responder_cache_req.c
index e4fccdab883f267cced1cf2e9995bd9828242690..77bdde40917b576b2b97d92d9dc23900085a11ae 100644
--- a/src/tests/cmocka/test_responder_cache_req.c
+++ b/src/tests/cmocka/test_responder_cache_req.c
@@ -1495,6 +1495,50 @@ static void cache_req_group_by_filter_test_done(struct tevent_req *req)
 ctx->tctx->done = true;
 }
 
+void test_group_by_recent_filter_valid(void **state)
+{
+struct cache_req_test_ctx *test_ctx = NULL;
+TALLOC_CTX *req_mem_ctx = NULL;
+struct tevent_req *req = NULL;
+const char *ldbname = NULL;
+errno_t ret;
+
+test_ctx = talloc_get_type_abort(*state, struct cache_req_test_ctx);
+test_ctx->create_group = true;
+
+ret = sysdb_store_group(test_ctx->tctx->dom, TEST_GROUP_NAME2,
+1001, NULL, 1001, time(NULL));
+assert_int_equal(ret, EOK);
+
+sleep(1);
+
+req_mem_ctx = talloc_new(global_talloc_context);
+check_leaks_push(req_mem_ctx);
+
+/* Filters always go to DP */
+will_return(__wrap_sss_dp_get_account_send, test_ctx);
+mock_account_recv_simple();
+
+req = cache_req_group_by_filter_send(req_mem_ctx, test_ctx->tctx->ev,
+ test_ctx->rctx,
+ test_ctx->tctx->dom->name,
+ "test*");
+assert_non_null(req);
+tevent_req_set_callback(req, cache_req_group_by_filter_test_done, test_ctx);
+
+ret = test_ev_loop(test_ctx->tctx);
+assert_int_equal(ret, ERR_OK);
+assert_true(check_leaks_pop(req_mem_ctx));
+
+assert_non_null(test_ctx->result);
+assert_int_equal(test_ctx->result->count, 1);
+
+ldbname = ldb_msg_find_attr_as_string(test_ctx->result->msgs[0],
+  SYSDB_NAME, NULL);
+assert_non_null(ldbname);
+assert_string_equal(ldbname, TEST_GROUP_NAME);
+}
+
 void test_groups_by_filter_notfound(void **state)
 {
 struct cache_req_test_ctx *test_ctx = NULL;
@@ -1615,6 +1659,7 @@ int main(int argc, const char *argv[])
 
 new_single_domain_test(user_by_recent_filter_valid),
 new_single_domain_test(users_by_recent_filter_valid),
+new_single_domain_test(group_by_recent_filter_valid),
 
 new_single_domain_test(users_by_filter_filter_old),
 new_single_domain_test(users_by_filter_notfound),
-- 
2.4.3

>From 4efa3966f20791d65c439ff450b473c6d9419eff Mon Sep 17 00:00:00 2001
From: Petr Cech 
Date: Sun, 1 Nov 2015 07:21:18 -0500
Subject: [PATCH 5/6] TEST: Refactor of test_responder_cache_req.c

We need little more in backroung of responder_cache_req tests. There
will be tests which will use three test groups. This patch add support
for it.

Resolves:
https://fedorahosted.org/sssd/ticket/2730
---
 src/tests/cmocka/test_responder_cache_req.c | 20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/tests/cmocka/test_responder_cache_req.c 

Re: [SSSD] [PATCH] NSS: fix a use-after-free issue

2015-11-01 Thread Jakub Hrozek
On Fri, Oct 30, 2015 at 05:35:40PM +0100, Sumit Bose wrote:
> Does anyone know if it is possible to
> tell Converity to assume debug_level is set to 10?

IIRC Coverity only runs make, but would it help to run the integration
tests with debugging enabled and MALLOC_PERTURB_ and "hope" they would
crash?
___
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel