[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [chutney/master] Add a warning-only mode to test-network.sh



commit f741edfdbce2eb76e67c128fd12ef19d3bde402b
Author: teor <teor2345@xxxxxxxxx>
Date:   Tue Feb 28 01:42:50 2017 +1100

    Add a warning-only mode to test-network.sh
    
    And provide a canonical path to the nodes directory in warnings.sh.
    
    This is part of tor feature 21570.
    
    Closes 21572.
---
 README                |  1 +
 tools/test-network.sh | 20 ++++++++++++++------
 tools/warnings.sh     |  5 +++--
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/README b/README
index 346a032..d184947 100644
--- a/README
+++ b/README
@@ -54,6 +54,7 @@ Warning Options:
   --all-warnings     CHUTNEY_WARNINGS_IGNORE_EXPECTED=false
                      CHUTNEY_WARNINGS_SUMMARY=false
   --no-warnings      CHUTNEY_WARNINGS_SKIP=true
+  --only-warnings    CHUTNEY_WARNINGS_ONLY=true
 
 Expert Options:
   --coverage         USE_COVERAGE_BINARY=true
diff --git a/tools/test-network.sh b/tools/test-network.sh
index 3ed709e..2f54ed0 100755
--- a/tools/test-network.sh
+++ b/tools/test-network.sh
@@ -98,6 +98,10 @@ do
       export CHUTNEY_WARNINGS_IGNORE_EXPECTED=false
       export CHUTNEY_WARNINGS_SUMMARY=false
       ;;
+    # this doesn't run chutney, and only logs warnings
+    --only-warnings)
+      export CHUTNEY_WARNINGS_ONLY=true
+      ;;
     # this skips warnings entirely
     --no-warnings)
       export CHUTNEY_WARNINGS_SKIP=true
@@ -231,8 +235,17 @@ fi
 export NETWORK_FLAVOUR=${NETWORK_FLAVOUR:-"bridges+hs"}
 export CHUTNEY_NETWORK="$CHUTNEY_PATH/networks/$NETWORK_FLAVOUR"
 
+if [ "$CHUTNEY_WARNINGS_SKIP" = true ]; then
+  WARNINGS=true
+else
+  WARNINGS="$CHUTNEY_PATH/tools/warnings.sh"
+fi
+
 # And finish up if we're doing a dry run
-if [ "$NETWORK_DRY_RUN" = true ]; then
+if [ "$NETWORK_DRY_RUN" = true -o "$CHUTNEY_WARNINGS_ONLY" = true ]; then
+    if [ "$CHUTNEY_WARNINGS_ONLY" = true ]; then
+        "$WARNINGS"
+    fi
     # we can't exit here, it breaks argument processing
     # this only works in bash: return semantics are shell-specific
     return 2>/dev/null || exit
@@ -249,11 +262,6 @@ export CHUTNEY_BOOTSTRAP_TIME=${CHUTNEY_BOOTSTRAP_TIME:-60}
 export CHUTNEY_STOP_TIME=${CHUTNEY_STOP_TIME:-0}
 
 CHUTNEY="$CHUTNEY_PATH/chutney"
-if [ "$CHUTNEY_WARNINGS_SKIP" = true ]; then
-  WARNINGS=true
-else
-  WARNINGS="$CHUTNEY_PATH/tools/warnings.sh"
-fi
 
 if [ "$CHUTNEY_START_TIME" -ge 0 ]; then
   $ECHO "Waiting ${CHUTNEY_START_TIME} seconds for a consensus containing relays to be generated..."
diff --git a/tools/warnings.sh b/tools/warnings.sh
index 5808c79..09bf8ea 100755
--- a/tools/warnings.sh
+++ b/tools/warnings.sh
@@ -53,13 +53,14 @@ function show_warnings() {
     fi
     # Give context to the warnings we're about to display
     if [ "$CHUTNEY_WARNINGS_SUMMARY" = true ]; then
-        $ECHO "${GREEN}All `basename $1`:${NC}"
+        $ECHO "${GREEN}Summary `basename $1`:${NC}"
     else
         $ECHO "${GREEN}Node `basename $1`:${NC}"
     fi
     if [ "$CHUTNEY_WARNINGS_IGNORE_EXPECTED" = true -a \
         -e "$IGNORE_FILE" ]; then
-        $ECHO " ${GREEN}(Ignoring expected warnings, run chutney/tools/warnings.sh to see all warnings)${NC}"
+        PERMANENT_DIR=`readlink -n "$1"`
+        $ECHO "${GREEN}(Detail: chutney/tools/warnings.sh $PERMANENT_DIR)${NC}"
     fi
     # Display the warnings, after filtering and counting occurrences
     # must be kept in sync with the filter commands above



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits