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

Contents of /slime/test.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (hide annotations)
Thu Sep 18 15:23:37 2008 UTC (5 years, 6 months ago) by heller
Branch: MAIN
Changes since 1.15: +25 -17 lines
File MIME type: application/x-sh
Some cleanups for the REPL code.

* slime.el (slime-show-last-output)
(slime-show-last-output-function)
(slime-show-last-output-region)
(slime-maybe-display-output-buffer)
(slime-repl-last-input-start-mark): Delete unused code.

(slime-repl-emit-result, slime-repl-insert-prompt)
(slime-repl-show-abort, slime-repl-insert-result)
(slime-insert-transcript-delimiter)
(slime-eval-with-transcript-cont): Consistently use save-excursion
and insert-before-markers.  We always want to preserve the cursor
position in the input region (for type-ahead).

(slime-batch-test): Use a timer.
(slime-check-buffer-contents): New function to test contents and
current position.  Use it in various places.

(sldb-recenter-region, def-slime-test interactive-eval)
(def-slime-test interactive-eval-output): Act slightly differently
when the test suite is executed in batch mode (without terminal).

* swank.lisp (handle-requests): Flush output.
(interactive-eval, interactive-eval): Don't use fresh-line, as
that makes it harder to test the REPL code.

* test.sh (Usage): Add a -T switch to run slime in the current
directory without copying (and compiling) everything to a
temporary directory.
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.14 Usage: $name [-b] [-s] [-r] <emacs> <lisp>"
19 heller 1.16 -r show results file
20 heller 1.15 -s use screen to hide emacs
21 heller 1.16 -B disable batch mode
22     -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.16 batch_mode=-batch # command line arg for emacs
29     use_temp_dir=true
30 heller 1.8
31 heller 1.16 while getopts srBT opt; do
32 heller 1.8 case $opt in
33 heller 1.14 s) use_screen=true;;
34 heller 1.8 r) dump_results=true;;
35 heller 1.16 B) batch_mode="";;
36     T) use_temp_dir=false;;
37 heller 1.8 *) usage;;
38     esac
39     done
40    
41     shift $((OPTIND - 1))
42     [ $# = 2 ] || usage
43 lgorrie 1.1
44 heller 1.8 emacs=$1; lisp=$2;
45 lgorrie 1.1
46     # Move the code into a directory in /tmp, so that we can compile it
47     # for the current lisp.
48    
49 heller 1.8 slimedir=$(dirname $name)
50 heller 1.16 tmpdir=/tmp/slime-test.$$
51     if [ $use_temp_dir == true ] ; then
52     testdir=$tmpdir
53     else
54     testdir=$(pwd)
55     fi
56     results=$tmpdir/results
57     statusfile=$tmpdir/status
58    
59     test -d $tmpdir && rm -r $tmpdir
60    
61     trap "rm -r $tmpdir" EXIT # remove temporary directory on exit
62    
63     mkdir $tmpdir
64     if [ $use_temp_dir == true ] ; then
65     cp -r $slimedir/*.{el,lisp} ChangeLog $slimedir/contrib $tmpdir
66     fi
67 lgorrie 1.1
68 heller 1.14 cmd=($emacs -nw -q -no-site-file $batch_mode --no-site-file
69 heller 1.10 --eval "(setq debug-on-quit t)"
70     --eval "(add-to-list 'load-path \"$testdir\")"
71     --eval "(require 'slime)"
72     --eval "(setq inferior-lisp-program \"$lisp\")"
73     --eval "(slime-batch-test \"$results\")")
74 heller 1.8
75 heller 1.14 if [ "$use_screen" = "" ]; then
76 heller 1.10 "${cmd[@]}"
77     echo $? > $statusfile
78     else
79     session=slime-screen.$$
80     screen -S $session -m -D \
81     bash -c "\"\$@\"; echo \$? > $statusfile" "" "${cmd[@]}" &
82     screenpid=$!
83     trap "screen -S $session -X quit" SIGINT
84     wait $screenpid
85     fi
86 heller 1.8
87     if [ -f "$statusfile" ]; then
88     [ "$dump_results" = true ] && cat $results;
89     echo $(cat $statusfile) "test(s) failed."
90 lgorrie 1.4 else
91     # Tests crashed
92     echo crashed
93 lgorrie 1.1 fi
94    
95     exit $status

  ViewVC Help
Powered by ViewVC 1.1.5