Add Licensing and Contributing
[clnl] / bin / diagnose-test
1 #!/bin/bash -e
2
3 if ! [ -n "$1" ] ; then
4   echo "Uhm, need a test name, yo"
5   exit 1
6 fi
7 TEST=$@
8
9 sbcl --eval "(asdf:load-system :clnl-test)" --eval "(quit)" &> /dev/null
10
11 runtestfn() {
12   sbcl --noinform --disable-ldb --lose-on-corruption --end-runtime-options \
13     --eval "(asdf:initialize-source-registry \`(:source-registry (:tree ,(car (directory \"src\"))) :INHERIT-CONFIGURATION))" \
14     --eval "(asdf:load-system :clnl-test)" \
15     --eval "(clnl-test::$1 \"$TEST\")" \
16     --eval "(quit)" 2> /dev/null | sed -n '/^----$/,$p' | tail -n +2
17 }
18
19 scalaprog=$(runtestfn "test-scala-prog")
20
21 if [ -z $scalaprog ] ; then
22   echo "Scala prog empty, so use view diagnosis rather than this one"
23   exit 1
24 fi
25
26 scalafile=$(mktemp -u -p . --suffix .scala.dat)
27 clfile=$(mktemp -u -p . --suffix .cl.dat)
28
29 runtestfn "test-scala-input" | $scalaprog | sed -n '/^----$/,$p' | tail -n +2 > $scalafile
30 runtestfn "test-debug" >$clfile
31
32 vimdiff $scalafile $clfile
33
34 rm $scalafile
35 rm $clfile