Skip to content

Commit

Permalink
fix1
Browse files Browse the repository at this point in the history
  • Loading branch information
amchess committed Dec 13, 2024
1 parent 6556c83 commit 0a22ea9
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 119 deletions.
33 changes: 33 additions & 0 deletions Tests/200Suite1.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[DescrPGN]
Usage=2
Access=1036181
[Environ]
LastUser=
TournTitle=
TournPlace=
LastPlayer=A
LastTourn=A
LastTrnYear=2021
TournDate=0
GameDate=0
RecentDate=0
GameRound=0
Sources=2
Annotators=2
LastListTop=0
LastSelected=0
QLstSelected=0
Usage=1
PreviousDBType=0
CommentedGames=0
StressTrainActive=1
StressTestLevel=1
StressPercentNextLevel=0
StressReached=0
StressMax=0
TrainingWithClock=1
RandomTraining=1
[ChessBase 17]
Scaled=2
NLayouts=1
GameListLayout0=40;QuickList;1;0;55;1;1;185;1;2;50;1;3;185;1;4;50;1;5;55;1;6;48;1;7;44;1;8;231;1;10;39;1;12;72;0;-1;120;0;-1;120;1;9;77;0;-1;120;1;11;55;1;13;55;0;-1;120;1;14;66;0;-1;120;1;15;44;0;-1;120;0;-1;120;0;-1;120;0;-1;120;0;-1;120;0;-1;120;0;-1;120;0;-1;120;0;-1;120;0;-1;120;0;-1;120;1;16;37;0;-1;120;0;-1;120;0;-1;120;0;-1;120;0;-1;120;0;-1;120;0;-1;120;
33 changes: 33 additions & 0 deletions Tests/200Suite4.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[DescrPGN]
Usage=1
Access=1036181
[Environ]
LastUser=
TournTitle=
TournPlace=
LastPlayer=A
LastTourn=A
LastTrnYear=2021
TournDate=0
GameDate=0
RecentDate=0
GameRound=0
Sources=2
Annotators=2
LastListTop=0
LastSelected=0
QLstSelected=0
Usage=1
PreviousDBType=0
CommentedGames=0
StressTrainActive=1
StressTestLevel=1
StressPercentNextLevel=0
StressReached=0
StressMax=0
TrainingWithClock=1
RandomTraining=1
[ChessBase 17]
Scaled=2
NLayouts=1
GameListLayout0=40;QuickList;1;0;55;1;1;185;1;2;50;1;3;185;1;4;50;1;5;55;1;6;48;1;7;44;1;8;226;1;10;39;1;12;72;0;-1;110;0;-1;110;1;9;77;0;-1;110;1;11;55;1;13;55;0;-1;110;1;14;66;0;-1;110;1;15;44;0;-1;110;0;-1;110;0;-1;110;0;-1;110;0;-1;110;0;-1;110;0;-1;110;0;-1;110;0;-1;110;0;-1;110;0;-1;110;1;16;37;0;-1;110;0;-1;110;0;-1;110;0;-1;110;0;-1;110;0;-1;110;0;-1;110;
2 changes: 1 addition & 1 deletion Tests/perft.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ echo "perft testing started"
cat << EOF > perft.exp
set timeout 10
lassign \$argv pos depth result
spawn ./stockfish
spawn ./brainlearn
send "position \$pos\\ngo perft \$depth\\n"
expect "Nodes searched? \$result" {} timeout {exit 1}
send "quit\\n"
Expand Down
2 changes: 1 addition & 1 deletion Tests/reprosearch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo "reprosearch testing started"
# the same node count for each iteration.
cat << EOF > repeat.exp
set timeout 10
spawn ./stockfish
spawn ./brainlearn
lassign \$argv nodes
send "uci\n"
Expand Down
2 changes: 1 addition & 1 deletion Tests/signature.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trap 'error ${LINENO}' ERR

# obtain

signature=`eval "$WINE_PATH ./stockfish bench 2>&1" | grep "Nodes searched : " | awk '{print $4}'`
signature=`eval "$WINE_PATH ./brainlearn bench 2>&1" | grep "Nodes searched : " | awk '{print $4}'`

if [ $# -gt 0 ]; then
# compare to given reference
Expand Down
130 changes: 14 additions & 116 deletions tests/instrumented.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ case $1 in
echo "valgrind testing started"
prefix=''
exeprefix='valgrind --error-exitcode=42 --errors-for-leak-kinds=all --leak-check=full'
postfix=''
postfix='1>/dev/null'
threads="1"
;;
--valgrind-thread)
echo "valgrind-thread testing started"
prefix=''
exeprefix='valgrind --fair-sched=try --error-exitcode=42'
postfix=''
postfix='1>/dev/null'
threads="2"
;;
--sanitizer-undefined)
Expand All @@ -39,8 +39,13 @@ case $1 in
threads="2"

cat << EOF > tsan.supp
race:Brainlearn::TTEntry::read
race:Brainlearn::TTEntry::move
race:Brainlearn::TTEntry::depth
race:Brainlearn::TTEntry::bound
race:Brainlearn::TTEntry::save
race:Brainlearn::TTEntry::value
race:Brainlearn::TTEntry::eval
race:Brainlearn::TTEntry::is_pv
race:Brainlearn::TranspositionTable::probe
race:Brainlearn::TranspositionTable::hashfull
Expand Down Expand Up @@ -100,12 +105,7 @@ diff $network verify.nnue
# more general testing, following an uci protocol exchange
cat << EOF > game.exp
set timeout 240
# to correctly catch eof we need the following line
# expect_before timeout { exit 2 } eof { exit 3 }
expect_before timeout { exit 2 }
spawn $exeprefix ./brainlearn
expect "Brainlearn"
send "uci\n"
expect "uciok"
Expand All @@ -118,106 +118,27 @@ cat << EOF > game.exp
send "go nodes 1000\n"
expect "bestmove"
send "ucinewgame\n"
send "position startpos moves e2e4 e7e6\n"
send "go nodes 1000\n"
expect "bestmove"
send "ucinewgame\n"
send "position fen 5rk1/1K4p1/8/8/3B4/8/8/8 b - - 0 1\n"
send "go depth 10\n"
expect "bestmove"
send "ucinewgame\n"
send "position fen 5rk1/1K4p1/8/8/3B4/8/8/8 b - - 0 1\n"
send "flip\n"
send "go depth 10\n"
expect "bestmove"
send "ucinewgame\n"
send "setoption name UCI_ShowWDL value true\n"
send "position startpos\n"
send "flip\n"
send "go depth 5\n"
expect -re {info depth \d+ seldepth \d+ multipv \d+ score cp \d+ nodes \d+ nps \d+ hashfull \d+ tbhits \d+ time \d+ pv}
expect "bestmove"
send "ucinewgame\n"
send "setoption name UCI_ShowWDL value true\n"
send "setoption name Skill Level value 10\n"
send "position startpos\n"
send "go depth 9\n"
expect -re {info depth 1 seldepth \d+ multipv \d+ score cp \d+ wdl \d+ \d+ \d+ nodes \d+ nps \d+ hashfull \d+ tbhits \d+ time \d+ pv}
expect -re {info depth 2 seldepth \d+ multipv \d+ score cp \d+ wdl \d+ \d+ \d+ nodes \d+ nps \d+ hashfull \d+ tbhits \d+ time \d+ pv}
expect -re {info depth 3 seldepth \d+ multipv \d+ score cp \d+ wdl \d+ \d+ \d+ nodes \d+ nps \d+ hashfull \d+ tbhits \d+ time \d+ pv}
expect -re {info depth 4 seldepth \d+ multipv \d+ score cp \d+ wdl \d+ \d+ \d+ nodes \d+ nps \d+ hashfull \d+ tbhits \d+ time \d+ pv}
expect -re {info depth 5 seldepth \d+ multipv \d+ score cp \d+ wdl \d+ \d+ \d+ nodes \d+ nps \d+ hashfull \d+ tbhits \d+ time \d+ pv}
expect -re {info depth 6 seldepth \d+ multipv \d+ score cp \d+ wdl \d+ \d+ \d+ nodes \d+ nps \d+ hashfull \d+ tbhits \d+ time \d+ pv}
expect -re {info depth 7 seldepth \d+ multipv \d+ score cp \d+ wdl \d+ \d+ \d+ nodes \d+ nps \d+ hashfull \d+ tbhits \d+ time \d+ pv}
expect -re {info depth 8 seldepth \d+ multipv \d+ score cp \d+ wdl \d+ \d+ \d+ nodes \d+ nps \d+ hashfull \d+ tbhits \d+ time \d+ pv}
expect -re {info depth 9 seldepth \d+ multipv \d+ score cp \d+ wdl \d+ \d+ \d+ nodes \d+ nps \d+ hashfull \d+ tbhits \d+ time \d+ pv}
send "go depth 5\n"
expect "bestmove"
send "setoption name Clear Hash\n"
send "ucinewgame\n"
send "position fen 5K2/8/2qk4/2nPp3/3r4/6B1/B7/3R4 w - e6\n"
send "go depth 18\n"
expect "score mate 1"
expect "pv d5e6"
expect "bestmove d5e6"
send "ucinewgame\n"
send "position fen 2brrb2/8/p7/Q7/1p1kpPp1/1P1pN1K1/3P4/8 b - -\n"
send "go depth 18\n"
expect "score mate -1"
expect "bestmove"
send "ucinewgame\n"
send "position fen 7K/P1p1p1p1/2P1P1Pk/6pP/3p2P1/1P6/3P4/8 w - - 0 1\n"
send "go nodes 500000\n"
expect "bestmove"
send "ucinewgame\n"
send "position fen 8/5R2/2K1P3/4k3/8/b1PPpp1B/5p2/8 w - -\n"
send "go depth 18 searchmoves c6d7\n"
expect "score mate 2 * pv c6d7 * f7f5"
expect "bestmove c6d7"
send "ucinewgame\n"
send "position fen 8/5R2/2K1P3/4k3/8/b1PPpp1B/5p2/8 w - -\n"
send "go mate 2 searchmoves c6d7\n"
expect "score mate 2 * pv c6d7"
expect "bestmove c6d7"
send "ucinewgame\n"
send "position fen 8/5R2/2K1P3/4k3/8/b1PPpp1B/5p2/8 w - -\n"
send "go nodes 500000 searchmoves c6d7\n"
expect "score mate 2 * pv c6d7 * f7f5"
expect "bestmove c6d7"
send "ucinewgame\n"
send "position fen 1NR2B2/5p2/5p2/1p1kpp2/1P2rp2/2P1pB2/2P1P1K1/8 b - - \n"
send "go depth 27\n"
expect "score mate -2"
expect "pv d5e6 c8d8"
expect "bestmove d5e6"
send "ucinewgame\n"
send "position fen 8/5R2/2K1P3/4k3/8/b1PPpp1B/5p2/8 w - - moves c6d7 f2f1q\n"
send "go depth 18\n"
expect "score mate 1 * pv f7f5"
expect "bestmove f7f5"
send "ucinewgame\n"
send "position fen 8/5R2/2K1P3/4k3/8/b1PPpp1B/5p2/8 w - -\n"
send "go depth 18 searchmoves c6d7\n"
expect "score mate 2 * pv c6d7 * f7f5"
expect "bestmove c6d7"
send "ucinewgame\n"
send "position fen 8/5R2/2K1P3/4k3/8/b1PPpp1B/5p2/8 w - - moves c6d7\n"
send "go depth 18 searchmoves e3e2\n"
expect "score mate -1 * pv e3e2 f7f5"
expect "bestmove e3e2"
send "setoption name EvalFile value verify.nnue\n"
send "position startpos\n"
send "go depth 5\n"
Expand All @@ -226,13 +147,6 @@ cat << EOF > game.exp
send "setoption name MultiPV value 4\n"
send "position startpos\n"
send "go depth 5\n"
expect "bestmove"
send "setoption name Skill Level value 10\n"
send "position startpos\n"
send "go depth 5\n"
expect "bestmove"
send "setoption name Skill Level value 20\n"
send "quit\n"
expect eof
Expand All @@ -250,30 +164,17 @@ fi

cat << EOF > syzygy.exp
set timeout 240
# to correctly catch eof we need the following line
# expect_before timeout { exit 2 } eof { exit 3 }
expect_before timeout { exit 2 }
spawn $exeprefix ./stockfish
expect "Brainlearn"
spawn $exeprefix ./brainlearn
send "uci\n"
send "setoption name SyzygyPath value ../tests/syzygy/\n"
expect "info string Found 35 WDL and 35 DTZ tablebase files (up to 4-man)."
expect "info string Found 35 tablebases" {} timeout {exit 1}
send "bench 128 1 8 default depth\n"
expect "Nodes searched :"
send "ucinewgame\n"
send "position fen 4k3/PP6/8/8/8/8/8/4K3 w - - 0 1\n"
send "go depth 5\n"
expect -re {score cp 20000|score mate}
expect "bestmove"
send "ucinewgame\n"
send "position fen 8/1P6/2B5/8/4K3/8/6k1/8 w - - 0 1\n"
send "go depth 5\n"
expect -re {score cp 20000|score mate}
expect "bestmove"
send "ucinewgame\n"
send "position fen 8/1P6/2B5/8/4K3/8/6k1/8 b - - 0 1\n"
send "go depth 5\n"
expect -re {score cp -20000|score mate}
expect "bestmove"
send "quit\n"
expect eof
Expand All @@ -286,9 +187,6 @@ EOF
for exp in game.exp syzygy.exp
do

echo "======== $exp =============="
cat $exp
echo "============================"
echo "$prefix expect $exp $postfix"
eval "$prefix expect $exp $postfix"

Expand Down

0 comments on commit 0a22ea9

Please sign in to comment.