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