~ubuntu-branches/ubuntu/feisty/slime/feisty

« back to all changes in this revision

Viewing changes to test.sh

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2006-12-05 10:35:50 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20061205103550-qh2ij11czkh5x7ns
Tags: 1:20061201-2
Fix stupid merge error that I missed. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
 
# Run the SLIME test suite in batch mode, saving the results to a file.
 
3
# Run the SLIME test suite inside screen, saving the results to a file.
4
4
 
5
5
# This script's exit status is the number of tests failed. If no tests
6
6
# fail then no output is printed. If at least one test fails then a
12
12
# This code has been placed in the Public Domain.  All warranties
13
13
# are disclaimed.
14
14
 
15
 
if [ $# != 4 ]; then
16
 
    echo "Usage: $0 <emacs> <lisp> <dribble-file> <results-file>"
 
15
function usage () {
 
16
    echo "Usage: $name [-v] [-r] <emacs> <lisp>"
17
17
    exit 1
18
 
fi
19
 
 
20
 
emacs=$1; lisp=$2; dribble=$3; results=$4
21
 
slimedir=$(dirname $0)
 
18
}
 
19
 
 
20
name=$0
 
21
 
 
22
while getopts vr opt; do
 
23
    case $opt in
 
24
        v) verbose=true;;
 
25
        r) dump_results=true;;
 
26
        *) usage;;
 
27
    esac
 
28
done
 
29
 
 
30
shift $((OPTIND - 1))
 
31
[ $# = 2 ] || usage
 
32
 
 
33
emacs=$1; lisp=$2;
22
34
 
23
35
# Move the code into a directory in /tmp, so that we can compile it
24
36
# for the current lisp.
25
37
 
 
38
slimedir=$(dirname $name)
26
39
testdir=/tmp/slime-test.$$
 
40
results=$testdir/results
 
41
dribble=$testdir/dribble
 
42
statusfile=$testdir/status
 
43
 
27
44
test -d $testdir && rm -r $testdir
 
45
 
28
46
trap "rm -r $testdir" EXIT      # remove temporary directory on exit
29
47
 
30
48
mkdir $testdir
31
49
cp $slimedir/*.el $slimedir/*.lisp ChangeLog $testdir
32
 
 
33
 
# you can remove "--batch" to get an emacs window for troubleshooting.
34
 
$emacs --no-site-file --no-init-file \
35
 
       --eval "(setq debug-on-quit t)" \
36
 
       --eval "(setq max-lisp-eval-depth 1000)" \
37
 
       --eval "(setq load-path (cons \"$testdir\" load-path))" \
38
 
       --eval "(require 'slime)" \
39
 
       --eval "(setq inferior-lisp-program \"$lisp\")" \
40
 
       --eval "(slime-batch-test \"${results}\")" \
41
 
       &> $dribble \
42
 
 
43
 
status=$?
44
 
 
45
 
if [ -f "$results" ]; then
46
 
    echo $status "test(s) failed."
 
50
mkfifo $dribble
 
51
 
 
52
session=slime-screen.$$
 
53
 
 
54
screen -S $session -m -D bash -c "$emacs -nw -q -no-site-file --no-site-file \
 
55
       --eval '(setq debug-on-quit t)' \
 
56
       --eval '(setq max-lisp-eval-depth 1000)' \
 
57
       --eval '(setq load-path (cons \"$testdir\" load-path))' \
 
58
       --eval '(require (quote slime))' \
 
59
       --eval '(setq inferior-lisp-program \"$lisp\")' \
 
60
       --eval '(slime-batch-test \"$results\")' > $dribble;\
 
61
       echo \$? > $statusfile" &
 
62
 
 
63
screenpid=$!
 
64
 
 
65
if [ "$verbose" = true ]; then
 
66
    cat $dribble &
 
67
else
 
68
    cat $dribble > /dev/null &
 
69
fi;
 
70
 
 
71
trap "screen -S $session -X quit" SIGINT
 
72
wait $screenpid
 
73
 
 
74
if [ -f "$statusfile" ]; then
 
75
    [ "$dump_results" = true ] && cat $results;
 
76
    echo $(cat $statusfile) "test(s) failed."
47
77
else
48
78
    # Tests crashed
49
79
    echo crashed
50
80
fi
51
81
 
52
82
exit $status
53