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

Contents of /slime/test.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (hide annotations)
Thu Sep 18 22:35:50 2008 UTC (5 years, 7 months ago) by heller
Branch: MAIN
Changes since 1.17: +1 -1 lines
File MIME type: application/x-sh
Fix usage string.
1 lgorrie 1.1 #!/bin/sh
2    
3 heller 1.8 # Run the SLIME test suite inside screen, saving the results to a file.
4 lgorrie 1.1
5 heller 1.13
6 lgorrie 1.1 # 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 lgorrie 1.7 # This code has been placed in the Public Domain. All warranties
14     # are disclaimed.
15    
16 heller 1.8 function usage () {
17 heller 1.15 cat <<EOF
18 heller 1.18 Usage: $name [-b] [-s] [-R] [-T] <emacs> <lisp>"
19 heller 1.17 -b use batch mode
20 heller 1.15 -s use screen to hide emacs
21 heller 1.17 -R don't show results file
22 heller 1.16 -T no temp directory (use slime in current directory)
23 heller 1.14 EOF
24 lgorrie 1.1 exit 1
25 heller 1.8 }
26    
27     name=$0
28 heller 1.17 batch_mode="" # command line arg for emacs
29 heller 1.16 use_temp_dir=true
30 heller 1.17 dump_results=false
31 heller 1.8
32 heller 1.17 while getopts bsRT opt; do
33 heller 1.8 case $opt in
34 heller 1.17 b) batch_mode="-batch";;
35 heller 1.14 s) use_screen=true;;
36 heller 1.17 R) dump_results=false;;
37 heller 1.16 T) use_temp_dir=false;;
38 heller 1.8 *) usage;;
39     esac
40     done
41    
42     shift $((OPTIND - 1))
43     [ $# = 2 ] || usage
44 lgorrie 1.1
45 heller 1.8 emacs=$1; lisp=$2;
46 lgorrie 1.1
47     # Move the code into a directory in /tmp, so that we can compile it
48     # for the current lisp.
49    
50 heller 1.8 slimedir=$(dirname $name)
51 heller 1.16 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 lgorrie 1.1
69 heller 1.14 cmd=($emacs -nw -q -no-site-file $batch_mode --no-site-file
70 heller 1.10 --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 heller 1.8
76 heller 1.14 if [ "$use_screen" = "" ]; then
77 heller 1.10 "${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 heller 1.8
88     if [ -f "$statusfile" ]; then
89     [ "$dump_results" = true ] && cat $results;
90     echo $(cat $statusfile) "test(s) failed."
91 lgorrie 1.4 else
92     # Tests crashed
93     echo crashed
94 lgorrie 1.1 fi
95    
96     exit $status

  ViewVC Help
Powered by ViewVC 1.1.5