From bc6da6f569b5fcaa44b8b2db9dfe6cb29acfe932 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Fri, 24 Apr 2020 00:48:10 +0200 Subject: [PATCH] Add protocol tests --- .travis.yml | 1 + tests/protocol.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 0 deletions(-) create mode 100755 tests/protocol.sh diff --git a/.travis.yml b/.travis.yml index 88943ec..4957eac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,6 +61,7 @@ script: # # Check perft and reproducible search + - ../tests/protocol.sh - ../tests/perft.sh - ../tests/reprosearch.sh # diff --git a/tests/protocol.sh b/tests/protocol.sh new file mode 100755 index 0000000..8b54a1c --- /dev/null +++ b/tests/protocol.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# verify protocol implementations + +error() +{ + echo "protocol testing failed on line $1" + exit 1 +} +trap 'error ${LINENO}' ERR + +echo "protocol testing started" + +cat << EOF > uci.exp + set timeout 5 + spawn ./stockfish + send "uci\\n" + expect "default chess" + expect "uciok" + send "usi\\n" + expect "default shogi" + expect "usiok" + send "ucci\\n" + expect "option UCI_Variant" + expect "default xiangqi" + expect "ucciok" + send "quit\\n" + expect eof +EOF + +cat << EOF > xboard.exp + set timeout 5 + spawn ./stockfish + send "xboard\\n" + send "protover 2\\n" + expect "feature done=1" + send "ping\\n" + expect "pong" + send "ping\\n" + expect "pong" + send "quit\\n" + expect eof +EOF + +for exp in uci.exp xboard.exp +do + expect $exp > /dev/null + rm $exp +done + +echo "protocol testing OK" -- 1.7.0.4