/[slime]/slime/test.sh
ViewVC logotype

Contents of /slime/test.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (show annotations)
Thu Sep 18 22:35:47 2008 UTC (5 years, 7 months ago) by heller
Branch: MAIN
Changes since 1.16: +7 -6 lines
File MIME type: application/x-sh
Change defaults.
1 #!/bin/sh
2
3 # Run the SLIME test suite inside screen, saving the results to a file.
4
5
6 # This script's exit status is the number of tests failed. If no tests
7 # fail then no output is printed. If at least one test fails then a
8 # one-line summary is printed.
9
10 # If something unexpected fails, you might get an exit code like 127
11 # or 255 instead. Sorry.
12
13 # This code has been placed in the Public Domain. All warranties
14 # are disclaimed.
15
16 function usage () {
17 cat <<EOF
18 Usage: $name [-b] [-s] [-r] <emacs> <lisp>"
19 -b use batch mode
20 -s use screen to hide emacs
21 -R don't show results file
22 -T no temp directory (use slime in current directory)
23 EOF
24 exit 1
25 }
26
27 name=$0
28 batch_mode="" # command line arg for emacs
29 use_temp_dir=true
30 dump_results=false
31
32 while getopts bsRT opt; do
33 case $opt in
34 b) batch_mode="-batch";;
35 s) use_screen=true;;
36 R) dump_results=false;;
37 T) use_temp_dir=false;;
38 *) usage;;
39 esac
40 done
41
42 shift $((OPTIND - 1))
43 [ $# = 2 ] || usage
44
45 emacs=$1; lisp=$2;
46
47 # Move the code into a directory in /tmp, so that we can compile it
48 # for the current lisp.
49
50 slimedir=$(dirname $name)
51 tmpdir=/tmp/slime-test.$$
52 if [ $use_temp_dir == true ] ; then
53 testdir=$tmpdir
54 else
55 testdir=$(pwd)
56 fi
57 results=$tmpdir/results
58 statusfile=$tmpdir/status
59
60 test -d $tmpdir && rm -r $tmpdir
61
62 trap "rm -r $tmpdir" EXIT # remove temporary directory on exit
63
64 mkdir $tmpdir
65 if [ $use_temp_dir == true ] ; then
66 cp -r $slimedir/*.{el,lisp} ChangeLog $slimedir/contrib $tmpdir
67 fi
68
69 cmd=($emacs -nw -q -no-site-file $batch_mode --no-site-file
70 --eval "(setq debug-on-quit t)"
71 --eval "(add-to-list 'load-path \"$testdir\")"
72 --eval "(require 'slime)"
73 --eval "(setq inferior-lisp-program \"$lisp\")"
74 --eval "(slime-batch-test \"$results\")")
75
76 if [ "$use_screen" = "" ]; then
77 "${cmd[@]}"
78 echo $? > $statusfile
79 else
80 session=slime-screen.$$
81 screen -S $session -m -D \
82 bash -c "\"\$@\"; echo \$? > $statusfile" "" "${cmd[@]}" &
83 screenpid=$!
84 trap "screen -S $session -X quit" SIGINT
85 wait $screenpid
86 fi
87
88 if [ -f "$statusfile" ]; then
89 [ "$dump_results" = true ] && cat $results;
90 echo $(cat $statusfile) "test(s) failed."
91 else
92 # Tests crashed
93 echo crashed
94 fi
95
96 exit $status

  ViewVC Help
Powered by ViewVC 1.1.5