-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest
executable file
·57 lines (48 loc) · 1.49 KB
/
test
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/zsh
. ~/.shells/functions
set -e
port=13057
params=()
while [[ $# -gt 0 ]]; do
case $1 in
-c) c=$2; client="-Pc=$2"; shift 2;;
-p) port=$2; shift 2;;
-g|-min) params+=($1 $2); shift 2;;
-*) echo "Unknown argument: \"$1\""; exit 1;;
*) break;;
esac
done
if [ -z $1 ]; then hash=$(git rev-parse --short HEAD)
else hash=$( ([[ ${#1} < 7 ]] && git rev-parse --short "HEAD~$1") || echo $1 )
fi
if [ -z $2 ]; then hashOld=$(git rev-parse --short "$hash^")
else hashOld=$( ([[ ${#2} < 7 ]] && git rev-parse --short "HEAD~$2") || echo $2 )
fi
new="$(git rev-list --count $hash)-$hash"
old="$(git rev-list --count $hashOld)-$hashOld"
depth=$(( $(git log --oneline $hashOld..HEAD | wc -l) + 1 ))
echo "Depth: $depth"
stamp=$(date +"%Y-%m-%d_%H-%M-%S")
dir="/tmp/softwarechallenge2018_$stamp"
cd /tmp
git clone file://$projects_dir/softwarechallenge2018 $dir --depth $depth
trap 'cp -r "$dir/testserver/logs" "$tests" && rm -rf $dir' INT TERM EXIT
if [ -d util ]
then git -C util fetch && echo "util: $(git -C util reset --hard origin/master)"
else git clone file://$projects_dir/util --depth 1
fi
println
cd $dir/client
rm -r src
git checkout $hash -- src
gradle jar --no-daemon --build-cache -Pj=$new -q $client
rm -r src
git checkout $hashOld -- src
gradle jar --no-daemon --build-cache -Pj=$old -q $client
cd ..
println
tests="$projects_dir/softwarechallenge2018/logs/tests$c"
mkdir -p $tests
log="$tests/$stamp-$new-$old.log"
echo "$1 vs $2" > $log
. ./duel $params -p $port $new $old | tee -ia $log