[SSSD] [PATCH] TESTS: extend PAM responder unit test

Lukas Slebodnik lslebodn at redhat.com
Wed Nov 4 12:45:02 UTC 2015


On (04/11/15 13:42), Lukas Slebodnik wrote:
>On (20/10/15 15:21), Pavel Reichl wrote:
>>Hello,
>>
>>please see first iteration of extended PAM responder unit tests.
>
>>From 7cd365de5c306cb42901e510ff14df1b76c6bddb Mon Sep 17 00:00:00 2001
>>From: Pavel Reichl <preichl at redhat.com>
>>Date: Tue, 20 Oct 2015 08:07:02 -0400
>>Subject: [PATCH 1/3] TESTS: split pam_test_setup() so it can be reused
>>
>>Split pam_test_setup() so domain and pam parameters can be easily set
>>distinctly for each test.
>>
>>Resolves:
>>https://fedorahosted.org/sssd/ticket/2697
>>---
>> src/tests/cmocka/test_pam_srv.c | 34 +++++++++++++++++++---------------
>> 1 file changed, 19 insertions(+), 15 deletions(-)
>>
>>diff --git a/src/tests/cmocka/test_pam_srv.c b/src/tests/cmocka/test_pam_srv.c
>>index dbdc4ae08a12914481137fe8fb5a24d242d3032f..e15a2a40428c2b12301de4690d729b4073119c2f 100644
>>--- a/src/tests/cmocka/test_pam_srv.c
>>+++ b/src/tests/cmocka/test_pam_srv.c
>>@@ -247,22 +247,9 @@ void test_pam_setup(struct sss_test_conf_param dom_params[],
>>     pam_test_ctx->cctx->ev = pam_test_ctx->tctx->ev;
>> }
>> 
>>-static int pam_test_setup(void **state)
>>+static void pam_test_setup_common(void)
>> {
>>-    int ret;
>>-
>>-    struct sss_test_conf_param dom_params[] = {
>>-        { "enumerate", "false" },
>>-        { "cache_credentials", "true" },
>>-        { NULL, NULL },             /* Sentinel */
>>-    };
>>-
>>-    struct sss_test_conf_param pam_params[] = {
>>-        { "p11_child_timeout", "30"},
>>-        { NULL, NULL },             /* Sentinel */
>>-    };
>>-
>>-    test_pam_setup(dom_params, pam_params, state);
>>+    errno_t ret;
>> 
>>     /* Prime the cache with a valid user */
>>     ret = sysdb_add_user(pam_test_ctx->tctx->dom,
>>@@ -293,7 +280,24 @@ static int pam_test_setup(void **state)
>>                                discard_const("wronguser"),
>>                                pam_test_ctx->pctx->id_timeout);
>>     assert_int_equal(ret, EOK);
>>+}
>> 
>>+static int pam_test_setup(void **state)
>>+{
>>+    struct sss_test_conf_param dom_params[] = {
>>+        { "enumerate", "false" },
>>+        { "cache_credentials", "true" },
>>+        { NULL, NULL },             /* Sentinel */
>>+    };
>>+
>>+    struct sss_test_conf_param pam_params[] = {
>>+        { "p11_child_timeout", "30"},
>                                     ^
>                                    missing space
>
>>+        { NULL, NULL },             /* Sentinel */
>>+    };
>>+
>>+    test_pam_setup(dom_params, pam_params, state);
>>+
>>+    pam_test_setup_common();
>>     return 0;
>> }
>> 
>>-- 
>>2.4.3
>>
>
>>From fa082a04387ed83f1b12316d388b63a08ba1305d Mon Sep 17 00:00:00 2001
>>From: Pavel Reichl <preichl at redhat.com>
>>Date: Tue, 20 Oct 2015 09:10:30 -0400
>>Subject: [PATCH 2/3] TESTS: extend PAM responder unit test
>>
and maybe title of commit message could be changed as well.

Becuase many changes to unit tests mean extending unit test.
BTW. prefix "TEST:" usually means that tou adding new test
or you are doing changes among more unit tests.

LS


More information about the sssd-devel mailing list