]> git.sesse.net Git - stockfish/blobdiff - tests/signature.sh
New shell scripts for testing, used for travis CI (#957)
[stockfish] / tests / signature.sh
diff --git a/tests/signature.sh b/tests/signature.sh
new file mode 100755 (executable)
index 0000000..2eb52c8
--- /dev/null
@@ -0,0 +1,26 @@
+#!/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
+      echo "signature mismatch: reference $1 obtained $signature"
+   else
+      echo "signature OK: $signature"
+   fi
+else
+   # just report signature
+   echo $signature
+fi