3 # This script calls the equivalent script in chutney/tools
5 # If we already know CHUTNEY_PATH, don't bother with argument parsing
6 TEST_NETWORK
="$CHUTNEY_PATH/tools/test-network.sh"
7 # Call the chutney version of this script, if it exists, and we can find it
8 if [ -d "$CHUTNEY_PATH" -a -x "$TEST_NETWORK" ]; then
9 # we can't produce any output, because we might be --quiet
10 # this preserves arguments with spaces correctly
11 exec "$TEST_NETWORK" "$@"
14 # We need to go looking for CHUTNEY_PATH
16 # Do we output anything at all?
18 # Output is prefixed with the name of the script
21 # Save the arguments before we destroy them
22 # This might not preserve arguments with spaces in them
25 # We need to find CHUTNEY_PATH, so that we can call the version of this script
26 # in chutney/tools with the same arguments. We also need to respect --quiet.
42 # maybe chutney's test-network.sh can handle it
48 # optional: $TOR_DIR is the tor build directory
49 # it's used to find the location of tor binaries
51 # - set it to $BUILDDIR, or
52 # - if $PWD looks like a tor build directory, set it to $PWD, or
53 # - unset $TOR_DIR, and let chutney fall back to finding tor binaries in $PATH
54 if [ ! -d "$TOR_DIR" ]; then
55 if [ -d "$BUILDDIR/src/core/or" -a -d "$BUILDDIR/src/tools" ]; then
56 # Choose the build directory
57 # But only if it looks like one
58 $ECHO "$myname: \$TOR_DIR not set, trying \$BUILDDIR"
60 elif [ -d "$PWD/src/core/or" -a -d "$PWD/src/tools" ]; then
61 # Guess the tor directory is the current directory
62 # But only if it looks like one
63 $ECHO "$myname: \$TOR_DIR not set, trying \$PWD"
66 $ECHO "$myname: no \$TOR_DIR, chutney will use \$PATH for tor binaries"
71 # mandatory: $CHUTNEY_PATH is the path to the chutney launch script
73 # - if $PWD looks like a chutney directory, set it to $PWD, or
74 # - set it based on $TOR_DIR, expecting chutney to be next to tor, or
75 # - fail and tell the user how to clone the chutney repository
76 if [ ! -d "$CHUTNEY_PATH" -o ! -x "$CHUTNEY_PATH/chutney" ]; then
77 if [ -x "$PWD/chutney" ]; then
78 $ECHO "$myname: \$CHUTNEY_PATH not valid, trying \$PWD"
80 elif [ -d "$TOR_DIR" -a -d "$TOR_DIR/../chutney" -a \
81 -x "$TOR_DIR/../chutney/chutney" ]; then
82 $ECHO "$myname: \$CHUTNEY_PATH not valid, trying \$TOR_DIR/../chutney"
83 CHUTNEY_PATH
="$TOR_DIR/../chutney"
85 $ECHO "$myname: missing 'chutney' in \$CHUTNEY_PATH ($CHUTNEY_PATH)"
86 $ECHO "$myname: Get chutney: git clone https://git.torproject.org/\
88 $ECHO "$myname: Set \$CHUTNEY_PATH to a non-standard location: export \
89 CHUTNEY_PATH=\`pwd\`/chutney"
95 TEST_NETWORK
="$CHUTNEY_PATH/tools/test-network.sh"
96 # Call the chutney version of this script, if it exists, and we can find it
97 if [ -d "$CHUTNEY_PATH" -a -x "$TEST_NETWORK" ]; then
98 $ECHO "$myname: Calling newer chutney script $TEST_NETWORK"
99 # this may fail if some arguments have spaces in them
100 # if so, set CHUTNEY_PATH before calling test-network.sh, and spaces
101 # will be handled correctly
102 exec "$TEST_NETWORK" $ORIGINAL_ARGS
104 $ECHO "$myname: Could not find tools/test-network.sh in CHUTNEY_PATH."
105 $ECHO "$myname: Please update your chutney using 'git pull'."
106 # We have failed to do what the user asked