This patch is a first attempt to make "make intgcheck" less
painful/time consuming than it is now.

Although the patch provides a good improvement on having 5 new
targets, I know it's still not ideal. The ideal case, IMO, would be
being able to select which subset of tests would be run, but that's an
improvement that can be done later on.

Tips are welcome.

Best Regards,
--
Fabiano Fidêncio
From 68eb31a5d90c9edaca16d6f15fe16dcd5e250958 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fiden...@redhat.com>
Date: Thu, 18 Aug 2016 16:24:17 +0200
Subject: [PATCH] BUILD: Add a few more targets for intg tests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Running "make intgcheck" has been proven to be a bit painful (mainly
when the developer is just writing down a single test case), as it
cleans up the build directory and fireis a new build before, finally,
run the tests.

In order to make it a little less painful, let's break the whole
operation into 5 new targets:
    intgcheck-{prepare,configure,build,run,clean}.

As expected, "make intgcheck" calls these 4 new operations in the same
order they were presented, not changing then the current behavior.

Each operation will trigger the previous one in case there is no
IC_TESTS_PREFIX directory created and the directory is _only_
created in the very first operation (intgcheck-prepare).

Signed-off-by: Fabiano Fidêncio <fiden...@redhat.com>
---
 Makefile.am | 43 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 30d874e..ec73fe5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3076,29 +3076,56 @@ endif
 # Integration tests #
 #####################
 
-intgcheck:
+IC_CHECK_DIR = ls --directory --sort=time /tmp/sssd-intg.* 2> /dev/null
+IC_CREATE_DIR = mktemp --tmpdir --directory --dry-run sssd-intg.XXXXXXXX
+
+IC_TESTS_PREFIX := $(shell ($(IC_CHECK_DIR) || $(IC_CREATE_DIR)) | head -n 1)
+
+intgcheck-prepare:
 	echo "temporarily disabled"
 	set -e; \
 	rm -Rf intg; \
 	$(MKDIR_P) intg/bld; \
 	: Use /hopefully/ short prefix to keep D-Bus socket path short; \
-	prefix=`mktemp --tmpdir --directory sssd-intg.XXXXXXXX`; \
-	$(LN_S) "$$prefix" intg/pfx; \
+	$(MKDIR_P) $(IC_TESTS_PREFIX); \
+	$(LN_S) $(IC_TESTS_PREFIX) intg/pfx
+
+intgcheck-configure:
+	@if [ ! -d $(IC_TESTS_PREFIX) ]; then $(MAKE) intgcheck-prepare; fi
 	cd intg/bld; \
 	$(abs_top_srcdir)/configure \
-	    --prefix="$$prefix" \
-	    --with-ldb-lib-dir="$$prefix"/lib/ldb \
+	    --prefix=$(IC_TESTS_PREFIX) \
+	    --with-ldb-lib-dir=$(IC_TESTS_PREFIX)/lib/ldb \
 	    --enable-intgcheck-reqs \
 	    --without-semanage \
 	    $(INTGCHECK_CONFIGURE_FLAGS); \
+	cd ../..
+
+intgcheck-build:
+	@if [ ! -d $(IC_TESTS_PREFIX) ]; then $(MAKE) intgcheck-configure; fi
+	cd intg/bld; \
 	$(MAKE) $(AM_MAKEFLAGS); \
 	: Force single-thread install to workaround concurrency issues; \
 	$(MAKE) $(AM_MAKEFLAGS) -j1 install; \
 	: Remove .la files from LDB module directory to avoid loader warnings; \
-	rm "$$prefix"/lib/ldb/*.la; \
+	rm $(IC_TESTS_PREFIX)/lib/ldb/*.la; \
+	cd ../..
+
+intgcheck-run:
+	@if [ ! -d $(IC_TESTS_PREFIX) ]; then $(MAKE) intgcheck-build; fi
+	cd intg/bld; \
 	$(MAKE) $(AM_MAKEFLAGS) -C src/tests/intg intgcheck-installed; \
-	cd ../..; \
-	rm -Rf "$$prefix" intg
+	cd ../..
+
+intgcheck-clean:
+	rm -Rf $(IC_TESTS_PREFIX) intg
+
+intgcheck:
+	$(MAKE) intgcheck-prepare
+	$(MAKE) intgcheck-configure
+	$(MAKE) intgcheck-build
+	$(MAKE) intgcheck-run
+	$(MAKE) intgcheck-clean
 
 ####################
 # Client Libraries #
-- 
2.7.4

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org

Reply via email to