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

Diff of /slime/test.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by lgorrie, Mon Aug 29 20:02:58 2005 UTC revision 1.8 by heller, Sat Oct 21 09:27:50 2006 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2    
3  # Run the SLIME test suite in batch mode, saving the results to a file.  # Run the SLIME test suite inside screen, saving the results to a file.
4    
5  # This script's exit status is the number of tests failed. If no tests  # This script's exit status is the number of tests failed. If no tests
6  # fail then no output is printed. If at least one test fails then a  # fail then no output is printed. If at least one test fails then a
# Line 12  Line 12 
12  # This code has been placed in the Public Domain.  All warranties  # This code has been placed in the Public Domain.  All warranties
13  # are disclaimed.  # are disclaimed.
14    
15  if [ $# != 4 ]; then  function usage () {
16      echo "Usage: $0 <emacs> <lisp> <dribble-file> <results-file>"      echo "Usage: $name [-v] [-r] <emacs> <lisp>"
17      exit 1      exit 1
18  fi  }
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  emacs=$1; lisp=$2; dribble=$3; results=$4  shift $((OPTIND - 1))
31  slimedir=$(dirname $0)  [ $# = 2 ] || usage
32    
33    emacs=$1; lisp=$2;
34    
35  # Move the code into a directory in /tmp, so that we can compile it  # Move the code into a directory in /tmp, so that we can compile it
36  # for the current lisp.  # for the current lisp.
37    
38    slimedir=$(dirname $name)
39  testdir=/tmp/slime-test.$$  testdir=/tmp/slime-test.$$
40    results=$testdir/results
41    dribble=$testdir/dribble
42    statusfile=$testdir/status
43    
44  test -d $testdir && rm -r $testdir  test -d $testdir && rm -r $testdir
45    
46  trap "rm -r $testdir" EXIT      # remove temporary directory on exit  trap "rm -r $testdir" EXIT      # remove temporary directory on exit
47    
48  mkdir $testdir  mkdir $testdir
49  cp $slimedir/*.el $slimedir/*.lisp ChangeLog $testdir  cp $slimedir/*.el $slimedir/*.lisp ChangeLog $testdir
50    mkfifo $dribble
51    
52  # you can remove "--batch" to get an emacs window for troubleshooting.  session=slime-screen.$$
 $emacs --no-site-file --no-init-file \  
        --eval "(setq debug-on-quit t)" \  
        --eval "(setq max-lisp-eval-depth 1000)" \  
        --eval "(setq load-path (cons \"$testdir\" load-path))" \  
        --eval "(require 'slime)" \  
        --eval "(setq inferior-lisp-program \"$lisp\")" \  
        --eval "(slime-batch-test \"${results}\")" \  
        &> $dribble \  
53    
54  status=$?  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  if [ -f "$results" ]; then  screenpid=$!
64      echo $status "test(s) failed."  
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."
77  else  else
78      # Tests crashed      # Tests crashed
79      echo crashed      echo crashed
80  fi  fi
81    
82  exit $status  exit $status
   

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.5