2 # verify reproducible search
6 echo "reprosearch testing failed on line $1"
9 trap 'error ${LINENO}' ERR
11 echo "reprosearch testing started"
13 # repeat two short games, separated by ucinewgame.
14 # with go nodes $nodes they should result in exactly
15 # the same node count for each iteration.
16 cat << EOF > repeat.exp
25 send "position startpos\n"
26 send "go nodes \$nodes\n"
29 send "position startpos moves e2e4 e7e6\n"
30 send "go nodes \$nodes\n"
34 send "position startpos\n"
35 send "go nodes \$nodes\n"
38 send "position startpos moves e2e4 e7e6\n"
39 send "go nodes \$nodes\n"
46 # to increase the likelyhood of finding a non-reproducible case,
47 # the allowed number of nodes are varied systematically
51 nodes=$((100*3**i/2**i))
52 echo "reprosearch testing with $nodes nodes"
54 # each line should appear exactly an even number of times
55 expect repeat.exp $nodes 2>&1 | grep -o "nodes [0-9]*" | sort | uniq -c | awk '{if ($1%2!=0) exit(1)}'
61 echo "reprosearch testing OK"