0.pre7.63:
[sbcl.git] / tests / clocc-ansi.test.sh
1 #!/bin/sh
2
3 # Run clocc's ansi-test suite on SBCL (if you set the appropriate
4 # environment variable so that the test suite, a separate piece of
5 # software, can be found).
6 #
7 # This is implemented as a shell script because ansi-test likes to
8 # report its errors on standard output and it's convenient to use the
9 # *nix shell tools to extract them.
10
11 # clocc = Common Lisp Open Code Collection, available on
12 #         <http://clocc.sourceforge.net/>
13 # ansi-test = one of the subdirectories in clocc, containing lotso tests
14 #             for ANSI compliance (and the occasional test for CLISP
15 #             compatibility too:-)
16
17 # This software is part of the SBCL system. See the README file for
18 # more information.
19 #
20 # While most of SBCL is derived from the CMU CL system, the test
21 # files (like this one) were written from scratch after the fork
22 # from CMU CL.
23
24 # This software is in the public domain and is provided with
25 # absolutely no warranty. See the COPYING and CREDITS files for
26 # more information.
27
28 # Remember where we came from so we can find local support files later.
29 originalpwd=`pwd`
30
31 # Find clocc ansi-test (or just punt, returning success).
32 if [ "$SBCL_CLOCC_ANSI_TEST" = "" ] ; then
33     echo //punting clocc ansi-test because SBCL_CLOCC_ANSI_TEST is undefined
34     exit 104
35 else 
36     echo //going on to run clocc ansi-test in $SBCL_CLOCC_ANSI_TEST
37     cd $SBCL_CLOCC_ANSI_TEST
38 fi
39
40 # The condition system is for the weak.
41 tmpprefix="${TMPDIR:-/tmp}/sbcl-clocc-ansi-test-$$"
42 rawfilename="$tmpprefix-raw.tmp"
43 bugsfilename="$tmpprefix-bugs.tmp"
44
45 # Go SBCL go.
46 $SBCL <<EOF >$rawfilename
47 (in-package :cl-user)
48 ;;; Tell ansi-test about our known bugs.
49 (load "$originalpwd/clocc-ansi-test-known-bugs.lisp")
50 ;;; Actually run ansi-test.
51 (load "tests.lisp")
52 ;;; Return a special status code to show that we reached the end
53 ;;; normally instead of taking a dirt nap.
54 (print "back from ansi-test tests.lisp")
55 (sb-ext:quit :unix-status 52)
56 EOF
57 if [ $? != 52 ]; then
58     echo "failure: SBCL didn't finish running clocc ansi-test."
59     exit 1
60 fi
61
62 # Klingon programmers handle errors by recognizing error strings
63 # in standard output.
64 if egrep 'ERROR!!' $rawfilename > $bugsfilename; then
65     # new bugs, better luck next time
66     cat $bugsfilename
67     exit 1
68 else
69     # only known bugs, happy happy joy joy
70     rm $rawfilename $bugsfilename
71     exit 104
72 fi