-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathduel
executable file
·40 lines (35 loc) · 1.2 KB
/
duel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")/testserver"
port=13055
mingames=40
games=100
prefix="./starters/docker-"
while [[ $# -gt 0 ]]; do
case $1 in
-p) port=$2; shift 2;;
-g) games="$2"; shift 2;;
-min) mingames="$2"; shift 2;;
-e) echo=1; shift 1;;
-nodocker) start="cd clients && ./start-client.sh"; prefix="./starters/start-"; shift 1;;
-v) loglevel="info"; shift 1;;
-vv) loglevel="debug"; shift 1;;
-vvv) loglevel="trace"; shift 1;;
-*) echo "Unknown argument: '$1'"; exit 1;;
*) break;;
esac
done
mkdir -p starters
echo "#!/bin/bash
cd ..
${start:-"./docker-client.sh"} Jumper-$1.jar \"\$@\"" > "$prefix$1"
echo "#!/bin/bash
cd ..
${start:-"./docker-client.sh"} Jumper-$2.jar \"\$@\"" > "$prefix$2"
chmod +x $prefix$1 $prefix$2
logs="../logs/duels"
mkdir -p $logs
( ((echo==1)) || [[ -t 1 ]] ) && echo -e "\e[1mPlaying $mingames-$games games of $1 vs $2 on port $port\e[m"
java -jar -Dlogback.configurationFile=logback-tests.xml test_client.jar \
--name1 "$1" --player1 "$prefix$1" --name2 "$2" --player2 "$prefix$2" \
--min-tests $mingames --significance 0.06 --loglevel ${loglevel:-warn} \
--tests $games --start-server --port $port "${@:3}" | tee -ia "$logs/$1 vs $2"