[tor-commits] [chutney/master] Make chutney tools work with relative paths

teor at torproject.org teor at torproject.org
Wed Feb 15 06:21:06 UTC 2017


commit 16e32cc0d71bd18da287940eaee528aa3e98c001
Author: teor <teor2345 at gmail.com>
Date:   Wed Feb 15 17:18:55 2017 +1100

    Make chutney tools work with relative paths
    
    This bug was introduced when we added the test scripts in #9087.
    
    Closes #21467.
---
 tools/bootstrap-network.sh | 7 ++++++-
 tools/hsaddress.sh         | 5 ++++-
 tools/test-network.sh      | 2 ++
 tools/warnings.sh          | 5 ++++-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/bootstrap-network.sh b/tools/bootstrap-network.sh
index a2d5fa8..ea9d825 100755
--- a/tools/bootstrap-network.sh
+++ b/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; }
diff --git a/tools/hsaddress.sh b/tools/hsaddress.sh
index b89fc6d..8dedc2e 100755
--- a/tools/hsaddress.sh
+++ b/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
diff --git a/tools/test-network.sh b/tools/test-network.sh
index beefdc3..7289126 100755
--- a/tools/test-network.sh
+++ b/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,
diff --git a/tools/warnings.sh b/tools/warnings.sh
index 41c9a86..29ed3e2 100755
--- a/tools/warnings.sh
+++ b/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 | \



More information about the tor-commits mailing list