[rtems commit] testsuites: Build the tests in parallel if make is asked too.

Chris Johns chrisj at rtems.org
Wed May 10 22:40:23 UTC 2017


Module:    rtems
Branch:    master
Commit:    900c40730dbee34cd7a6f1c03c80896951bf1b9c
Changeset: http://git.rtems.org/rtems/commit/?id=900c40730dbee34cd7a6f1c03c80896951bf1b9c

Author:    Chris Johns <chrisj at rtems.org>
Date:      Wed May 10 13:36:55 2017 +1000

testsuites: Build the tests in parallel if make is asked too.

---

 testsuites/automake/subdirs.am | 51 ++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 22 deletions(-)

diff --git a/testsuites/automake/subdirs.am b/testsuites/automake/subdirs.am
index 63b1da1..d03122c 100644
--- a/testsuites/automake/subdirs.am
+++ b/testsuites/automake/subdirs.am
@@ -4,43 +4,50 @@
 ##   It is a hack within many hacks and is designed to keep the source as clean
 ##   as possible.
 
-all-local:
-	@set fnord $(MAKEFLAGS); amf=$$2; \
-	dot_seen=no; \
-	target=`echo $@ | sed s/-recursive//`; \
-	if test "$$target" = "all-local-am"; then \
+define TESTDIR
+.PHONY: $1
+$1:
+	@+set fnord $(MAKEFLAGS); \
+	subdir=$(1); \
+	target=`echo $(MAKECMDGOALS) | sed s/-recursive//`; \
+	if test "$$$$target" = "all-local-am"; then \
 	  target="all-am"; \
 	fi; \
-	if test "$$target" = "all-local"; then \
+	if test "$$$$target" = "all-local"; then \
 	  target="all"; \
 	fi; \
 	tcheck="$(top_srcdir)/../../tools/build/rtems-test-check-py"; \
 	tdata="$(RTEMS_BSP)-testsuite.tcfg"; \
 	tincludes="$(top_srcdir)/../../c/src/lib/libbsp/$(RTEMS_CPU)/$(RTEMS_BSP_FAMILY)/make/custom:$(top_srcdir)/.."; \
-	if test -f "$$tdata"; then \
+	if test -f "$$$$tdata"; then \
 	  vtdata="$(RTEMS_CPU)/$(RTEMS_BSP_FAMILY)/make/custom/$(RTEMS_BSP)-testsuite.tcfg"; \
 	else \
 	  vtdata="all tests"; \
 	fi; \
-	echo "BSP Testsuite Data: $$vtdata"; \
-	if test -f $$tcheck; then \
-	  list=`$$tcheck exclude $(RTEMS_BSP) $$tdata $$tincludes $(_SUBDIRS)`; \
+	echo "BSP Testsuite Data: $$$$vtdata"; \
+	if test -f $$$$tcheck; then \
+	  list=`$$$$tcheck exclude $(RTEMS_BSP) $$tdata $$$$tincludes $(_SUBDIRS)`; \
 	else \
 	  list=$(_SUBDIRS); \
 	fi; \
-	for subdir in $$list; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" != "."; then \
-	    if test -f $$tcheck; then \
-	      test_FLAGS=`$$tcheck flags $(RTEMS_BSP) $$tdata $$tincludes $$subdir`; \
+	if test "$$$${list#*$$$$subdir}" != "$$$${list}"; then \
+	  echo "Making $$$$target in $$$$subdir"; \
+	  if test "$$$$subdir" != "."; then \
+	    if test -f $$$$tcheck; then \
+	      test_FLAGS=`$$$$tcheck flags $(RTEMS_BSP) $$$$tdata $$$$tincludes $$$$subdir`; \
 	    fi; \
-	    local_target="$$target"; \
-	    if test -z "$$test_FLAGS"; then \
-		echo "BSP Testsuite Flags: $$subdir: PASS"; \
+	    local_target="$$$$target"; \
+	    if test -z "$$$$test_FLAGS"; then \
+	      echo "BSP Testsuite Flags: $$$$subdir: PASS"; \
 	    else \
-		echo "BSP Testsuite Flags: $$subdir: $$test_FLAGS"; \
+	      echo "BSP Testsuite Flags: $$$$subdir: $$$$test_FLAGS"; \
 	    fi; \
-	    (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) TEST_FLAGS="$$test_FLAGS" $$local_target) \
-	     || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	    cd $$$$subdir; \
+	    $(MAKE) $(AM_MAKEFLAGS) TEST_FLAGS="$$$$test_FLAGS" $$$$local_target; \
 	  fi; \
-	done; test -z "$$fail"
+	fi;
+endef
+
+$(foreach T,$(_SUBDIRS),$(eval $(call TESTDIR,$(strip $(T)))))
+
+all-local:  $(_SUBDIRS)




More information about the vc mailing list