test/unit: Makefile option to run individual test unit
[sip-router] / test / unit / Makefile
1 # Makefile for running test unit
2 #
3
4 all:
5         -@for FILE in $(wildcard *.sh) ; do \
6                 if [ -f $$FILE ] ; then \
7                         if [ -x $$FILE ] ; then \
8                                 echo "run test `basename $$FILE .sh`:" `head -n 2 "$$FILE" | tail -n 1 | cut -c 3-` ; \
9                                 ./$$FILE ; \
10                                 ret=$$? ; \
11                                         if [ ! "$$ret" -eq 0 ] ; then \
12                                                 echo "failed" ; \
13                                         fi ; \
14                         fi ; \
15                 fi ; \
16         done ;
17
18 run:
19         -@if [ -f $(UNIT) ] ; then \
20                 if [ -x $(UNIT) ] ; then \
21                         echo "Run test `basename $(UNIT) .sh`:" `head -n 2 "$(UNIT)" | tail -n 1 | cut -c 3-` ; \
22                         ./$(UNIT) ; \
23                         ret=$$? ; \
24                                 if [ ! "$$ret" -eq 0 ] ; then \
25                                         echo "Test unit file $(UNIT): failed" ; \
26                                 else \
27                                         echo "Test unit file $(UNIT): ok" ; \
28                                 fi ; \
29                 fi ; \
30         else \
31                 echo "Test unit file $(UNIT): not found" ; \
32         fi ;
33