Browse Source

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.
Nick Mathewson 7 years ago
parent
commit
876933cb31
4 changed files with 8 additions and 6 deletions
  1. 1 0
      README
  2. 2 2
      lib/chutney/Traffic.py
  3. 1 3
      scripts/chutney_tests/verify.py
  4. 4 1
      tools/test-network.sh

+ 1 - 0
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

+ 2 - 2
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."

+ 1 - 3
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
 
 

+ 4 - 1
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