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

Contents of /slime/test.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.23 - (hide annotations)
Wed Oct 28 20:28:03 2009 UTC (4 years, 5 months ago) by heller
Branch: MAIN
CVS Tags: SLIME-2-3, SLIME-2-2, byte-stream, FAIRLY-STABLE, HEAD
Changes since 1.22: +2 -1 lines
File MIME type: application/x-sh
* test.sh: Don't copy contribs. Slime should work without them.
* swank-loader.lisp (setup): Compile contribs only if directory
exists.
1 trittweiler 1.22 #!/bin/bash
2 lgorrie 1.1
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.19 Usage: $name [-bsRTS] [-n <name>] <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.19 -S don't execute tests in random order (use default ordering)
24     -n <name> run only the test with name <name>
25 heller 1.14 EOF
26 lgorrie 1.1 exit 1
27 heller 1.8 }
28    
29     name=$0
30 heller 1.17 batch_mode="" # command line arg for emacs
31 heller 1.19 dump_results=true
32 heller 1.16 use_temp_dir=true
33 heller 1.19 test_name=nil
34     randomize=t
35 heller 1.8
36 heller 1.20 while getopts bsRTSn: opt; do
37 heller 1.8 case $opt in
38 heller 1.17 b) batch_mode="-batch";;
39 heller 1.14 s) use_screen=true;;
40 heller 1.19 n) test_name="'$OPTARG";;
41     S) randomize=nil;;
42 heller 1.17 R) dump_results=false;;
43 heller 1.16 T) use_temp_dir=false;;
44 heller 1.8 *) usage;;
45     esac
46     done
47    
48     shift $((OPTIND - 1))
49     [ $# = 2 ] || usage
50 lgorrie 1.1
51 heller 1.8 emacs=$1; lisp=$2;
52 lgorrie 1.1
53     # Move the code into a directory in /tmp, so that we can compile it
54     # for the current lisp.
55    
56 heller 1.8 slimedir=$(dirname $name)
57 heller 1.16 tmpdir=/tmp/slime-test.$$
58     if [ $use_temp_dir == true ] ; then
59     testdir=$tmpdir
60     else
61     testdir=$(pwd)
62     fi
63     results=$tmpdir/results
64     statusfile=$tmpdir/status
65    
66     test -d $tmpdir && rm -r $tmpdir
67    
68     trap "rm -r $tmpdir" EXIT # remove temporary directory on exit
69    
70     mkdir $tmpdir
71     if [ $use_temp_dir == true ] ; then
72 heller 1.23 cp -r $slimedir/*.{el,lisp} ChangeLog $tmpdir
73     # cp -r $slimedir/contrib $tmpdir
74 heller 1.16 fi
75 lgorrie 1.1
76 heller 1.14 cmd=($emacs -nw -q -no-site-file $batch_mode --no-site-file
77 heller 1.10 --eval "(setq debug-on-quit t)"
78     --eval "(add-to-list 'load-path \"$testdir\")"
79     --eval "(require 'slime)"
80     --eval "(setq inferior-lisp-program \"$lisp\")"
81 heller 1.19 --eval "(slime-batch-test \"$results\" $test_name $randomize)")
82 heller 1.8
83 heller 1.14 if [ "$use_screen" = "" ]; then
84 heller 1.10 "${cmd[@]}"
85     echo $? > $statusfile
86     else
87     session=slime-screen.$$
88     screen -S $session -m -D \
89     bash -c "\"\$@\"; echo \$? > $statusfile" "" "${cmd[@]}" &
90     screenpid=$!
91 heller 1.21 trap "screen -S $session -X quit" SIGINT SIGQUIT
92 heller 1.10 wait $screenpid
93     fi
94 heller 1.8
95     if [ -f "$statusfile" ]; then
96 heller 1.21 [ "$dump_results" = true ] && cat $results
97     status=$(cat $statusfile)
98     echo $status "test(s) failed."
99 lgorrie 1.4 else
100     # Tests crashed
101     echo crashed
102 heller 1.21 status=255
103 lgorrie 1.1 fi
104    
105     exit $status

  ViewVC Help
Powered by ViewVC 1.1.5