mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00

Perform more complex verification and validation. - signature.sh : extract and optionally compare Bench/Signature/Node count. - perft.sh : verify perft counts for a number of positions. - instrumented.sh : run a few commands or uci sequences through valgrind/sanitizer instrumented binaries. - reprosearch.sh : verify reproducibility of search. These script can be used from directly from the command line in the src directory. Update travis script to use these shell scripts. No functional change.
61 lines
1.2 KiB
Bash
Executable file
61 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
# verify reproducible search
|
|
|
|
error()
|
|
{
|
|
echo "reprosearch testing failed on line $1"
|
|
exit 1
|
|
}
|
|
trap 'error ${LINENO}' ERR
|
|
|
|
echo "reprosearch testing started"
|
|
|
|
# repeat two short games, separated by ucinewgame.
|
|
# with go nodes $nodes they should result in exactly
|
|
# the same node count for each iteration.
|
|
cat << EOF > repeat.exp
|
|
set timeout 10
|
|
spawn ./stockfish
|
|
lassign \$argv nodes
|
|
|
|
send "uci\n"
|
|
expect "uciok"
|
|
|
|
send "ucinewgame\n"
|
|
send "position startpos\n"
|
|
send "go nodes \$nodes\n"
|
|
expect "bestmove"
|
|
|
|
send "position startpos moves e2e4 e7e6\n"
|
|
send "go nodes \$nodes\n"
|
|
expect "bestmove"
|
|
|
|
send "ucinewgame\n"
|
|
send "position startpos\n"
|
|
send "go nodes \$nodes\n"
|
|
expect "bestmove"
|
|
|
|
send "position startpos moves e2e4 e7e6\n"
|
|
send "go nodes \$nodes\n"
|
|
expect "bestmove"
|
|
|
|
send "quit\n"
|
|
expect eof
|
|
EOF
|
|
|
|
# to increase the likelyhood of finding a non-reproducible case,
|
|
# the allowed number of nodes are varied systematically
|
|
for i in `seq 1 20`
|
|
do
|
|
|
|
nodes=$((100*3**i/2**i))
|
|
echo "reprosearch testing with $nodes nodes"
|
|
|
|
# each line should appear exactly an even number of times
|
|
expect repeat.exp $nodes 2>&1 | grep -o "nodes [0-9]*" | sort | uniq -c | awk '{if ($1%2!=0) exit(1)}'
|
|
|
|
done
|
|
|
|
rm repeat.exp
|
|
|
|
echo "reprosearch testing OK"
|