diff options
author | Adrian Thurston <thurston@complang.org> | 2010-03-24 04:07:01 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2010-03-24 04:07:01 +0000 |
commit | 6fb7600c53244c6b9c73a88e1b5a5c5728bdd6eb (patch) | |
tree | f920d96b49fa2344572bbfffca46cef9dac44f19 /test | |
parent | 3bc9b07d75550a59ca62958a91f710c451713a7c (diff) | |
download | colm-6fb7600c53244c6b9c73a88e1b5a5c5728bdd6eb.tar.gz |
New strategy for testing.
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile | 47 | ||||
-rwxr-xr-x | test/genmf | 55 | ||||
-rwxr-xr-x | test/runtests | 42 |
3 files changed, 55 insertions, 89 deletions
diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index 6d337986..00000000 --- a/test/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright 2002-2006 Adrian Thurston <thurston@complang.org> -# - -# This file is part of Colm. -# -# Colm is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Colm is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Colm; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -SRC = $(wildcard *.lm) -BIN = $(SRC:%.lm=%.bin) -SUBDIRS = xml python http diff html cxx ruby mediawiki - -all: - ./runtests - -.PHONY: $(SUBDIRS) - -$(SUBDIRS): - @cd $@ && $(MAKE) - -$(BIN): %.bin: %.lm - ../colm/colm $< - -# clean targets - -CLEAN_SUBDIRS = $(SUBDIRS:%=%-clean) - -.PHONY: $(CLEAN_SUBDIRS) - -$(CLEAN_SUBDIRS): - @cd $(@:%-clean=%) && $(MAKE) clean - -clean: $(CLEAN_SUBDIRS) - rm -f *.cpp *.bin diff --git a/test/genmf b/test/genmf new file mode 100755 index 00000000..f6975ad5 --- /dev/null +++ b/test/genmf @@ -0,0 +1,55 @@ +#!/bin/bash +# + +COLM="../colm/colm" +TESTS=" + backtrack1.lm backtrack2.lm dns.lm accum1.lm accum2.lm accum3.lm + mutualrec.lm argv1.lm argv2.lm exit.lm rubyhere.lm + translate1.lm translate2.lm + construct1.lm construct2.lm construct3.lm + treecmp1.lm context1.lm context2.lm context3.lm + undofrag1.lm undofrag2.lm undofrag3.lm + nestedcomm.lm reparse.lm + btscan1.lm btscan2.lm +" + +echo -n "TESTS =" +for t in $TESTS; do + echo " \\" + echo -n " $t" +done + +echo +echo +echo 'BINS = $(TESTS:%.lm=%.bin)' +echo 'OUTS = $(TESTS:%.lm=%.out)' +echo 'DIFFS = $(TESTS:%.lm=%.diff)' +echo +echo 'all: Makefile $(DIFFS)' +echo +echo 'Makefile: genmf' +echo ' ./genmf > Makefile' +echo + +for t in $TESTS; do + root=${t%.lm} + + echo "$root.diff: $root.out $root.exp" + echo " @ diff -u $root.exp $root.out > $root.diff || ( cat $root.diff; rm $root.diff )" + + # Are there any arguments. + if test -f $root.args; then + args=`cat $root.args` + else + args="" + fi + + echo "$root.out: $root.bin" + if test -f "$root.in"; then + echo " ./$root.bin $args < $root.in > $root.out" + else + echo " ./$root.bin $args > $root.out" + fi + echo "$root.bin: $t $COLM" + echo " $COLM $t" +done diff --git a/test/runtests b/test/runtests deleted file mode 100755 index 03841cef..00000000 --- a/test/runtests +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# - -COLM="../colm/colm" -TESTS=" - backtrack1.lm backtrack2.lm dns.lm accum1.lm accum2.lm accum3.lm - mutualrec.lm argv1.lm argv2.lm exit.lm rubyhere.lm - translate1.lm translate2.lm - construct1.lm construct2.lm construct3.lm - treecmp1.lm context1.lm context2.lm context3.lm - undofrag1.lm undofrag2.lm undofrag3.lm - nestedcomm.lm reparse.lm - btscan1.lm btscan2.lm -" - -for t in $TESTS; do - root=${t%.lm} - echo "testing $t" - - # Compile. - $COLM $t - - # Are there any arguments. - if test -f $root.args; then - args=`cat $root.args` - else - args="" - fi - - # Run. There may be an input file. - if test -f "$root.in"; then - ./$root.bin $args < "$root.in" > $root.out - else - ./$root.bin $args > $root.out - fi - - # Test output. - if ! diff -u $root.exp $root.out; then - echo FAILURE - #exit 1 - fi -done |