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`; \
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"
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;