From: Mark Wooding Date: Wed, 19 Aug 2015 16:47:15 +0000 (+0100) Subject: Include test machinery in the new build system. X-Git-Tag: 0.2.0~66 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/commitdiff_plain/8d1d7d3eb07fe738fe5458acee84ef84919638ce Include test machinery in the new build system. --- diff --git a/Makefile.am b/Makefile.am index 55757e0..515031e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,4 +36,7 @@ SUBDIRS += src ## The runtime support library. SUBDIRS += lib +## The tests and examples. +SUBDIRS += test + ###----- That's all, folks -------------------------------------------------- diff --git a/configure.ac b/configure.ac index 264bef2..cb1c5a6 100644 --- a/configure.ac +++ b/configure.ac @@ -79,7 +79,7 @@ AC_SUBST([lispsysdir], [$with_lisp_system_dir]) dnl-------------------------------------------------------------------------- dnl Output. -AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile]) +AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile test/Makefile]) AC_OUTPUT dnl----- That's all, folks -------------------------------------------------- diff --git a/src/parser/parser-test.lisp b/src/parser/parser-test.lisp index 6718d5c..1fb292d 100644 --- a/src/parser/parser-test.lisp +++ b/src/parser/parser-test.lisp @@ -361,10 +361,11 @@ (def-test-method test-simple-tree-parser ((test test-parser) :run nil) ;;;-------------------------------------------------------------------------- ;;; Test expression parser. -(defparse token (:context (context character-parser-context) parser) - (with-gensyms (value) - (expand-parser-spec context - `(seq ((,value ,parser) :whitespace) ,value)))) +(eval-when (:compile-toplevel :load-toplevel :execute) + (defparse token (:context (context character-parser-context) parser) + (with-gensyms (value) + (expand-parser-spec context + `(seq ((,value ,parser) :whitespace) ,value))))) (let ((add (binop "+" (x y 5) `(+ ,x ,y))) (sub (binop "-" (x y 5) `(- ,x ,y))) diff --git a/src/sod-test.asd b/src/sod-test.asd index 38b5095..a0a3972 100644 --- a/src/sod-test.asd +++ b/src/sod-test.asd @@ -63,15 +63,11 @@ ;;; Testing. (defmethod perform ((op test-op) (system (eql (find-system "sod-test")))) - (operate 'load-op system) - (funcall (find-symbol "RUN-TESTS" "SOD-TEST"))) - -;;;-------------------------------------------------------------------------- -;;; Hacks. - -(defmethod perform :around - ((op compile-op) (component (eql (find-system "sod-test")))) - (let ((*compile-file-failure-behaviour* :warn)) - (call-next-method))) + (handler-bind (((or warning style-warning) + (lambda (cond) + (declare (ignore cond)) + (invoke-restart 'muffle-warning)))) + (operate 'load-op system) + (funcall (find-symbol "RUN-TESTS" "SOD-TEST")))) ;;;----- That's all, folks -------------------------------------------------- diff --git a/src/sod.asd b/src/sod.asd index af2cd64..a618e39 100644 --- a/src/sod.asd +++ b/src/sod.asd @@ -169,6 +169,10 @@ (defmethod perform ((op test-op) (component (eql (find-system "sod")))) (declare (ignore op component)) - (operate 'test-op "sod-test" :force t)) + (handler-bind (((or warning style-warning) + (lambda (cond) + (declare (ignore cond)) + (invoke-restart 'muffle-warning)))) + (operate 'test-op "sod-test"))) ;;;----- That's all, folks -------------------------------------------------- diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..300ad69 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,43 @@ +### -*-makefile-*- +### +### Build script for SOD examples and tests +### +### (c) 2015 Straylight/Edgeware +### + +###----- Licensing notice --------------------------------------------------- +### +### This file is part of the Sensble Object Design, an object system for C. +### +### SOD 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. +### +### SOD 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 SOD; if not, write to the Free Software Foundation, +### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +include $(top_srcdir)/vars.am + +###-------------------------------------------------------------------------- +### The silly Chimaera example. + +check_PROGRAMS += chimaera + +EXTRA_DIST += chimaera.sod +nodist_chimaera_SOURCES = chimaera.c chimaera.h +BUILT_SOURCES += $(nodist_chimaera_SOURCES) + +EXTRA_DIST += chimaera.ref +CLEANFILES += chimaera.out +check-local:: chimaera chimaera.ref + ./chimaera >chimaera.out + diff -u $(srcdir)/chimaera.ref chimaera.out + +###----- That's all, folks -------------------------------------------------- diff --git a/test/chimaera.ref b/test/chimaera.ref new file mode 100644 index 0000000..1842c08 --- /dev/null +++ b/test/chimaera.ref @@ -0,0 +1,36 @@ +provoking Lion as a lion +Munch! +tickle Lion #0... +Munch! +tickle Lion #1... +Munch! +tickle Lion #2... +Munch! +provoking Goat as a goat +Bonk! +tickle Goat #0... +Bonk! +tickle Goat #1... +Bonk! +tickle Goat #2... +Bonk! +provoking Serpent as a serpent +Nom! +tickle Serpent #0... +Sssss! +tickle Serpent #1... +Sssss! +tickle Serpent #2... +Nom! +provoking Chimaera as a lion +Munch! +provoking Chimaera as a goat +Bonk! +provoking Chimaera as a serpent +Nom! +tickle Chimaera #0... +Munch! +tickle Chimaera #1... +Munch! +tickle Chimaera #2... +Munch!