diff options
author | Victor Westerhuis <victor@westerhu.is> | 2021-12-03 14:41:24 +0100 |
---|---|---|
committer | Victor Westerhuis <victor@westerhu.is> | 2021-12-04 01:08:24 +0100 |
commit | 5cf37adb380b4ddf819951913c4d3044071f7e6b (patch) | |
tree | 663e6a81759461beb66067b0e9f4963624f563e3 /test | |
parent | cb0dc1bcb82a9ff4e623a49d05a52ae1f63d0626 (diff) | |
download | colm-5cf37adb380b4ddf819951913c4d3044071f7e6b.tar.gz |
Make tests buildable in out-of-tree build
Let libtool take care of the linking. Prefer linking to libcolm
statically, like before. Add explicit include paths for files included
from the corresponding source directory.
Diffstat (limited to 'test')
-rw-r--r-- | test/aapl.d/Makefile.am | 10 | ||||
-rw-r--r-- | test/colm.d/Makefile.am | 9 | ||||
-rw-r--r-- | test/colm.d/gentests.sh | 2 | ||||
-rw-r--r-- | test/rlhc.d/Makefile.am | 14 | ||||
-rw-r--r-- | test/rlparse.d/Makefile.am | 21 | ||||
-rw-r--r-- | test/trans.d/Makefile.am | 20 | ||||
-rwxr-xr-x | test/trans.d/gentests | 2 |
7 files changed, 62 insertions, 16 deletions
diff --git a/test/aapl.d/Makefile.am b/test/aapl.d/Makefile.am index 906b94ef..4aade8ff 100644 --- a/test/aapl.d/Makefile.am +++ b/test/aapl.d/Makefile.am @@ -102,4 +102,12 @@ gentests: gentests.sh Makefile #-include $(DEPS) clean-local: - rm -Rf working + rm -Rf working *.exp + +all-local: + if test '$(builddir)' != '$(srcdir)'; then \ + $(LN_S) -f '$(srcdir)/'*.exp '$(builddir)'; \ + fi + +check-local: + '$(top_srcdir)/test/runtests' diff --git a/test/colm.d/Makefile.am b/test/colm.d/Makefile.am index e2a4c911..a728facb 100644 --- a/test/colm.d/Makefile.am +++ b/test/colm.d/Makefile.am @@ -186,5 +186,12 @@ gentests: gentests.sh Makefile @$(top_srcdir)/sedsubst $< $@ -w,+x $(SED_SUBST) clean-local: - rm -Rf working + rm -Rf working *.lm *.lmi *.in +all-local: + if test '$(builddir)' != '$(srcdir)'; then \ + $(LN_S) -f '$(srcdir)/'*.lm '$(srcdir)/'*.lmi '$(srcdir)/'*.in '$(builddir)'; \ + fi + +check-local: + '$(top_srcdir)/test/runtests' diff --git a/test/colm.d/gentests.sh b/test/colm.d/gentests.sh index b5cc8982..783f002f 100644 --- a/test/colm.d/gentests.sh +++ b/test/colm.d/gentests.sh @@ -226,7 +226,7 @@ function runtests() fi else # Compilation. - echo $COLM_BIN $COMP $COLM_ADDS $LM '&>' $LOG >> $SH + echo $COLM_BIN -B ../.. $COMP $COLM_ADDS $LM '&>' $LOG >> $SH echo "if [ \$? != 0 ]; then echo \"COMPILATION FAILED (see $LOG)\" >> $DIFF; fi" >> $SH fi diff --git a/test/rlhc.d/Makefile.am b/test/rlhc.d/Makefile.am index 4e9ffe56..4c8e841d 100644 --- a/test/rlhc.d/Makefile.am +++ b/test/rlhc.d/Makefile.am @@ -19,7 +19,7 @@ EXTRA_DIST = gentests rlhc.lm $(RLHC_DEP) $(CASES) noinst_PROGRAMS = rlhc rlhc$(EXEEXT): rlhc.lm $(RLHC_DEP) $(COLM_BIN) - $(COLM_BIN) -b rlhc_object -o $@ $< + $(COLM_BIN) -B '$(top_builddir)' -b rlhc_object -o $@ -I$(srcdir) $< CASES = \ case/atoi1_c.c-C-F1--goto-backend.exp \ @@ -1089,5 +1089,15 @@ CASES = \ case/union.cpp-C-T1--goto-backend.exp \ case/union.cpp-C-T1--goto-backend.in +CLEANFILES = gentests + clean-local: - rm -Rf working + rm -Rf working case + +all-local: + if test '$(builddir)' != '$(srcdir)'; then \ + $(LN_S) -f '$(srcdir)/gentests' '$(srcdir)/case' '$(builddir)'; \ + fi + +check-local: + '$(top_srcdir)/test/runtests' diff --git a/test/rlparse.d/Makefile.am b/test/rlparse.d/Makefile.am index 54a14639..479332ef 100644 --- a/test/rlparse.d/Makefile.am +++ b/test/rlparse.d/Makefile.am @@ -1,6 +1,6 @@ COLM_BIN = ../../src/colm COLM_xCPPFLAGS = -I../../src/include -COLM_xLDFLAGS = -L../../src +COLM_xLDADD = ../../src/libcolm.la noinst_PROGRAMS = rlparse @@ -21,8 +21,8 @@ rlparse_SOURCES = parse.c if.h if.cc commit.cc \ svector.h rlparse_CPPFLAGS = $(COLM_xCPPFLAGS) -rlparse_LDADD = -lcolm -rlparse_LDFLAGS = $(COLM_xLDFLAGS) +rlparse_LDADD = $(COLM_xLDADD) +rlparse_LDFLAGS = -static EXTRA_DIST = \ reducer.lm rlparse.lm ragel.lm \ @@ -34,11 +34,22 @@ EXTRA_DIST = \ BUILT_SOURCES = parse.c if.h if.cc commit.cc parse.c: rlparse.lm reducer.lm $(RAGEL_LM) $(COLM_BIN) - $(COLM_BIN) -c -b rlparse_object -o $@ -e if.h -x if.cc -m commit.cc $< + $(COLM_BIN) -c -b rlparse_object -o $@ -e if.h -x if.cc -m commit.cc -I$(srcdir) $< if.h: parse.c if.cc: parse.c commit.cc: parse.c +CLEANFILES = gentests + clean-local: - rm -Rf working + rm -Rf working case + +all-local: + if test '$(builddir)' != '$(srcdir)'; then \ + $(LN_S) -f '$(srcdir)/gentests' '$(builddir)'; \ + cp -pR -f '$(srcdir)/case' '$(builddir)'; \ + fi + +check-local: + '$(top_srcdir)/test/runtests' diff --git a/test/trans.d/Makefile.am b/test/trans.d/Makefile.am index 4a9d8798..30b53ff1 100644 --- a/test/trans.d/Makefile.am +++ b/test/trans.d/Makefile.am @@ -1,7 +1,7 @@ COLM_BIN = ../../src/colm COLM_xCPPFLAGS = -I../../src/include -COLM_xLDFLAGS = -L../../src +COLM_xLDADD = ../../src/libcolm.la noinst_PROGRAMS = trans @@ -29,12 +29,12 @@ EXTRA_DIST = \ $(CASES) trans.c: trans.lm $(TRANS_DEPS) $(COLM_BIN) - $(COLM_BIN) -b trans_object -c -o $@ $< + $(COLM_BIN) -b trans_object -c -o $@ -I$(srcdir) $< trans_CPPFLAGS = $(COLM_xCPPFLAGS) trans_SOURCES = actparams.cc trans.c main.c -trans_LDADD = -lcolm -trans_LDFLAGS = $(COLM_xLDFLAGS) +trans_LDADD = $(COLM_xLDADD) +trans_LDFLAGS = -static CASES = \ case/any1_asm.rl \ @@ -378,5 +378,15 @@ CASES = \ case/zlen1_ruby.rl \ case/zlen1_rust.rl +CLEANFILES = gentests + clean-local: - rm -Rf working + rm -Rf working case + +all-local: + if test '$(builddir)' != '$(srcdir)'; then \ + $(LN_S) -f '$(srcdir)/gentests' '$(srcdir)/case' '$(builddir)'; \ + fi + +check-local: + '$(top_srcdir)/test/runtests' diff --git a/test/trans.d/gentests b/test/trans.d/gentests index a2064080..dd3bcf91 100755 --- a/test/trans.d/gentests +++ b/test/trans.d/gentests @@ -9,7 +9,7 @@ mkdir -p working echo working/* | xargs rm -f -[ $# = 0 ] && set -- `find case -type f -and -not -name '*_*' | sort` +[ $# = 0 ] && set -- `find -H case -type f -and -not -name '*_*' | sort` for fn; do |