From 0948041886d4dd87279a1159a2257099ef964735 Mon Sep 17 00:00:00 2001 From: sam Date: Sat, 19 Dec 2009 12:28:36 +0000 Subject: [PATCH] Move all tests to a single directory for "make check". git-svn-id: svn://svn.zoy.org/elk/trunk@275 55e467fa-43c5-0310-a8a2-de718669efc6 --- .gitignore | 3 +++ configure.ac | 11 ++++++--- examples/Makefile.am | 7 ------ examples/tests/Makefile.am | 20 ---------------- examples/tests/gc-stress.scm | 33 --------------------------- test/Makefile.am | 10 ++++++-- {examples/tests => test}/README | 0 test/check-gc.in | 26 +++++++++++++++++++++ test/check-gc2.in | 18 +++++++++++++++ test/check-r4rs.in | 6 +++++ {examples/tests => test}/r4rstest.scm | 0 11 files changed, 69 insertions(+), 65 deletions(-) delete mode 100644 examples/tests/Makefile.am delete mode 100644 examples/tests/gc-stress.scm rename {examples/tests => test}/README (100%) create mode 100644 test/check-gc.in create mode 100644 test/check-gc2.in create mode 100644 test/check-r4rs.in rename {examples/tests => test}/r4rstest.scm (100%) diff --git a/.gitignore b/.gitignore index 026ad93..ad5172f 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,9 @@ stamp-* # Configure-generated files include/site.h scm/slib.scm +test/check-gc +test/check-gc2 +test/check-r4rs # Build-generated files src/elk lib/xwidgets/xaw/*.c diff --git a/configure.ac b/configure.ac index 9b5b885..775184e 100644 --- a/configure.ac +++ b/configure.ac @@ -571,7 +571,7 @@ AM_CONDITIONAL(HAVE_GROFF, test "${ac_cv_my_have_groff}" = "yes") dnl dnl Finished! dnl -AC_OUTPUT([ +AC_CONFIG_FILES([ Makefile doc/Makefile doc/bitstring/Makefile @@ -587,7 +587,6 @@ AC_OUTPUT([ doc/xlib/Makefile doc/xt/Makefile examples/Makefile - examples/tests/Makefile include/Makefile lib/Makefile lib/misc/Makefile @@ -599,10 +598,16 @@ AC_OUTPUT([ scm/Makefile src/Makefile test/Makefile - +]) +AC_CONFIG_FILES([ scm/slib.scm include/site.h ]) +AC_CONFIG_FILES([test/check-gc], [chmod 0755 test/check-gc]) +AC_CONFIG_FILES([test/check-gc2], [chmod 0755 test/check-gc2]) +AC_CONFIG_FILES([test/check-r4rs], [chmod 0755 test/check-r4rs]) + +AC_OUTPUT cat << EOF diff --git a/examples/Makefile.am b/examples/Makefile.am index 6a14977..38619c1 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,6 +1,5 @@ NULL = -SUBDIRS = tests EXTRA_DIST = $(DATA) examplesdir = $(datadir)/doc/@PACKAGE@/examples @@ -43,12 +42,6 @@ scheme_DATA = \ scheme/unify.scm \ $(NULL) -testsdir = $(examplesdir)/tests -tests_DATA = \ - tests/README \ - tests/r4rstest.scm \ - $(NULL) - unixdir = $(examplesdir)/unix unix_DATA = \ unix/pipsiz.scm \ diff --git a/examples/tests/Makefile.am b/examples/tests/Makefile.am deleted file mode 100644 index 34428d8..0000000 --- a/examples/tests/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ - -CLEANFILES = $(allstamps) mytest.scm tmp1 tmp2 tmp3 - -allstamps = stamp-r4rs stamp-gc - -if NATIVE_BUILD -check-local: $(allstamps) -endif - -stamp-r4rs: $(top_builddir)/src/elk - rm -f $@ mytest.scm - sed -e 's/r4rstest/mytest/g' < $(srcdir)/r4rstest.scm > mytest.scm - echo '(test-cont) (test-sc4) (test-delay)' >> mytest.scm - -$(top_builddir)/src/elk -p .:$(top_srcdir)/scm -l mytest.scm - rm -f mytest.scm tmp1 tmp2 tmp3 - printf "" > $@ - -stamp-gc: $(top_builddir)/src/elk - -$(top_builddir)/src/elk -p .:$(top_srcdir)/scm -l gc-stress.scm - diff --git a/examples/tests/gc-stress.scm b/examples/tests/gc-stress.scm deleted file mode 100644 index 4492ee5..0000000 --- a/examples/tests/gc-stress.scm +++ /dev/null @@ -1,33 +0,0 @@ - -;; this test sometimes crashes the GC with the well-known -;; Panic: Visit: object not in prev space at 0x40210b2c ('pair') 8199 8201 (dumping core). - -(display "testing garbage collector integrity (1000 loops)\n") -;(set! garbage-collect-notify? #t) -(define c 0) -(define cb - (lambda ignore - (let ((s '())) - (set! c (+ 1 c)) - (call/cc - (lambda (return) - (do ((i 0 (+ i 1))) - ((= i 100)) - (let ((a (+ i 1))) - (set! s (append s (list i)))) - (if (= i 60) (return #t)))))))) -(do ((i 0 (+ i 1))) ((= i 1000)) (cb)) -(display "test passed.\n") - -;; This test used to crash the GC, too. - -(display "testing deep calls (2000 calls)\n") -(define crash - (lambda (x) - (begin - (if (> x 0) - (crash (- x 1))) - (collect)))) -(crash 2000) -(display "test passed.\n") - diff --git a/test/Makefile.am b/test/Makefile.am index b2a1bbe..f00ba19 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,12 @@ # $Id$ -EXTRA_DIST = check-build +EXTRA_DIST = README check-build r4rstest.scm \ + check-gc.in check-gc2.in check-r4rs.in +DISTCLEANFILES = check-gc check-gc2 check-r4rs -TESTS = check-build +if NATIVE_BUILD +native_tests = check-gc check-gc2 check-r4rs +endif + +TESTS = check-build $(native_tests) diff --git a/examples/tests/README b/test/README similarity index 100% rename from examples/tests/README rename to test/README diff --git a/test/check-gc.in b/test/check-gc.in new file mode 100644 index 0000000..5c544a3 --- /dev/null +++ b/test/check-gc.in @@ -0,0 +1,26 @@ +#!/bin/sh + +# this test sometimes crashes the GC with the well-known +# Panic: Visit: object not in prev space at 0x40210b2c ('pair') 8199 8201 (dumping core). + +cat << EOF | @top_builddir@/src/elk -p .:@top_srcdir@/scm -l - + +(display "testing garbage collector integrity (10000 loops)\n") +;(set! garbage-collect-notify? #t) +(define c 0) +(define cb + (lambda ignore + (let ((s '())) + (set! c (+ 1 c)) + (call/cc + (lambda (return) + (do ((i 0 (+ i 1))) + ((= i 100)) + (let ((a (+ i 1))) + (set! s (append s (list i)))) + (if (= i 60) (return #t)))))))) +(do ((i 0 (+ i 1))) ((= i 10000)) (cb)) +(display "test passed.\n") + +EOF + diff --git a/test/check-gc2.in b/test/check-gc2.in new file mode 100644 index 0000000..bb3624a --- /dev/null +++ b/test/check-gc2.in @@ -0,0 +1,18 @@ +#!/bin/sh + +# This test used to crash the GC. + +cat << EOF | @top_builddir@/src/elk -p .:@top_srcdir@/scm -l - + +(display "testing deep calls (2000 calls)\n") +(define crash + (lambda (x) + (begin + (if (> x 0) + (crash (- x 1))) + (collect)))) +(crash 2000) +(display "test passed.\n") + +EOF + diff --git a/test/check-r4rs.in b/test/check-r4rs.in new file mode 100644 index 0000000..b294144 --- /dev/null +++ b/test/check-r4rs.in @@ -0,0 +1,6 @@ +#!/bin/sh + +(cat @srcdir@/r4rstest.scm; echo '(test-cont) (test-sc4) (test-delay)') \ + | @top_builddir@/src/elk -p .:@top_srcdir@/scm -l - +rm -f tmp1 tmp2 tmp3 + diff --git a/examples/tests/r4rstest.scm b/test/r4rstest.scm similarity index 100% rename from examples/tests/r4rstest.scm rename to test/r4rstest.scm