]> git.sesse.net Git - stockfish/blob - tests/signature.sh
2eb52c89be24c5a3e15e27c6faf996e5881b4d93
[stockfish] / tests / signature.sh
1 #!/bin/bash
2 # obtain and optionally verify Bench / signature
3 # if no reference is given, the output is deliberately limited to just the signature
4
5 error()
6 {
7   echo "running bench for signature failed on line $1"
8   exit 1
9 }
10 trap 'error ${LINENO}' ERR
11
12 # obtain
13
14 signature=`./stockfish bench 2>&1 | grep "Nodes searched  : " | awk '{print $4}'`
15
16 if [ $# -gt 0 ]; then
17    # compare to given reference
18    if [ "$1" != "$signature" ]; then
19       echo "signature mismatch: reference $1 obtained $signature"
20    else
21       echo "signature OK: $signature"
22    fi
23 else
24    # just report signature
25    echo $signature
26 fi