[SSSD] [PATCH] TESTS: Build test_child even without cmocka
Jakub Hrozek
jhrozek at redhat.com
Wed Dec 3 21:02:54 UTC 2014
On Wed, Dec 03, 2014 at 09:28:28PM +0100, Lukas Slebodnik wrote:
> On (03/12/14 20:00), Jakub Hrozek wrote:
> >On Wed, Dec 03, 2014 at 06:37:35PM +0100, Lukas Slebodnik wrote:
> >> On (03/12/14 18:12), Jakub Hrozek wrote:
> >> >test_child was declared to be build always but only actually built when
> >> >cmocka was available, which is not the case on all platforms.
> >> >
> >> >We can either 1) move the test_child outside the HAVE_CMOCKA or 2) only
> >> >append test_child to check_PROGRAMS when cmocka is available which is what
> >> >the attached patch does.
> >> >
> >> >I'm fine with either option. Thanks for opinions/review.
> >>
> >> >From 67db9748960fbaf6deac4c01084bc23bc1321723 Mon Sep 17 00:00:00 2001
> >> >From: Jakub Hrozek <jhrozek at redhat.com>
> >> >Date: Wed, 3 Dec 2014 17:00:25 +0100
> >> >Subject: [PATCH] TESTS: Build test_child even without cmocka
> >> >
> >> >---
> >> > Makefile.am | 5 ++++-
> >> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >> >
> >> >diff --git a/Makefile.am b/Makefile.am
> >> >index 7a36543061789bbd370fcbb118b66edeb8025e89..6d754f062245cc073c945218f6755dab1c59c543 100644
> >> >--- a/Makefile.am
> >> >+++ b/Makefile.am
> >> >@@ -236,10 +236,13 @@ endif # HAVE_CMOCKA
> >> > check_PROGRAMS = \
> >> > stress-tests \
> >> > krb5-child-test \
> >> >- test-child \
> >>
> >> test-child is simple program without external dependencies.
> >> It does not depend on libcmocka therefore should not be in block HAVE_CMOCKA.
> >
> >But currently it's only built to supplement a cmocka program, so
> >building it would be useless.
> >
> I am not strictly against this micro optimisation.
>
> >>
> >> On the other hand, I am not strictly against. If you decide to do such change
> >> then please also change the name of this binary. This binary isn't test.
> >> It is executable file which is used by another test.
> >
> >it's a child program used by the test_child_common.c unit and actually
> >depends on it via environment variables. Can you suggest a better name?
> >I generally suck at naming things and tbh don't consider the name too
> >important to spend much time on.
>
> The name was confusing for me. I wanted to execute child test to fix a valgrind
> issue. And my 1st attempt was wong.
>
> sh$ ./test-child
> (Wed Dec 3 21:18:14:367425 2014) [sssd] [main] (0x0400): test_child completed successfully
>
> the 2nd attept works.
> sh$ ./test_child_common
> [==========] Running 2 test(s).
> [ RUN ] test_exec_child
> [ OK ] test_exec_child
> [ RUN ] test_exec_child_extra_args
> [ OK ] test_exec_child_extra_args
> [==========] 2 test(s) run.
> [ PASSED ] 2 test(s).
>
> 0 FAILED TEST(S)
>
>
> We have {ldap,krb5,selinux}-child.
> IMHO the better name would be simple-child or dummy-child (maybe example-child)
Well, I tried to also couple the tests via name...but as I said, I'm not
the best when it comes to naming anything (I hope my wife will be the
one who names our kids ;-))
See additional patch that renames the patch to dummy-child. Too bad we
haven't named the test 'properly' before pushing it, but..oh well.
>
> BTW confusion can be caused by the fact that we are not uniform with name
> of tests.
>
> Some tests have suffix "-tests" sydb-tests, dyndns-tests ...
> and others have prefix "test[-_]": test-find-uid, test-authtok, test_sss_idmap,
> test_search_bases ...
>
We can agree on a naming scheme for new tests (I've been using
test-$module myself) but please don't spend any time on renaming old
tests. That's just busywork.
-------------- next part --------------
>From 67db9748960fbaf6deac4c01084bc23bc1321723 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 3 Dec 2014 17:00:25 +0100
Subject: [PATCH 1/2] TESTS: Build test_child even without cmocka
---
Makefile.am | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 7a36543061789bbd370fcbb118b66edeb8025e89..6d754f062245cc073c945218f6755dab1c59c543 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -236,10 +236,13 @@ endif # HAVE_CMOCKA
check_PROGRAMS = \
stress-tests \
krb5-child-test \
- test-child \
$(non_interactive_cmocka_based_tests) \
$(non_interactive_check_based_tests)
+if HAVE_CMOCKA
+check_PROGRAMS += test-child
+endif # HAVE_CMOCKA
+
PYTHON_TESTS =
if BUILD_PYTHON_BINDINGS
--
1.9.3
-------------- next part --------------
>From 49d77f1077ff1bb73c050b2117d344193191b770 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 3 Dec 2014 21:50:02 +0100
Subject: [PATCH 2/2] Rename test-child to dummy-child
---
Makefile.am | 8 ++++----
src/tests/cmocka/{test_child.c => dummy_child.c} | 0
src/tests/cmocka/test_child_common.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
rename src/tests/cmocka/{test_child.c => dummy_child.c} (100%)
diff --git a/Makefile.am b/Makefile.am
index 6d754f062245cc073c945218f6755dab1c59c543..b0041abf2c142325e6dfe370efdb43242bf034ff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -240,7 +240,7 @@ check_PROGRAMS = \
$(non_interactive_check_based_tests)
if HAVE_CMOCKA
-check_PROGRAMS += test-child
+check_PROGRAMS += dummy-child
endif # HAVE_CMOCKA
PYTHON_TESTS =
@@ -2163,10 +2163,10 @@ test_copy_keytab_LDADD = \
libsss_test_common.la \
$(NULL)
-test_child_SOURCES = \
- src/tests/cmocka/test_child.c \
+dummy_child_SOURCES = \
+ src/tests/cmocka/dummy_child.c \
$(NULL)
-test_child_LDADD = \
+dummy_child_LDADD = \
$(POPT_LIBS) \
$(SSSD_INTERNAL_LTLIBS) \
$(NULL)
diff --git a/src/tests/cmocka/test_child.c b/src/tests/cmocka/dummy_child.c
similarity index 100%
rename from src/tests/cmocka/test_child.c
rename to src/tests/cmocka/dummy_child.c
diff --git a/src/tests/cmocka/test_child_common.c b/src/tests/cmocka/test_child_common.c
index 112ed0ad97294bc45eac7c2124155e6b1908ad92..ee6e297f58b0895b5401464bb3f9b5386a3e6411 100644
--- a/src/tests/cmocka/test_child_common.c
+++ b/src/tests/cmocka/test_child_common.c
@@ -28,7 +28,7 @@
#include "util/child_common.h"
#include "tests/cmocka/common_mock.h"
-#define TEST_BIN "test-child"
+#define TEST_BIN "dummy-child"
#define ECHO_STR "Hello child"
struct child_test_ctx {
--
1.9.3
More information about the sssd-devel
mailing list