diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2010-05-26 22:30:55 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2010-05-26 22:39:15 -0700 |
commit | 7e95ac778d0512a3940bf77daa50263e10d408f1 (patch) | |
tree | 42627f166f1391b678a18c25aab99815196dfd9a | |
parent | 707ed29d22cd973f07633a0ed82de10075d50edb (diff) |
xts: Introduce check.sh wrapper script for in-tree testing
Having all the commands and environment variable overrides for in-tree
testing in the Makefile was nice, but a wrapper script means you can do
in-tree testing with or without the "make check" machinery.
Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.am | 9 | ||||
-rw-r--r-- | README | 8 | ||||
-rw-r--r-- | check.sh.in | 42 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | xts5/Makefile.am | 20 |
6 files changed, 63 insertions, 22 deletions
@@ -29,4 +29,5 @@ ltmain.sh missing stamp-h1 tcc +check.sh results/ diff --git a/Makefile.am b/Makefile.am index fcbebd3d..42a43d1b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,9 +6,14 @@ tetexec.cfg: @rm -f xts5/$@ @cd xts5 && $(MAKE) $(AM_MAKEFLAGS) $@ -# Helper target for testing subsets +# "make check" testing. Override the test set with scenario. +scenario = +check-local: check.sh + $(SHELL) $(builddir)/check.sh $(scenario) + +# Helper target for testing subsets (test-Xopen, etc.) test-%: - @cd xts5 && $(MAKE) $(AM_MAKEFLAGS) $@ + @$(MAKE) $(AM_MAKEFLAGS) check scenario='$*' logfile: cd xts5 && $(MAKE) logfile @@ -30,7 +30,13 @@ The build and install are now straightforward: Running the Tests ================= The tests can be run from the build directory or from the installed -package. The "make check" framework can be used from the build tree. +package. The check.sh script sets up the environment to run tests from +the build tree. + + $ ./check.sh # run all the tests + $ ./check.sh XI # run just the XI test scenario + +The "make check" framework can also be used from the build tree. $ make check # run all the tests $ make check scenario=XI # run just the XI test scenario diff --git a/check.sh.in b/check.sh.in new file mode 100644 index 00000000..441d48b7 --- /dev/null +++ b/check.sh.in @@ -0,0 +1,42 @@ +#!/bin/sh + +# Various source tree directories +srcdir="@srcdir@" +builddir="@builddir@" + +# xts variables +TET_ROOT="$srcdir" +TET_EXECUTE="$builddir/xts5" +export TET_ROOT TET_EXECUTE + +# Program variables +EXEEXT=@EXEEXT@ +SHELL="@SHELL@" +PERL="@PERL@" +XSET="@XSET@" +XDPYINFO="@XDPYINFO@" +export XSET XDPYINFO + +TCC="$builddir/src/tet3/tcc/tcc$EXEEXT" +XTS_REPORT="$builddir/xts5/src/bin/reports/xts-report$EXEEXT" +XTS_CONFIG="$builddir/xts5/bin/xts-config" +XTS_RUN="$builddir/xts5/bin/xts-run" +export TCC XTS_REPORT XTS_CONFIG + +config="$builddir/xts5/tetexec.cfg" +config_in="$srcdir/xts5/tetexec.cfg.in" + +#run_tcc = TET_ROOT='$(top_srcdir)' $(TCC) -e -a '$(abs_builddir)' \ +# -x tetexec.cfg +#XTS_CONFIG = TET_ROOT='$(top_srcdir)' XSET='$(XSET)' XDPYINFO='$(XDPYINFO)' \ +# $(PERL) -p $(srcdir)/bin/xts-config + +if [ ! -f "$config" ]; then + trap 'rm -f "$config"' 0 1 2 3 15 + if ! "$PERL" "$XTS_CONFIG" < "$config_in" > "$config"; then + echo "error: failed to create config file $config" >&2 + exit 1 + fi +fi + +exec "$SHELL" "$XTS_RUN" -c "$config" -o results "$@" diff --git a/configure.ac b/configure.ac index acb4ac9a..85728047 100644 --- a/configure.ac +++ b/configure.ac @@ -111,6 +111,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], AC_CONFIG_FILES([ Makefile +check.sh src/Makefile src/tet3/Makefile src/tet3/apilib/Makefile @@ -155,4 +156,8 @@ xts5/XIproto/Makefile xts5/XI/Makefile ]) +AC_CONFIG_COMMANDS([mode],[ +chmod +x check.sh +]) + AC_OUTPUT diff --git a/xts5/Makefile.am b/xts5/Makefile.am index 5249940c..f69649c0 100644 --- a/xts5/Makefile.am +++ b/xts5/Makefile.am @@ -26,29 +26,11 @@ bin/xts-config: bin/xts-config.in bin/xts-run: bin/xts-run.in $(AM_V_GEN)$(EDIT) < $< > $@ -# Setup for testing -TCC = $(top_builddir)/src/tet3/tcc/tcc$(EXEEXT) -run_tcc = TET_ROOT='$(top_srcdir)' $(TCC) -e -a '$(abs_builddir)' \ - -x tetexec.cfg -report = $(builddir)/src/bin/reports/xts-report$(EXEEXT) -d2 -scenario = +# Config file generation for in-tree testing XTS_CONFIG = TET_ROOT='$(top_srcdir)' XSET='$(XSET)' XDPYINFO='$(XDPYINFO)' \ $(PERL) -p $(srcdir)/bin/xts-config - tetexec.cfg: tetexec.cfg.in $(srcdir)/bin/xts-config $(AM_V_GEN)$(XTS_CONFIG) < $< > $@.tmp && mv -f $@.tmp $@ || rm -f $@.tmp -check-local: tetexec.cfg - @outdir="$(top_builddir)/results/`date +%F-%T`"; \ - echo $(run_tcc) -i "$$outdir" xts5 $(scenario); \ - $(run_tcc) -i "$$outdir" xts5 $(scenario); \ - ret=$$?; \ - echo $(report) -f "$$outdir/journal" ">" "$$outdir/summary"; \ - $(report) -f "$$outdir/journal" > "$$outdir/summary"; \ - exit $$ret - -# Helpful pattern target for testing subsets (test-Xopen, etc.) -test-%: - @$(MAKE) $(AM_MAKEFLAGS) check scenario='$*' # Store results in xts5/results/YYYY-mm-dd-HH:mm.xzy logfile: |