1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00
BadFish/tests/signature.sh
Joost VandeVondele 155d5417d9 Improve signature script
Catch case of missing bench, indicative of a crash or assert.

No functional change
2018-05-08 10:32:23 +02:00

31 lines
763 B
Bash
Executable file

#!/bin/bash
# obtain and optionally verify Bench / signature
# if no reference is given, the output is deliberately limited to just the signature
error()
{
echo "running bench for signature failed on line $1"
exit 1
}
trap 'error ${LINENO}' ERR
# obtain
signature=`./stockfish bench 2>&1 | grep "Nodes searched : " | awk '{print $4}'`
if [ $# -gt 0 ]; then
# compare to given reference
if [ "$1" != "$signature" ]; then
if [ "x$1" == "x" ]; then
echo "No signature obtained from bench. Code crashed or assert triggered ?"
else
echo "signature mismatch: reference $1 obtained: $signature ."
fi
exit 1
else
echo "signature OK: $signature"
fi
else
# just report signature
echo $signature
fi