[sr-dev] git:master: test/unit: Makefile option to run individual test unit

Daniel-Constantin Mierla miconda at gmail.com
Tue Sep 30 18:13:45 CEST 2014


Module: sip-router
Branch: master
Commit: 84d00119fa1bc4bcd06d3189fa5ca67564338aa2
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=84d00119fa1bc4bcd06d3189fa5ca67564338aa2

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Sep 30 17:34:16 2014 +0200

test/unit: Makefile option to run individual test unit

- head parameter swapped to work on bsd/darwin

---

 test/unit/Makefile |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/test/unit/Makefile b/test/unit/Makefile
index 6425b30..e914031 100644
--- a/test/unit/Makefile
+++ b/test/unit/Makefile
@@ -1,8 +1,11 @@
+# Makefile for running test unit
+#
+
 all:
 	- at for FILE in $(wildcard *.sh) ; do \
 		if [ -f $$FILE ] ; then \
 			if [ -x $$FILE ] ; then \
-				echo "run test `basename $$FILE .sh`:" `head "$$FILE" -n 2 | tail -n 1 | cut -c 3-` ; \
+				echo "run test `basename $$FILE .sh`:" `head -n 2 "$$FILE" | tail -n 1 | cut -c 3-` ; \
 				./$$FILE ; \
 				ret=$$? ; \
 					if [ ! "$$ret" -eq 0 ] ; then \
@@ -11,3 +14,20 @@ all:
 			fi ; \
 		fi ; \
 	done ;
+
+run:
+	- at if [ -f $(UNIT) ] ; then \
+		if [ -x $(UNIT) ] ; then \
+			echo "Run test `basename $(UNIT) .sh`:" `head -n 2 "$(UNIT)" | tail -n 1 | cut -c 3-` ; \
+			./$(UNIT) ; \
+			ret=$$? ; \
+				if [ ! "$$ret" -eq 0 ] ; then \
+					echo "Test unit file $(UNIT): failed" ; \
+				else \
+					echo "Test unit file $(UNIT): ok" ; \
+				fi ; \
+		fi ; \
+	else \
+		echo "Test unit file $(UNIT): not found" ; \
+	fi ;
+




More information about the sr-dev mailing list