Interface - add resize capabilities
[clnl] / bin / diagnose-view-test
1 #!/bin/bash
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 \
13     --noinform --disable-ldb --lose-on-corruption --end-runtime-options \
14     --eval "(asdf:initialize-source-registry \`(:source-registry (:tree ,(car (directory \"src\"))) :INHERIT-CONFIGURATION))" \
15     --eval "(asdf:load-system :clnl-test)" \
16     --eval "(clnl-test::$1 \"$TEST\")" \
17     --eval "(quit)" 2> /dev/null | sed -n '/^----$/,$p' | tail -n +2
18 }
19
20 scalaprog=bin/viewruncmd.scala
21
22 scalafile=$(mktemp -u -p . --suffix .scala.png)
23 clfile=$(mktemp -u -p . --suffix .cl.ppm)
24
25 runtestfn "test-scala-input" | $scalaprog | sed -n '/^----$/,$p' | tail -n +2
26 mv scala.png $scalafile
27 checksum=$(runtestfn "test-debug")
28 mv cl.ppm $clfile
29
30 echo
31 echo "If the images are equal, use $checksum for CL checksum (note that you may get a different checksum on travis, see as of yet unwritten documentation for details)"
32 echo "The compare result is (Less than 1500 is probably equivalent):"
33 compare -metric RMSE $clfile $scalafile NULL:
34 echo
35 echo
36 echo "Here are the results of identify (make sure they are the same size):"
37 identify $clfile
38 identify $scalafile
39 echo "Make sure that turtles are on top of each other correctly and all correct colors."
40 echo -n "Hit enter to view them ..."
41 read
42
43 display $scalafile &
44 scalafiledisplaypid=$!
45 display $clfile &
46 clfiledisplaypid=$!
47
48 echo -n "... and hit enter to close scala image"
49 read
50
51 kill $scalafiledisplaypid
52
53 echo -n "... and hit enter to finish"
54 read
55 kill $clfiledisplaypid
56
57 rm $scalafile
58 rm $clfile