summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2014-11-20 15:27:24 -0500
committerAdrian Thurston <thurston@complang.org>2014-11-20 15:27:24 -0500
commit78d755a34dd4ba4bd9792df8601e95440095e8ea (patch)
treec239131b73378ac06dc2c6a7f91a755d2ee44787 /test
parentc4a747d7f46e0af5caccc7265282fdf4cf833595 (diff)
downloadcolm-78d755a34dd4ba4bd9792df8601e95440095e8ea.tar.gz
autotools for test suite
Diffstat (limited to 'test')
-rw-r--r--test/.gitignore7
-rw-r--r--test/Makefile.am124
-rwxr-xr-xtest/autogen.sh8
-rw-r--r--test/configure.ac23
-rw-r--r--[-rwxr-xr-x]test/runtests.sh8
-rwxr-xr-xtest/sedsubst12
6 files changed, 56 insertions, 126 deletions
diff --git a/test/.gitignore b/test/.gitignore
index 033897db..137a5826 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,3 +1,10 @@
/Makefile.in
/Makefile
/working
+
+/aclocal.m4
+/autom4te.cache/
+/config.log
+/config.status
+/configure
+/runtests
diff --git a/test/Makefile.am b/test/Makefile.am
index a217e833..215bf72e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,121 +1,5 @@
-TESTS = runtests.sh
+noinst_SCRIPTS = runtests
+
+runtests: runtests.sh Makefile
+ @$(top_srcdir)/sedsubst $< $@ -w,+x $(SED_SUBST)
-EXTRA_DIST = \
- runtests.sh \
- accum1.lm \
- accum2.lm \
- accum3.lm \
- accumbt1.lm \
- accumbt2.lm \
- accumbt3.lm \
- argv1.lm \
- argv2.lm \
- backtrack1.lm \
- backtrack2.lm \
- backtrack3.lm \
- binary1.lm \
- binary1.in \
- btscan1.lm \
- btscan2.lm \
- call1.lm \
- commitbt.lm \
- concat1.lm \
- concat2.lm \
- construct1.lm \
- construct2.lm \
- construct3.lm \
- constructex.lm \
- context1.lm \
- context2.lm \
- context3.lm \
- counting1.lm \
- counting2.lm \
- counting3.lm \
- counting4.lm \
- decl1.lm \
- decl2.lm \
- decl3.lm \
- div.lm \
- exit1.lm \
- exit2.lm \
- exit3.lm \
- export1.lm \
- factor1.lm \
- factor2.lm \
- factor3.lm \
- factor4.lm \
- factor5.lm \
- factor6.lm \
- forloop1.lm \
- forloop2.lm \
- forloop3.lm \
- func1.lm \
- func2.lm \
- func3.lm \
- generate1.lm \
- generate2.lm \
- heredoc.lm \
- ifblock1.lm \
- ignore1.lm \
- ignore2.lm \
- ignore3.lm \
- ignore4.lm \
- ignore5.lm \
- include1.lm \
- include1a.lmi \
- inpush1.lm \
- inpush1a.in \
- inpush1b.in \
- inpush1c.in \
- island.lm \
- lhs1.lm \
- liftattrs.lm \
- literal1.lm \
- lookup1.lm \
- mailbox.lm \
- matchex.lm \
- maxlen.lm \
- multiregion1.lm \
- multiregion2.lm \
- mutualrec.lm \
- namespace1.lm \
- nestedcomm.lm \
- order1.lm \
- order2.lm \
- parse1.lm \
- prints.lm \
- pull1.lm \
- pull2.lm \
- ragelambig1.lm \
- ragelambig2.lm \
- ragelambig3.lm \
- ragelambig4.lm \
- rediv.lm \
- reor1.lm \
- reor2.lm \
- reparse.lm \
- repeat1.lm \
- repeat2.lm \
- rhsref1.lm \
- rubyhere.lm \
- scope1.lm \
- sprintf.lm \
- string.lm \
- superid.lm \
- tags1.lm \
- tags2.lm \
- tags3.lm \
- tags4.lm \
- tcontext1.lm \
- til.lm \
- translate1.lm \
- translate2.lm \
- travs1.lm \
- treecmp1.lm \
- typeref1.lm \
- typeref2.lm \
- typeref3.lm \
- undofrag1.lm \
- undofrag2.lm \
- undofrag3.lm \
- while1.lm
diff --git a/test/autogen.sh b/test/autogen.sh
new file mode 100755
index 00000000..afc25406
--- /dev/null
+++ b/test/autogen.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+#
+
+set -x
+
+aclocal
+automake --foreign --add-missing
+autoconf
diff --git a/test/configure.ac b/test/configure.ac
new file mode 100644
index 00000000..fe56d697
--- /dev/null
+++ b/test/configure.ac
@@ -0,0 +1,23 @@
+AC_INIT([colm-suite], [1.0.1])
+AM_INIT_AUTOMAKE
+
+dnl
+dnl Which colm are we testing. Default is the one in parent's source dir.
+dnl
+AC_ARG_WITH(subject,
+ [AC_HELP_STRING([--with-subject], [location of colm to test])],
+ [SUBJECT="$withval/bin/colm"],
+ [SUBJECT="../src/colm"]
+)
+
+AC_SUBST(SUBJECT)
+
+SED_SUBST=["\
+ -e 's|@SUBJECT@|${SUBJECT}|g' \
+"]
+AC_SUBST(SED_SUBST)
+
+dnl write output files
+AC_OUTPUT([
+ Makefile
+])
diff --git a/test/runtests.sh b/test/runtests.sh
index 931e94f2..32c532ba 100755..100644
--- a/test/runtests.sh
+++ b/test/runtests.sh
@@ -30,7 +30,7 @@
WORKING=working
ERRORS=0
-test -z "$COLM" && COLM=../src/colm
+COLM=@SUBJECT@
cd `dirname $0`
test -d $WORKING || mkdir $WORKING
@@ -154,6 +154,7 @@ function runtests()
fi
# Compilation.
+ echo $COLM $TST
$COLM $LM &> $LOG
if [ $? != 0 ]; then
echo "ERROR: $TST cannot be run: compilation error"
@@ -184,11 +185,6 @@ function runtests()
echo -n "running test $TST ($Nth)... "
- if [ "$verbose" = true ]; then
- echo
- echo $COLM $TST
- fi
-
if [ '!' -f $IN ] && [ -f $ROOT.in ]; then
IN=$ROOT.in;
fi
diff --git a/test/sedsubst b/test/sedsubst
new file mode 100755
index 00000000..da01055e
--- /dev/null
+++ b/test/sedsubst
@@ -0,0 +1,12 @@
+#/bin/sh
+#
+
+source=$1
+output=$2
+mode=$3
+shift 3;
+
+echo "sedsubst: generating $output from $source"
+test -f $output && rm -f $output
+sed "$@" $source > $output
+chmod $mode $output