[sr-dev] git:master:d1dc6741: test/unit: Add TESTS vars to control wich tests to exec and exit with error if one fails

Victor Seva linuxmaniac at torreviejawireless.org
Tue Jan 6 21:41:21 CET 2015


Module: kamailio
Branch: master
Commit: d1dc67417309400ea458a4d7672d97277b59e5fc
URL: https://github.com/kamailio/kamailio/commit/d1dc67417309400ea458a4d7672d97277b59e5fc

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2015-01-06T21:39:23+01:00

test/unit: Add TESTS vars to control wich tests to exec and exit with error if one fails

---

Modified: test/unit/Makefile

---

Diff:  https://github.com/kamailio/kamailio/commit/d1dc67417309400ea458a4d7672d97277b59e5fc.diff
Patch: https://github.com/kamailio/kamailio/commit/d1dc67417309400ea458a4d7672d97277b59e5fc.patch

---

diff --git a/test/unit/Makefile b/test/unit/Makefile
index e914031..83b3dba 100644
--- a/test/unit/Makefile
+++ b/test/unit/Makefile
@@ -1,19 +1,23 @@
 # Makefile for running test unit
 #
+TESTS_FILES ?= $(wildcard *.sh)
+TESTS_EXCLUDE ?=
+TESTS ?= $(filter-out $(patsubst %,%.sh,$(TESTS_EXCLUDE)), $(TESTS_FILES))
 
 all:
-	- at for FILE in $(wildcard *.sh) ; do \
+	@for FILE in $(TESTS) ; do \
 		if [ -f $$FILE ] ; then \
 			if [ -x $$FILE ] ; then \
 				echo "run test `basename $$FILE .sh`:" `head -n 2 "$$FILE" | tail -n 1 | cut -c 3-` ; \
 				./$$FILE ; \
 				ret=$$? ; \
 					if [ ! "$$ret" -eq 0 ] ; then \
-						echo "failed" ; \
+						echo "failed" ; RES=1;\
 					fi ; \
 			fi ; \
 		fi ; \
-	done ;
+	done ; \
+	exit $$RES;
 
 run:
 	- at if [ -f $(UNIT) ] ; then \
@@ -30,4 +34,3 @@ run:
 	else \
 		echo "Test unit file $(UNIT): not found" ; \
 	fi ;
-




More information about the sr-dev mailing list