-src/*.o
-1.txt
-report.txt
-diff.txt
-casl2
-comet2
-dumpword
-TEST.log
+/casl2
+/comet2
+/dumpword
*~
-TAGS
ADDL GR3,=1 ; ↓
JUMP DFIN ; DFINへジャンプ
DCP LD GR3,GR1
-DFIN POP GR4
+DFIN POP GR4
POP GR2
POP GR1
RET
-DY DS 1
+DY DS 1
END
JUMP MUL10
ISNEXT LD GR4,NLEN
ADDL GR3,GR1
- LAD GR4,1,GR4
+ LAD GR4,1,GR4
JUMP ISTOL ; ループ終端
IOV LAD GR0,1
ADDL GR0,=#FFFF
--- /dev/null
+1.txt
+report.txt
+diff.txt
+TEST.log
+++ /dev/null
-include LIST.mk
-LOGFILE = test.log
-ifdef UNITNAME
- define create
- @mkdir $(UNITNAME)
- @echo 'include ../CMD.mk # YACASL2DIR, CASL2' >$(UNITNAME)/Makefile; \
- echo 'UNITNAME = $(UNITNAME)' >>$(UNITNAME)/Makefile; \
- echo 'ASDIR = $$(YACASL2DIR)/as' >>$(UNITNAME)/Makefile; \
- echo 'ASFILE = $$(ASDIR)/$(UNITNAME)' >>$(UNITNAME)/Makefile; \
- echo '# IN = <' >>$(UNITNAME)/Makefile; \
- echo 'CMD = $$(CASL2) $$(CASL2FLAG) $$(ASFILE) $$(IN)' >>$(UNITNAME)/Makefile; \
- echo 'include ../Test.mk' >>$(UNITNAME)/Makefile
- @echo $(UNITNAME) \\ >>List.mk
- endef
-else
- define create
- @echo "no test created. set UNITNAME"
- endef
-endif
-
-.PHONY: all check cleanall clean prepare create report
-all: clean check report
-clean:
- @for target in $(TESTS); do \
- $(MAKE) clean -C $$target; \
- done
- @rm -f $(LOGFILE)
-check:
- @for target in $(TESTS); do \
- $(MAKE) check -C $$target; \
- done
-report: $(LOGFILE)
- @success=`grep "Success" $(LOGFILE) | wc -l`; \
- all=`cat $(LOGFILE) | wc -l`; \
- echo "$$success / $$all tests passed. Details in `pwd`/$(LOGFILE)"; \
- if test $$success -eq $$all; then \
- echo "All tests are succeded."; \
- else \
- grep "Failure" $(LOGFILE); \
- fi
-prepare: cleanall
- @for target in $(TESTS) ; do \
- $(MAKE) prepare -C $$target ;\
- done
-cleanall:
- @for target in $(TESTS); do \
- $(MAKE) cleanall -C $$target; \
- done
- @rm -f $(LOGFILE)
-create:
- $(create)
-$(LOGFILE):
- @for target in $(TESTS); do \
- cat <$$target >>$(LOGFILE); \
- done
--- /dev/null
+# テストグループ
+# make : すべてのテストを実施し、ログを作成
+# make all : ↓
+# make clean : すべてのテストで、「make」で生成されたファイルをクリア
+# make check : すべてのテストを実施
+# make cleanall: すべてのテストで、「make」と「make prepare」で生成されたファイルをクリア
+# make prepare : すべてのテストの、想定結果を出力
+# make create : UNITNAMEで指定されたテストを新規に作成
+TESTS = `ls | grep "^[^A-Z].*"`
+LOGFILE = TEST.log
+
+.PHONY: all check report clean cleanall prepare create
+all: check report
+check:
+ @rm -f $(LOGFILE)
+ @for target in $(TESTS); do \
+ $(MAKE) check -C $$target; \
+ done
+$(LOGFILE):
+ @for target in $(TESTS); do \
+ cat <$$target/report.txt >>$(LOGFILE); \
+ done
+report: $(LOGFILE)
+ @success=`grep "Success" $(LOGFILE) | wc -l`; \
+ all=`cat $(LOGFILE) | wc -l`; \
+ echo "$$success / $$all tests passed. Details in `pwd`/$(LOGFILE)"; \
+ if test $$success -eq $$all; then \
+ echo "All tests are succeded."; \
+ else \
+ grep "Failure" $(LOGFILE); \
+ 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:
+ifdef UNITNAME
+ @mkdir $(UNITNAME)
+ @echo 'CMD = ' >>$(UNITNAME)/Makefile
+else
+ @echo "no test created. set UNITNAME"
+endif
# テストのテンプレート
# make : CMDで設定されたコマンドを実行した出力結果を1.txtに出力し、0.txtと比較し、レポート
-# make all : ↓
# make check : ↓
# make prepare : CMDで設定されたコマンドを実行した出力結果を0.txt(テストの想定結果)に出力
# make clean : 「make」で生成されたファイルをクリア
# make cleanall: 「make」と「make clean」で生成されたファイルをクリア
-LOGFILE = ../test.log
+LOGFILE = ../TEST.log
ERRFILE = err.txt
-CURDIR = `pwd`
-define report
- @echo -n "`basename $$PWD`: Test " >$@
- @if test ! -s $^; then \
- echo -n "Success " >>$@; \
- rm -f $^; \
- else \
- echo -n "Failure " >>$@; \
- fi
- @echo `date +"%F %T"` >>$@
-endef
+UNITNAME = `pwd | xargs basename`
+# 要定義: CMD, CMDFILE, OBJFILE
-.PHPNY: all check prepare clean cleanall logadd
-check: clean logadd
-all: check
+.PHPNY: check prepare clean cleanall
+check: clean report.txt
prepare: cleanall 0.txt
clean:
@rm -f 1.txt diff.txt report.txt
cleanall: clean
@rm -f 0.txt
0.txt 1.txt: $(CMDFILE) $(OBJFILE)
- @$(CMD) >$@ 2>$(ERRFILE); \
+ @echo $(CMD) >$@; \
+ $(CMD) >>$@ 2>$(ERRFILE); \
if test -s $(ERRFILE); then cat err.txt >>$@; else rm -f $(ERRFILE); fi
diff.txt: 1.txt
@-diff 0.txt 1.txt >$@ 2>&1
report.txt: diff.txt
- $(report)
-logadd: report.txt
- @cat $^ >>$(LOGFILE)
+ @echo -n "$(UNITNAME): Test " >$@; \
+ if test ! -s $^; then echo -n "Success " >>$@; rm -f $^; else echo -n "Failure " >>$@; fi; \
+ echo `date +"%F %T"` >>$@
+++ /dev/null
-../../../../dumpword -a 0
-../../../../dumpword -a 1
-../../../../dumpword -a 01
-../../../../dumpword -a 001
-../../../../dumpword -a 0001
-../../../../dumpword -a 10
-../../../../dumpword -a 11
-../../../../dumpword -a F
-../../../../dumpword -a 000F
-../../../../dumpword -a FFFF
-../../../../dumpword -a 00001
-../../../../dumpword -a G
+++ /dev/null
-../../../../dumpword -l 0
-../../../../dumpword -l 1
-../../../../dumpword -l 01
-../../../../dumpword -l 001
-../../../../dumpword -l 0001
-../../../../dumpword -l 10
-../../../../dumpword -l 11
-../../../../dumpword -l F
-../../../../dumpword -l 000F
-../../../../dumpword -l FFFF
-../../../../dumpword -l 00001
-../../../../dumpword -l G
+++ /dev/null
-../../../../dumpword 0
-../../../../dumpword 1
-../../../../dumpword 01
-../../../../dumpword 001
-../../../../dumpword 0001
-../../../../dumpword 10
-../../../../dumpword 11
-../../../../dumpword F
-../../../../dumpword 000F
-../../../../dumpword FFFF
-../../../../dumpword 00001
-../../../../dumpword G
-TESTGROUP = CASL2 COMET2 DUMPWORD
+TESTGROUPS = `ls | grep "^[^A-Z].*"`
.PHONY: all
all:
- @for target in $(TESTGROUP); do \
+ @for target in $(TESTGROUPS); do \
$(MAKE) -C $$target; \
done
grep "Failure" $(LOGFILE); \
fi
clean:
- @for target in $(TESTS); do \
- $(MAKE) clean -C $$target; \
- done
+ @for target in $(TESTS); do $(MAKE) clean -C $$target; done
@rm -f $(LOGFILE)
cleanall:
- @for target in $(TESTS); do \
- $(MAKE) cleanall -C $$target; \
- done
+ @for target in $(TESTS); do $(MAKE) cleanall -C $$target; done
@rm -f $(LOGFILE)
prepare:
- @for target in $(TESTS) ; do \
- $(MAKE) prepare -C $$target ;\
- done
+ @for target in $(TESTS) ; do $(MAKE) prepare -C $$target ; done
create:
ifdef UNITNAME
@mkdir $(UNITNAME)