Browse Source

Make chutney tools work with relative paths

This bug was introduced when we added the test scripts in #9087.

Closes #21467.
teor 7 years ago
parent
commit
16e32cc0d7
4 changed files with 16 additions and 3 deletions
  1. 6 1
      tools/bootstrap-network.sh
  2. 4 1
      tools/hsaddress.sh
  3. 2 0
      tools/test-network.sh
  4. 4 1
      tools/warnings.sh

+ 6 - 1
tools/bootstrap-network.sh

@@ -8,7 +8,6 @@
 #       and creating a new net/nodes
 #
 # Usage:
-#    cd YOUR-CHUTNEY-DIRECTORY
 #    tools/bootstrap-network.sh [network-flavour]
 #    network-flavour: one of the files in the networks directory,
 #                     (default: 'basic')
@@ -18,6 +17,12 @@ VOTING_OFFSET=6
 CHUTNEY=./chutney
 myname=$(basename "$0")
 
+if [ ! -z "$CHUTNEY_PATH" ]; then
+    cd "$CHUTNEY_PATH"
+    # tell chutney to use the current directory
+    export CHUTNEY_PATH=.
+fi
+
 [ -x $CHUTNEY ] || { echo "$myname: missing $CHUTNEY"; exit 1; }
 [ -d networks ] || { echo "$myname: missing directory: networks"; exit 1; }
 flavour=basic; [ -n "$1" ] && { flavour=$1; shift; }

+ 4 - 1
tools/hsaddress.sh

@@ -1,13 +1,16 @@
 #!/bin/bash
 #
 # Usage:
-#    cd YOUR-CHUTNEY-DIRECTORY
 #    tools/hsaddress.sh [hs_node]
 # Output: for each HS outputs its onion address. If the argument node is
 #    specified, it only shows the onion address of that node.
 # Examples: tools/hsaddress.sh
 #           tools/hsaddress.sh 025h
 
+if [ ! -z "$CHUTNEY_PATH" ]; then
+    cd "$CHUTNEY_PATH"
+fi
+
 NAME=$(basename "$0")
 DEST=net/nodes
 TARGET=hidden_service/hostname

+ 2 - 0
tools/test-network.sh

@@ -188,6 +188,8 @@ if [ "$NETWORK_DRY_RUN" = true ]; then
 fi
 
 cd "$CHUTNEY_PATH"
+# tell chutney to use the current directory
+export CHUTNEY_PATH=.
 ./tools/bootstrap-network.sh "$NETWORK_FLAVOUR" || exit 2
 
 # chutney starts verifying after 20 seconds, keeps on trying for 60 seconds,

+ 4 - 1
tools/warnings.sh

@@ -1,7 +1,6 @@
 #!/bin/bash
 #
 # Usage:
-#    cd YOUR-CHUTNEY-DIRECTORY
 #    tools/warnings.sh [node]
 # Output: for each node outputs its warnings and the number of times that
 # warning has ocurred. If the argument node is specified, it only shows
@@ -9,6 +8,10 @@
 # Examples: tools/warnings.sh
 #           tools/warnings.sh 000a
 
+if [ ! -z "$CHUTNEY_PATH" ]; then
+    cd "$CHUTNEY_PATH"
+fi
+
 function show_warnings() {
     echo "${GREEN}Node `basename $1`:${NC}"
     sed -n 's/^.*\[warn\]//p' $1/info.log | sort | uniq -c | \