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

Contents of /slime/test.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.19 - (show annotations)
Fri Sep 19 09:48:29 2008 UTC (5 years, 7 months ago) by heller
Branch: MAIN
Changes since 1.18: +11 -5 lines
File MIME type: application/x-sh
* slime.el (slime-batch-test): Accept test-name and randomize arguments.
* test.sh (usage): Accept -n and -S options.
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 [-bsRTS] [-n <name>] <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 -S don't execute tests in random order (use default ordering)
24 -n <name> run only the test with name <name>
25 EOF
26 exit 1
27 }
28
29 name=$0
30 batch_mode="" # command line arg for emacs
31 dump_results=true
32 use_temp_dir=true
33 test_name=nil
34 randomize=t
35
36 while getopts bsRTn: opt; do
37 case $opt in
38 b) batch_mode="-batch";;
39 s) use_screen=true;;
40 n) test_name="'$OPTARG";;
41 S) randomize=nil;;
42 R) dump_results=false;;
43 T) use_temp_dir=false;;
44 *) usage;;
45 esac
46 done
47
48 shift $((OPTIND - 1))
49 [ $# = 2 ] || usage
50
51 emacs=$1; lisp=$2;
52
53 # Move the code into a directory in /tmp, so that we can compile it
54 # for the current lisp.
55
56 slimedir=$(dirname $name)
57 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 cp -r $slimedir/*.{el,lisp} ChangeLog $slimedir/contrib $tmpdir
73 fi
74
75 cmd=($emacs -nw -q -no-site-file $batch_mode --no-site-file
76 --eval "(setq debug-on-quit t)"
77 --eval "(add-to-list 'load-path \"$testdir\")"
78 --eval "(require 'slime)"
79 --eval "(setq inferior-lisp-program \"$lisp\")"
80 --eval "(slime-batch-test \"$results\" $test_name $randomize)")
81
82 if [ "$use_screen" = "" ]; then
83 "${cmd[@]}"
84 echo $? > $statusfile
85 else
86 session=slime-screen.$$
87 screen -S $session -m -D \
88 bash -c "\"\$@\"; echo \$? > $statusfile" "" "${cmd[@]}" &
89 screenpid=$!
90 trap "screen -S $session -X quit" SIGINT
91 wait $screenpid
92 fi
93
94 if [ -f "$statusfile" ]; then
95 [ "$dump_results" = true ] && cat $results;
96 echo $(cat $statusfile) "test(s) failed."
97 else
98 # Tests crashed
99 echo crashed
100 fi
101
102 exit $status

  ViewVC Help
Powered by ViewVC 1.1.5