summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-02-27 11:36:39 -0500
committerNick Mathewson <nickm@torproject.org>2017-02-27 11:36:39 -0500
commiteef8bd4d3c49bf093f11bf6fa81bfd8561f02fc5 (patch)
treec556b4312e2ba5526e3069ac23c040c16fa59c46
parentc51919b0da2afe73780508e5593ebf9052e177cc (diff)
parent73879aa5b686cf445389f02a3d954222ea6ae2ae (diff)
downloadtor-eef8bd4d3c49bf093f11bf6fa81bfd8561f02fc5.tar.gz
tor-eef8bd4d3c49bf093f11bf6fa81bfd8561f02fc5.zip
Merge remote-tracking branch 'teor/feature21570-030' into maint-0.3.0
-rw-r--r--Makefile.am5
-rw-r--r--changes/bug215624
-rw-r--r--changes/feature215705
-rwxr-xr-xsrc/test/test-network.sh47
4 files changed, 40 insertions, 21 deletions
diff --git a/Makefile.am b/Makefile.am
index 631b44e7f5..880420b287 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,6 +54,7 @@ TEST_CFLAGS=
TEST_CPPFLAGS=-DTOR_UNIT_TESTS
TEST_NETWORK_FLAGS=--hs-multi-client 1
endif
+TEST_NETWORK_WARNING_FLAGS=--quiet --only-warnings
if LIBFUZZER_ENABLED
TEST_CFLAGS += -fsanitize-coverage=trace-pc-guard,trace-cmp,trace-div
@@ -135,6 +136,10 @@ test-network-all: need-chutney-path test-driver $(TESTING_TOR_BINARY) src/tools/
done; \
for f in $$flavors; do \
$(SHELL) $(top_srcdir)/test-driver --test-name $$f --log-file $(TEST_NETWORK_ALL_LOG_DIR)/$$f.log --trs-file $(TEST_NETWORK_ALL_LOG_DIR)/$$f.trs $(TEST_NETWORK_ALL_DRIVER_FLAGS) $(top_srcdir)/src/test/test-network.sh --flavor $$f $(TEST_NETWORK_FLAGS); \
+ $(top_srcdir)/src/test/test-network.sh $(TEST_NETWORK_WARNING_FLAGS); \
+ if test $$? -eq 2 ; then \
+ echo "Please update your chutney using 'git pull' to see tor warnings here."; \
+ fi; \
done; \
echo "Log and result files are available in $(TEST_NETWORK_ALL_LOG_DIR)."; \
! grep -q FAIL test_network_log/*.trs
diff --git a/changes/bug21562 b/changes/bug21562
new file mode 100644
index 0000000000..48396a00e7
--- /dev/null
+++ b/changes/bug21562
@@ -0,0 +1,4 @@
+ o Minor bugfixes (testing):
+ - Use bash in src/test/test-network.sh. This ensures we reliably call
+ chutney's newer tools/test-network.sh when available.
+ Fixes bug 21562; bugfix on tor-0.2.9.1-alpha.
diff --git a/changes/feature21570 b/changes/feature21570
new file mode 100644
index 0000000000..40555eefa9
--- /dev/null
+++ b/changes/feature21570
@@ -0,0 +1,5 @@
+ o Minor features (testing):
+ - During 'make test-network-all', if tor logs any warnings, ask chutney
+ to output them. Requires a recent version of chutney with the 21572
+ patch.
+ Implements 21570.
diff --git a/src/test/test-network.sh b/src/test/test-network.sh
index 4d9776822b..cb10f7232f 100755
--- a/src/test/test-network.sh
+++ b/src/test/test-network.sh
@@ -1,8 +1,9 @@
-#! /bin/sh
+#! /bin/bash
# Please do not modify this script, it has been moved to chutney/tools
-ECHO_N="/bin/echo -n"
+export ECHO=${ECHO:-"echo"}
+export ECHO_N=${ECHO_N:-"/bin/echo -n"}
# Output is prefixed with the name of the script
myname=$(basename $0)
@@ -19,23 +20,22 @@ if [ "$TEST_NETWORK_RECURSING" != true ]; then
# When we switch to using test-network.sh in chutney/tools, --dry-run
# can be removed, because this script will find chutney, then pass all
# arguments to chutney's test-network.sh
- echo "$myname: Parsing command-line arguments to find \$CHUTNEY_PATH"
export TEST_NETWORK_RECURSING=true
. "$0" --dry-run "$@"
# Call the chutney version of this script, if it exists, and we can find it
if [ -d "$CHUTNEY_PATH" -a -x "$CHUTNEY_PATH/tools/test-network.sh" ]; then
unset NETWORK_DRY_RUN
- echo "$myname: Calling newer chutney script \
+ $ECHO "$myname: Calling newer chutney script \
$CHUTNEY_PATH/tools/test-network.sh"
"$CHUTNEY_PATH/tools/test-network.sh" "$@"
exit $?
else
- echo "$myname: This script has moved to chutney/tools."
- echo "$myname: Please update your chutney using 'git pull'."
+ $ECHO "$myname: This script has moved to chutney/tools."
+ $ECHO "$myname: Please update your chutney using 'git pull'."
# When we switch to using test-network.sh in chutney/tools, we should
# exit with a very loud failure here
- echo "$myname: Falling back to the old tor version of the script."
+ $ECHO "$myname: Falling back to the old tor version of the script."
fi
fi
@@ -89,10 +89,14 @@ do
# process arguments, but don't call any other scripts
export NETWORK_DRY_RUN=true
;;
+ --quiet)
+ export ECHO=true
+ export ECHO_N=true
+ ;;
*)
- echo "$myname: Sorry, I don't know what to do with '$1'."
- echo "$myname: Maybe chutney's test-network.sh understands '$1'."
- echo "$myname: Please update your chutney using 'git pull', and set \
+ $ECHO "$myname: Sorry, I don't know what to do with '$1'."
+ $ECHO "$myname: Maybe chutney's test-network.sh understands '$1'."
+ $ECHO "$myname: Please update your chutney using 'git pull', and set \
\$CHUTNEY_PATH"
# continue processing arguments during a dry run
if [ "$NETWORK_DRY_RUN" != true ]; then
@@ -113,15 +117,15 @@ if [ ! -d "$TOR_DIR" ]; then
if [ -d "$BUILDDIR/src/or" -a -d "$BUILDDIR/src/tools" ]; then
# Choose the build directory
# But only if it looks like one
- echo "$myname: \$TOR_DIR not set, trying \$BUILDDIR"
+ $ECHO "$myname: \$TOR_DIR not set, trying \$BUILDDIR"
export TOR_DIR="$BUILDDIR"
elif [ -d "$PWD/src/or" -a -d "$PWD/src/tools" ]; then
# Guess the tor directory is the current directory
# But only if it looks like one
- echo "$myname: \$TOR_DIR not set, trying \$PWD"
+ $ECHO "$myname: \$TOR_DIR not set, trying \$PWD"
export TOR_DIR="$PWD"
else
- echo "$myname: no \$TOR_DIR, chutney will use \$PATH for tor binaries"
+ $ECHO "$myname: no \$TOR_DIR, chutney will use \$PATH for tor binaries"
unset TOR_DIR
fi
fi
@@ -133,19 +137,19 @@ fi
# - fail and tell the user how to clone the chutney repository
if [ ! -d "$CHUTNEY_PATH" -o ! -x "$CHUTNEY_PATH/chutney" ]; then
if [ -x "$PWD/chutney" ]; then
- echo "$myname: \$CHUTNEY_PATH not valid, trying \$PWD"
+ $ECHO "$myname: \$CHUTNEY_PATH not valid, trying \$PWD"
export CHUTNEY_PATH="$PWD"
elif [ -d "$TOR_DIR" -a -d "$TOR_DIR/../chutney" -a \
-x "$TOR_DIR/../chutney/chutney" ]; then
- echo "$myname: \$CHUTNEY_PATH not valid, trying \$TOR_DIR/../chutney"
+ $ECHO "$myname: \$CHUTNEY_PATH not valid, trying \$TOR_DIR/../chutney"
export CHUTNEY_PATH="$TOR_DIR/../chutney"
else
# TODO: work out how to package and install chutney,
# so users can find it in $PATH
- echo "$myname: missing 'chutney' in \$CHUTNEY_PATH ($CHUTNEY_PATH)"
- echo "$myname: Get chutney: git clone https://git.torproject.org/\
+ $ECHO "$myname: missing 'chutney' in \$CHUTNEY_PATH ($CHUTNEY_PATH)"
+ $ECHO "$myname: Get chutney: git clone https://git.torproject.org/\
chutney.git"
- echo "$myname: Set \$CHUTNEY_PATH to a non-standard location: export \
+ $ECHO "$myname: Set \$CHUTNEY_PATH to a non-standard location: export \
CHUTNEY_PATH=\`pwd\`/chutney"
unset CHUTNEY_PATH
exit 1
@@ -174,11 +178,12 @@ export CHUTNEY_NETWORK=networks/$NETWORK_FLAVOUR
# And finish up if we're doing a dry run
if [ "$NETWORK_DRY_RUN" = true ]; then
# we can't exit here, it breaks argument processing
- return
+ # this only works in bash: return semantics are shell-specific
+ return 2>/dev/null || exit
fi
cd "$CHUTNEY_PATH"
-./tools/bootstrap-network.sh $NETWORK_FLAVOUR || exit 2
+./tools/bootstrap-network.sh $NETWORK_FLAVOUR || exit 3
# Sleep some, waiting for the network to bootstrap.
# TODO: Add chutney command 'bootstrap-status' and use that instead.
@@ -186,7 +191,7 @@ BOOTSTRAP_TIME=${BOOTSTRAP_TIME:-35}
$ECHO_N "$myname: sleeping for $BOOTSTRAP_TIME seconds"
n=$BOOTSTRAP_TIME; while [ $n -gt 0 ]; do
sleep 1; n=$(expr $n - 1); $ECHO_N .
-done; echo ""
+done; $ECHO ""
./chutney verify $CHUTNEY_NETWORK
VERIFY_EXIT_STATUS=$?
# work around a bug/feature in make -j2 (or more)