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