"Fossies" - the Fresh Open Source Software Archive

Member "stockfish-11-linux/tests/signature.sh" (18 Jan 2020, 766 Bytes) of package /linux/privat/stockfish-11-linux.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "signature.sh": 9-linux_vs_10-linux.

    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       if [ -z "$signature" ]; then
   20          echo "No signature obtained from bench. Code crashed or assert triggered ?"
   21       else
   22          echo "signature mismatch: reference $1 obtained: $signature ."
   23       fi
   24       exit 1
   25    else
   26       echo "signature OK: $signature"
   27    fi
   28 else
   29    # just report signature
   30    echo $signature
   31 fi