commit 876933cb3173b0cc14848189b7dac41c7905560f Author: Nick Mathewson nickm@torproject.org Date: Tue May 2 19:24:56 2017 -0400
Give chutney a CHUTNEY_DEBUG option
test-network.sh gets a --debug flag, and they both get documented in the README. debug_flag is no longer recommended. --- README | 1 + lib/chutney/Traffic.py | 4 ++-- scripts/chutney_tests/verify.py | 4 +--- tools/test-network.sh | 5 ++++- 4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/README b/README index d184947..8030842 100644 --- a/README +++ b/README @@ -57,6 +57,7 @@ Warning Options: --only-warnings CHUTNEY_WARNINGS_ONLY=true
Expert Options: + --debug CHUTNEY_DEBUG=true --coverage USE_COVERAGE_BINARY=true --net-dir CHUTNEY_DATA_DIR --dry-run NETWORK_DRY_RUN=true diff --git a/lib/chutney/Traffic.py b/lib/chutney/Traffic.py index b5f75fd..a22d16b 100644 --- a/lib/chutney/Traffic.py +++ b/lib/chutney/Traffic.py @@ -28,11 +28,11 @@ import select import struct import errno import time +import os
# Set debug_flag=True in order to debug this program or to get hints # about what's going wrong in your system. -debug_flag = False - +debug_flag = os.environ.get("CHUTNEY_DEBUG", "") != ""
def debug(s): "Print a debug message on stdout if debug_flag is True." diff --git a/scripts/chutney_tests/verify.py b/scripts/chutney_tests/verify.py index b887ee7..98beb74 100644 --- a/scripts/chutney_tests/verify.py +++ b/scripts/chutney_tests/verify.py @@ -19,9 +19,7 @@ def run_test(network): time.sleep(5) print("Transmission: %s" % ("Success" if status else "Failure")) if not status: - # TODO: allow the debug flag to be passed as an argument to - # src/test/test-network.sh and chutney - print("Set 'debug_flag = True' in Traffic.py to diagnose.") + print("Set CHUTNEY_DEBUG to diagnose.") return status
diff --git a/tools/test-network.sh b/tools/test-network.sh index 9da20b1..7ea0fd4 100755 --- a/tools/test-network.sh +++ b/tools/test-network.sh @@ -35,7 +35,10 @@ do # the name or path of a tor-gencert binary export CHUTNEY_TOR_GENCERT="$2" shift - ;; + ;; + --debug) + export CHUTEY_DEBUG="yes" + ;; --flavor|--flavour|--network-flavor|--network-flavour) export NETWORK_FLAVOUR="$2" shift