Ticket #27080: chutney-git-bisect.sh

File chutney-git-bisect.sh, 842 bytes (added by teor, 6 months ago)

git bisect run script for chutney

Line 
1#!/usr/bin/env bash
2
3# Compile tor and run chutney to find if the current tor source works
4# Runs chutney 3 times, because chutney is unreliable
5#
6# By default, runs make test-network-all in the current directory.
7#
8# Usage: git bisect run ./chutney-git-bisect.sh <chutney-flavour> <build-dir>
9
10CHUTNEY_TRIES=3
11
12CHUTNEY_COMMAND="make test-network-all"
13if [ ! -z "$1" ]; then
14    CHUTNEY_COMMAND="$CHUTNEY_PATH/tools/test-network.sh --flavour $1"
15fi
16
17if [ ! -z "$2" ]; then
18    cd "$2"
19fi
20
21make src/or/tor src/tools/tor-gencert || exit 125
22
23i=1
24echo
25echo "Round $i:"
26echo
27
28while ! $CHUTNEY_COMMAND && [ "$i" -le "$CHUTNEY_TRIES" ]; do
29    i=$[$i+1]
30    echo
31    echo "Round $i:"
32    echo
33done
34
35if [ "$i" -gt "$CHUTNEY_TRIES" ]; then
36    i=$[$i-1]
37    echo "Failed $i times"
38    exit 1
39else
40    echo "Succeeded after $i attempts"
41    exit 0
42fi