From 22cc45c79736d6a880953019ebc4dc04b9bb63e3 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Sun, 5 Nov 2017 21:47:13 +0100 Subject: [PATCH] Added ability to run arbitrary .sh scripts as test --- tests/Makefile.script-test | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/Makefile.script-test diff --git a/tests/Makefile.script-test b/tests/Makefile.script-test new file mode 100644 index 000000000..fff52f0b4 --- /dev/null +++ b/tests/Makefile.script-test @@ -0,0 +1,30 @@ +TESTS=$(wildcard ??-*.sh) +TESTLOGS=$(patsubst %.sh,%.testlog,$(TESTS)) +FAILLOGS=$(patsubst %.sh,%.faillog,$(TESTS)) + +CONTIKI=../.. + +tests: $(TESTLOGS) + +report: clean tests + @echo | grep -s -e '' - $(TESTLOGS) $(FAILLOGS) > $@ || true + +summary: report +ifeq ($(TESTS),) + @echo No tests > $@ +else + @egrep -e ' OK| FAIL' $< > $@ + @ls -1 ??-*.faillog > /dev/null 2>&1; [ $$? = 0 ] && tail -v ??-*.log ??-*.faillog >> $@ || true +endif + +all: cooja clean tests + +%.testlog: %.sh cooja + @bash $(TESTS) "$(CONTIKI)" + +clean: + @rm -f $(TESTLOGS) $(FAILLOGS) report summary + +cooja: $(CONTIKI)/tools/cooja/dist/cooja.jar +$(CONTIKI)/tools/cooja/dist/cooja.jar: + (cd $(CONTIKI)/tools/cooja; ant jar)