Merge pull request #50 from lemonsqueeze/can_countercap
[pachi.git] / t-play / autotest / autotest-client
blobd31de86dd4bb850f25b01427b9462dafec711c1f
1 #!/bin/bash
2 # This is autotest Go-testing framework client. It runs on client
3 # machines and spawns autotest-worker, which picks a random pairing
4 # among the ones defined in the rc file, and plays a single game.
6 clientid="$1"; shift
7 if [ -z "$clientid" ]; then
8 echo "Usage: $0 <clientid>" >&2
9 echo "At any time, only single client with the same client may run!" >&2
10 echo "You can use e.g. clientid \`hostname\`-1, increment 1 for" >&2
11 echo "further threads started on the host." >&2
12 exit 1
14 . ./autotest-lib
16 mkdir -p "c/$clientid"
17 log "started client ($clientid)"
19 while true; do
20 mkdir -p "c/$clientid"
21 date +%s >"c/$clientid/beacon"
22 if ! ./autotest-worker "$clientid"; then
23 echo "*** WORKER FAILED ***"
24 log "worker failed with error code $?"
25 sleep 1
27 done