[SSSD] [PATCHES] BUILD: Speed up build of some tests

Lukas Slebodnik lslebodn at redhat.com
Wed Sep 2 04:50:43 UTC 2015


ehlo,

Attached patches reduce count of compiled ".c" files
from 935 -> 815 (almost 9%). This reduction is achieved
in deduplication of compiling "*.c" files in tests.

BTW the tests were compiled 4 times in our CI script.
 * make tests
 * mock build
 * make distcheck
 * code coverage

The result saving will not be 9% of time due to parallel build
but it still worth. (and Makefile.am is simpler)

LS
-------------- next part --------------
>From af4692d2ca217bcc7d0fb6128c5ecbc1ab30a6d1 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 1 Sep 2015 09:29:50 +0200
Subject: [PATCH 1/3] BUILD: Build libdlopen_test_providers.la as a dynamic
 library

Module which can be loaded by dlopen but cannot be linked with
other binaries.

*** Warning: Linking the executable test_xyzp against the loadable module
*** libdlopen_test_providers.so is not portable!
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index fdec9b30b802779912caa551650cd7bb5856f7b3..4e0dee7a91d5102bcb30d68a095660ab31826a8c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1421,7 +1421,7 @@ libdlopen_test_providers_la_LIBADD = \
     $(CARES_LIBS) \
     $(SSSD_INTERNAL_LTLIBS)
 libdlopen_test_providers_la_LDFLAGS = \
-    -module \
+    -shared \
     -avoid-version \
     -Wl,--version-script,$(srcdir)/src/providers/sssd_be.exports \
     -rpath $(abs_top_builddir) \
-- 
2.5.0

-------------- next part --------------
>From 9153f688bf200539fc8655f0cd0ff7844c3850b8 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 1 Sep 2015 09:45:39 +0200
Subject: [PATCH 2/3] BUILD: Speed up build of some tests

Some tests were built with files require for backend $(sssd_be_SOURCES).
This automake variable contains 15 files
which were build every time for each test.
---
 Makefile.am | 98 +++++++++++++++----------------------------------------------
 1 file changed, 23 insertions(+), 75 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4e0dee7a91d5102bcb30d68a095660ab31826a8c..eecf42704db8b542884ad245d12147bc3a7f755f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2112,153 +2112,105 @@ test_utils_LDADD = \
     libsss_test_common.la
 
 test_search_bases_SOURCES = \
-    $(sssd_be_SOURCES) \
     src/tests/cmocka/test_search_bases.c
-test_search_bases_CFLAGS = \
-    $(AM_CFLAGS) \
-    -DUNIT_TESTING
 test_search_bases_LDADD = \
-    $(PAM_LIBS) \
     $(CMOCKA_LIBS) \
-    $(POPT_LIBS) \
-    $(SSSD_LIBS) \
-    $(CARES_LIBS) \
-    $(KRB5_LIBS) \
+    $(TALLOC_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     libsss_ldap_common.la \
-    libsss_idmap.la \
-    libsss_krb5_common.la \
-    libsss_test_common.la
+    libsss_test_common.la \
+    libdlopen_test_providers.la \
+    $(NULL)
 
 test_ldap_auth_SOURCES = \
-    $(sssd_be_SOURCES) \
     src/tests/cmocka/test_ldap_auth.c \
     src/tests/cmocka/test_expire_common.c \
     $(NULL)
-test_ldap_auth_CFLAGS = \
-    $(AM_CFLAGS) \
-    -DUNIT_TESTING
-    $(NULL)
 test_ldap_auth_LDADD = \
-    $(PAM_LIBS) \
     $(CMOCKA_LIBS) \
-    $(POPT_LIBS) \
-    $(SSSD_LIBS) \
-    $(CARES_LIBS) \
-    $(KRB5_LIBS) \
-    $(SSSD_INTERNAL_LTLIBS) \
+    $(TALLOC_LIBS) \
     libsss_ldap_common.la \
     libsss_test_common.la \
+    libdlopen_test_providers.la \
     $(NULL)
 
 test_ldap_id_cleanup_SOURCES = \
-    $(sssd_be_SOURCES) \
     src/tests/cmocka/test_ldap_id_cleanup.c \
-    src/providers/ldap/ldap_id_cleanup.c \
-    $(NULL)
-test_ldap_id_cleanup_CFLAGS = \
-    $(AM_CFLAGS) \
-    -DUNIT_TESTING
     $(NULL)
 test_ldap_id_cleanup_LDADD = \
-    $(PAM_LIBS) \
     $(CMOCKA_LIBS) \
     $(POPT_LIBS) \
-    $(SSSD_LIBS) \
-    $(CARES_LIBS) \
-    $(KRB5_LIBS) \
+    $(TALLOC_LIBS) \
+    $(TEVENT_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     libsss_ldap_common.la \
     libsss_test_common.la \
+    libdlopen_test_providers.la \
     $(NULL)
 
 test_sdap_access_SOURCES = \
-    $(sssd_be_SOURCES) \
     src/tests/cmocka/test_sdap_access.c \
     src/tests/cmocka/test_expire_common.c \
     $(NULL)
-test_sdap_access_CFLAGS = \
-    $(AM_CFLAGS) \
-    -DUNIT_TESTING
-    $(NULL)
 test_sdap_access_LDADD = \
-    $(PAM_LIBS) \
     $(CMOCKA_LIBS) \
-    $(POPT_LIBS) \
-    $(SSSD_LIBS) \
-    $(CARES_LIBS) \
-    $(KRB5_LIBS) \
-    $(SSSD_INTERNAL_LTLIBS) \
+    $(TALLOC_LIBS) \
     libsss_ldap_common.la \
     libsss_test_common.la \
+    libdlopen_test_providers.la \
     $(NULL)
 
 ad_access_filter_tests_SOURCES = \
-    $(sssd_be_SOURCES) \
-    src/providers/ad/ad_common.c \
     src/tests/cmocka/test_ad_access_filter.c
-ad_access_filter_tests_CFLAGS = \
-    $(AM_CFLAGS) \
-    -DUNIT_TESTING
 ad_access_filter_tests_LDADD = \
-    $(PAM_LIBS) \
     $(CMOCKA_LIBS) \
-    $(SSSD_LIBS) \
-    $(CARES_LIBS) \
-    $(KRB5_LIBS) \
+    $(POPT_LIBS) \
+    $(TALLOC_LIBS) \
+    $(TEVENT_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     libsss_ldap_common.la \
-    libsss_idmap.la \
-    libsss_krb5_common.la \
     libsss_ad_common.la \
-    libsss_test_common.la
+    libsss_test_common.la \
+    libdlopen_test_providers.la \
+    $(NULL)
 
 ad_gpo_tests_SOURCES = \
-    $(sssd_be_SOURCES) \
-    src/providers/ad/ad_common.c \
     src/tests/cmocka/test_ad_gpo.c
 ad_gpo_tests_CFLAGS = \
     $(AM_CFLAGS) \
     $(NDR_NBT_CFLAGS) \
-    -DUNIT_TESTING
+    $(NULL)
 ad_gpo_tests_LDADD = \
-    $(PAM_LIBS) \
     $(CMOCKA_LIBS) \
     $(SSSD_LIBS) \
-    $(CARES_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     $(NDR_NBT_LIBS) \
     libsss_ldap_common.la \
     libsss_idmap.la \
     libsss_krb5_common.la \
     libsss_ad_common.la \
-    libsss_test_common.la
+    libsss_test_common.la \
+    libdlopen_test_providers.la \
+    $(NULL)
 
 ad_common_tests_SOURCES = \
-    $(sssd_be_SOURCES) \
     $(libsss_krb5_common_la_SOURCES) \
     src/tests/cmocka/common_mock_krb5.c \
     src/tests/cmocka/test_ad_common.c \
     $(NULL)
-ad_common_tests_CFLAGS = \
-    $(AM_CFLAGS) \
-    -DUNIT_TESTING \
-    $(NULL)
 ad_common_tests_LDFLAGS = \
     -Wl,-wrap,sdap_set_sasl_options \
     -Wl,-wrap,krb5_kt_default \
     $(NULL)
 ad_common_tests_LDADD = \
-    $(PAM_LIBS) \
     $(CMOCKA_LIBS) \
     $(SSSD_LIBS) \
-    $(CARES_LIBS) \
     $(KEYUTILS_LIBS) \
     $(KRB5_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     libsss_ldap_common.la \
-    libsss_idmap.la \
     libsss_test_common.la \
+    libdlopen_test_providers.la \
     $(NULL)
 
 dp_opt_tests_SOURCES = \
@@ -2560,7 +2512,6 @@ test_ipa_subdom_util_LDADD = \
     $(NULL)
 
 test_ipa_subdom_server_SOURCES = \
-    $(sssd_be_SOURCES) \
     $(libsss_krb5_common_la_SOURCES) \
     src/tests/cmocka/common_mock_sdap.c \
     src/tests/cmocka/common_mock_be.c \
@@ -2571,7 +2522,6 @@ test_ipa_subdom_server_SOURCES = \
     $(NULL)
 test_ipa_subdom_server_CFLAGS = \
     $(AM_CFLAGS) \
-    -DUNIT_TESTING \
     -DIPA_TRUST_KEYTAB_DIR=TEST_DIR \
     $(NULL)
 test_ipa_subdom_server_LDFLAGS = \
@@ -2582,17 +2532,15 @@ test_ipa_subdom_server_LDFLAGS = \
     -Wl,-wrap,sss_unique_filename \
     $(NULL)
 test_ipa_subdom_server_LDADD = \
-    $(PAM_LIBS) \
     $(CMOCKA_LIBS) \
     $(SSSD_LIBS) \
-    $(CARES_LIBS) \
     $(KEYUTILS_LIBS) \
     $(KRB5_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
     libsss_ldap_common.la \
-    libsss_idmap.la \
     libsss_ad_common.la \
     libsss_test_common.la \
+    libdlopen_test_providers.la \
     $(NULL)
 
 test_krb5_wait_queue_SOURCES = \
-- 
2.5.0

-------------- next part --------------
>From 5bea67170e7c3aeafeda2538be4cbd827b45d24f Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 1 Sep 2015 12:37:29 +0200
Subject: [PATCH 3/3] BUILD: Simplify build of simple_access_tests

Link test with existing libraries instead of building all
necessary source file on more time.

It's not portable to link with libsss_simple.so because it is a dynamic module
and not dynamic library.

*** Warning: Linking the executable simple_access-tests against the loadable module
*** libsss_simple.so is not portable!
---
 Makefile.am | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index eecf42704db8b542884ad245d12147bc3a7f755f..e52ed736f230442fe161ae29e4dc551a5c7ec231 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1648,29 +1648,15 @@ simple_access_tests_SOURCES = \
     src/tests/simple_access-tests.c \
     src/providers/simple/simple_access.c \
     src/providers/simple/simple_access_check.c \
-    src/providers/data_provider_be.c \
-    src/providers/data_provider_fo.c \
-    src/providers/data_provider_opts.c \
-    src/providers/data_provider_callbacks.c \
-    src/providers/dp_ptask.c \
-    src/providers/dp_refresh.c \
-    src/monitor/monitor_iface_generated.c \
-    src/monitor/monitor_iface_generated.h \
-    src/providers/data_provider_iface_generated.c \
-    src/providers/data_provider_iface_generated.h \
-    $(SSSD_FAILOVER_OBJ)
-simple_access_tests_CFLAGS = \
-    $(AM_CFLAGS) \
-    $(CHECK_CFLAGS) \
-    -DUNIT_TESTING
+    $(NULL)
 simple_access_tests_LDADD = \
     $(LIBADD_DL) \
-    $(SSSD_LIBS) \
-    $(CARES_LIBS) \
     $(CHECK_LIBS) \
-    $(PAM_LIBS) \
+    $(SSSD_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
-    libsss_test_common.la
+    libsss_test_common.la \
+    libdlopen_test_providers.la \
+    $(NULL)
 
 util_tests_SOURCES = \
     src/tests/util-tests.c \
-- 
2.5.0



More information about the sssd-devel mailing list