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

Contents of /slime/test.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (hide annotations)
Fri Aug 8 15:02:04 2008 UTC (5 years, 8 months ago) by heller
Branch: MAIN
Changes since 1.12: +1 -0 lines
File MIME type: application/x-sh
*** empty log message ***
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     echo "Usage: $name [-v] [-r] <emacs> <lisp>"
18 lgorrie 1.1 exit 1
19 heller 1.8 }
20    
21     name=$0
22    
23     while getopts vr opt; do
24     case $opt in
25     v) verbose=true;;
26     r) dump_results=true;;
27     *) usage;;
28     esac
29     done
30    
31     shift $((OPTIND - 1))
32     [ $# = 2 ] || usage
33 lgorrie 1.1
34 heller 1.8 emacs=$1; lisp=$2;
35 lgorrie 1.1
36     # Move the code into a directory in /tmp, so that we can compile it
37     # for the current lisp.
38    
39 heller 1.8 slimedir=$(dirname $name)
40 lgorrie 1.1 testdir=/tmp/slime-test.$$
41 heller 1.8 results=$testdir/results
42     dribble=$testdir/dribble
43     statusfile=$testdir/status
44    
45 lgorrie 1.1 test -d $testdir && rm -r $testdir
46 heller 1.8
47 lgorrie 1.1 trap "rm -r $testdir" EXIT # remove temporary directory on exit
48    
49     mkdir $testdir
50 heller 1.9 cp -r $slimedir/*.{el,lisp} ChangeLog $slimedir/contrib $testdir
51 heller 1.8 mkfifo $dribble
52 lgorrie 1.1
53 heller 1.10 cmd=($emacs -nw -q -no-site-file --no-site-file
54     --eval "(setq debug-on-quit t)"
55     --eval "(add-to-list 'load-path \"$testdir\")"
56     --eval "(require 'slime)"
57     --eval "(setq inferior-lisp-program \"$lisp\")"
58     --eval "(slime-batch-test \"$results\")")
59 heller 1.8
60     if [ "$verbose" = true ]; then
61 heller 1.10 "${cmd[@]}"
62     echo $? > $statusfile
63     else
64     session=slime-screen.$$
65     screen -S $session -m -D \
66     bash -c "\"\$@\"; echo \$? > $statusfile" "" "${cmd[@]}" &
67     screenpid=$!
68     trap "screen -S $session -X quit" SIGINT
69     wait $screenpid
70     fi
71 heller 1.8
72     if [ -f "$statusfile" ]; then
73     [ "$dump_results" = true ] && cat $results;
74     echo $(cat $statusfile) "test(s) failed."
75 lgorrie 1.4 else
76     # Tests crashed
77     echo crashed
78 lgorrie 1.1 fi
79    
80     exit $status

  ViewVC Help
Powered by ViewVC 1.1.5