Browse Source

Add an option for test-network.sh to run multiple verify rounds

This option can be used via --rounds or CHUTNEY_ROUNDS.
The default is 1.

Also clarify that connections are opened simultaneously.

Implements #22225.
teor 7 years ago
parent
commit
f020fb9f0d
2 changed files with 27 additions and 5 deletions
  1. 6 1
      README
  2. 21 4
      tools/test-network.sh

+ 6 - 1
README

@@ -43,7 +43,9 @@ Timing Options:
 
 Traffic Options:
   --data             CHUTNEY_DATA_BYTES=N
+  # connections are simultaneous, rounds are sequential
   --connections      CHUTNEY_CONNECTIONS=N
+  --rounds           CHUTNEY_ROUNDS=N
   --hs-multi-client  CHUTNEY_HS_MULTI_CLIENT=N
 
 Address Options:
@@ -91,10 +93,13 @@ Connection Tests:
   ./chutney configure networks/basic-025
   ./chutney start networks/basic-025
   ./chutney status networks/basic-025
+  # Make 5 simultaneous connections from each client through a random exit
   CHUTNEY_CONNECTIONS=5 ./chutney verify networks/basic-025
-  # Make 5 connections from each client through a random exit
   ./chutney stop networks/basic-025
 
+  # Run 5 sequential verification rounds
+  CHUTNEY_ROUNDS=5 ./tools/test-network.sh --flavour basic
+
 Note: If you create 7 or more connections to a hidden service from a single
 Tor 0.2.7 client, you'll likely get a verification failure due to #15937.
 This is fixed in 0.2.8.

+ 21 - 4
tools/test-network.sh

@@ -5,6 +5,9 @@ export ECHO="${ECHO:-echo}"
 # Output is prefixed with the name of the script
 myname=$(basename "$0")
 
+# default to one round
+export CHUTNEY_ROUNDS=${CHUTNEY_ROUNDS:-1}
+
 # default to summarising unexpected warnings
 export CHUTNEY_WARNINGS_IGNORE_EXPECTED=${CHUTNEY_WARNINGS_IGNORE_EXPECTED:-true}
 export CHUTNEY_WARNINGS_SUMMARY=${CHUTNEY_WARNINGS_SUMMARY:-true}
@@ -78,7 +81,7 @@ do
       export CHUTNEY_DATA_BYTES="$2"
       shift
     ;;
-    # Make this many connections per client (1)
+    # Make this many simultaneous connections per client (1)
     # Note: If you create 7 or more connections to a hidden service from
     # a single Tor 0.2.7 client, you'll likely get a verification failure due
     # to #15937. This is fixed in 0.2.8.
@@ -86,6 +89,11 @@ do
       export CHUTNEY_CONNECTIONS="$2"
       shift
     ;;
+    # Run this many verification rounds (1)
+    --rounds)
+      export CHUTNEY_ROUNDS="$2"
+      shift
+    ;;
     # Make each client connect to each HS (0)
     # 0 means a single client connects to each HS
     # 1 means every client connects to every HS
@@ -286,9 +294,18 @@ else
 fi
 
 if [ "$CHUTNEY_BOOTSTRAP_TIME" -ge 0 ]; then
-  # Chutney will try to verify for $CHUTNEY_BOOTSTRAP_TIME seconds
-  "$CHUTNEY" verify "$CHUTNEY_NETWORK"
-  VERIFY_EXIT_STATUS="$?"
+  # Chutney will try to verify for $CHUTNEY_BOOTSTRAP_TIME seconds each round
+  n_rounds=0
+  VERIFY_EXIT_STATUS=0
+  # Run CHUTNEY_ROUNDS verification rounds
+  $ECHO "Running $CHUTNEY_ROUNDS verify rounds..."
+  while [ "$CHUTNEY_ROUNDS" -gt "$n_rounds" \
+          -a "$VERIFY_EXIT_STATUS" -eq 0 ]; do
+      "$CHUTNEY" verify "$CHUTNEY_NETWORK"
+      VERIFY_EXIT_STATUS="$?"
+      $[n_rounds++]
+  done
+  $ECHO "Completed $n_rounds of $CHUTNEY_ROUNDS verify rounds."
 else
   $ECHO "Chutney network ready and running. To stop the network, use:"
   $ECHO "$CHUTNEY stop $CHUTNEY_NETWORK"