From 80a7b6329c3177a0e4050d88406b0bd12fa66ac4 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Wed, 1 Dec 2010 00:15:23 +0900 Subject: [PATCH] =?utf8?q?=E3=83=86=E3=82=B9=E3=83=88=E7=94=A8=E3=81=AEMak?= =?utf8?q?efile=E3=82=92=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- test/Makefile.TESTGROUPS.mk | 8 ++++++++ test/TEST.mk | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/test/Makefile.TESTGROUPS.mk b/test/Makefile.TESTGROUPS.mk index 6e32f36..37ec308 100644 --- a/test/Makefile.TESTGROUPS.mk +++ b/test/Makefile.TESTGROUPS.mk @@ -11,16 +11,20 @@ TESTS = `ls | grep "^[^A-Z].*"` LOGFILE = Test.log .PHONY: all check checkeach report clean cleanall prepare create + check: checkeach report + checkeach: @rm -f $(LOGFILE) @for target in $(TESTS); do \ $(MAKE) check -C $$target; \ done + $(LOGFILE): @for target in $(TESTS); do \ cat <$$target/report.txt >>$(LOGFILE) || echo $$target ": no report" >>$(LOGFILE); \ done + report: $(LOGFILE) @success=`grep "Success" $(LOGFILE) | wc -l`; \ all=`cat $(LOGFILE) | wc -l`; \ @@ -28,14 +32,18 @@ report: $(LOGFILE) if test $$success -eq $$all; then \ echo "$(GROUPNAME): All tests are succeded."; \ fi + clean: @for target in $(TESTS); do $(MAKE) clean -C $$target; done @rm -f $(LOGFILE) + cleanall: @for target in $(TESTS); do $(MAKE) cleanall -C $$target; done @rm -f $(LOGFILE) + prepare: @for target in $(TESTS) ; do $(MAKE) prepare -C $$target ; done + create: ifndef UNITNAME @echo "no test created. set UNITNAME" diff --git a/test/TEST.mk b/test/TEST.mk index dc64dcb..753f6c0 100644 --- a/test/TEST.mk +++ b/test/TEST.mk @@ -14,20 +14,28 @@ DIFF_FILE = diff.txt REPORT_FILE = report.txt TEST0_FILE = 0.txt TEST1_FILE = 1.txt -.PHPNY: check prepare clean cleanall + +.PHONY: check prepare clean cleanall + check: clean $(REPORT_FILE) + prepare: cleanall $(TEST0_FILE) + clean: @rm -f $(TEST1_FILE) $(DIFF_FILE) $(REPORT_FILE) $(ERR_FILE) + cleanall: clean @rm -f $(TEST0_FILE) + ifndef MAINTARGET_OVERRIDE $(TEST0_FILE) $(TEST1_FILE): @echo $(CMD) >$@; \ $(CMD) >>$@ 2>$(ERR_FILE); \ if test -s $(ERR_FILE); then cat $(ERR_FILE) >>$@; else rm -f $(ERR_FILE); fi endif + $(DIFF_FILE): $(TEST1_FILE) @-diff -c $(TEST0_FILE) $(TEST1_FILE) >$@ 2>&1 + $(REPORT_FILE): $(DIFF_FILE) @if test ! -s $^; then echo "$(UNITNAME): Test Success $(DATE)" >>$@; rm -f $^; else echo "$(UNITNAME): Test Failure $(DATE)" >>$@; fi; -- 2.18.0