forked from miloszlagan/husarnet_bisect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bisect.sh
executable file
·42 lines (32 loc) · 845 Bytes
/
bisect.sh
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
#!/bin/bash
# bisect.sh
# This script is used to find offending commit in the Husarnet repository that introduced performance regression.
# Usage: bisect.sh <from_good_commit> <to_bad_commit>
GIT_REPOSITORY="https://github.com/husarnet/husarnet"
set -e
# Check if the number of arguments is correct
if [ "$#" -ne 4 ]; then
echo "Usage: bisect.sh <from_good_commit> <to_bad_commit> throughput <value>"
exit 1
fi
GOOD_COMMIT=$1
BAD_COMMIT=$2
METRIC=$3
VALUE=$4
# Clone the repository
if [ -d "repo" ]; then
git -C repo reset --hard
git -C repo fetch
git -C repo checkout master
git -C repo pull
else
git clone $GIT_REPOSITORY repo
fi
# Start bisecting
cd repo
git bisect reset
git bisect start
git bisect good $GOOD_COMMIT
git bisect bad $BAD_COMMIT
# Run the test
git bisect run ../run_test.sh $METRIC $VALUE