2013-06-05 15:48:57 +02:00
|
|
|
#! /bin/sh
|
|
|
|
|
2014-10-01 09:56:53 +02:00
|
|
|
ECHO_N="/bin/echo -n"
|
2015-08-03 19:23:58 +02:00
|
|
|
use_coverage_binary=false
|
2014-10-01 09:56:53 +02:00
|
|
|
|
2015-09-08 14:27:12 +02:00
|
|
|
until [ -z "$1" ]
|
2013-09-29 07:24:14 +02:00
|
|
|
do
|
2015-09-08 14:27:12 +02:00
|
|
|
case "$1" in
|
2013-09-29 07:24:14 +02:00
|
|
|
--chutney-path)
|
|
|
|
export CHUTNEY_PATH="$2"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--tor-path)
|
|
|
|
export TOR_DIR="$2"
|
|
|
|
shift
|
|
|
|
;;
|
2015-03-22 09:41:05 +01:00
|
|
|
--flavor|--flavour|--network-flavor|--network-flavour)
|
2013-09-29 07:24:14 +02:00
|
|
|
export NETWORK_FLAVOUR="$2"
|
|
|
|
shift
|
|
|
|
;;
|
2014-10-01 10:05:04 +02:00
|
|
|
--delay|--sleep|--bootstrap-time|--time)
|
|
|
|
export BOOTSTRAP_TIME="$2"
|
|
|
|
shift
|
|
|
|
;;
|
2015-07-06 08:59:15 +02:00
|
|
|
# Environmental variables used by chutney verify performance tests
|
|
|
|
# Send this many bytes per client connection (10 KBytes)
|
|
|
|
--data|--data-bytes|--data-byte|--bytes|--byte)
|
|
|
|
export CHUTNEY_DATA_BYTES="$2"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
# Make this many connections per client (1)
|
|
|
|
# Note: If you create 7 or more connections to a hidden service from
|
|
|
|
# a single client, you'll likely get a verification failure due to
|
|
|
|
# https://trac.torproject.org/projects/tor/ticket/15937
|
|
|
|
--connections|--connection|--connection-count|--count)
|
|
|
|
export CHUTNEY_CONNECTIONS="$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
|
|
|
|
--hs-multi-client|--hs-multi-clients|--hs-client|--hs-clients)
|
|
|
|
export CHUTNEY_HS_MULTI_CLIENT="$2"
|
|
|
|
shift
|
2015-08-03 19:23:58 +02:00
|
|
|
;;
|
|
|
|
--coverage)
|
|
|
|
use_coverage_binary=true
|
|
|
|
;;
|
2013-09-29 07:24:14 +02:00
|
|
|
*)
|
|
|
|
echo "Sorry, I don't know what to do with '$1'."
|
|
|
|
exit 2
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
2013-06-05 15:48:57 +02:00
|
|
|
|
2013-09-29 07:24:14 +02:00
|
|
|
TOR_DIR="${TOR_DIR:-$PWD}"
|
2015-09-01 16:52:30 +02:00
|
|
|
NETWORK_FLAVOUR=${NETWORK_FLAVOUR:-"bridges+hs"}
|
2013-06-05 15:48:57 +02:00
|
|
|
CHUTNEY_NETWORK=networks/$NETWORK_FLAVOUR
|
2013-06-05 15:48:57 +02:00
|
|
|
myname=$(basename $0)
|
2013-06-05 15:48:57 +02:00
|
|
|
|
2015-09-01 16:52:30 +02:00
|
|
|
[ -n "$CHUTNEY_PATH" ] || {
|
|
|
|
echo "$myname: \$CHUTNEY_PATH not set, trying $TOR_DIR/../chutney"
|
|
|
|
CHUTNEY_PATH="$TOR_DIR/../chutney"
|
|
|
|
}
|
|
|
|
|
2013-06-05 15:48:57 +02:00
|
|
|
[ -d "$CHUTNEY_PATH" ] && [ -x "$CHUTNEY_PATH/chutney" ] || {
|
|
|
|
echo "$myname: missing 'chutney' in CHUTNEY_PATH ($CHUTNEY_PATH)"
|
2015-09-01 16:52:30 +02:00
|
|
|
echo "$myname: Get chutney: git clone https://git.torproject.org/\
|
|
|
|
chutney.git"
|
|
|
|
echo "$myname: Set \$CHUTNEY_PATH to a non-standard location: export CHUTNEY_PATH=\`pwd\`/chutney"
|
2013-06-05 15:48:57 +02:00
|
|
|
exit 1
|
|
|
|
}
|
2015-08-03 19:23:58 +02:00
|
|
|
|
2013-06-05 15:48:57 +02:00
|
|
|
cd "$CHUTNEY_PATH"
|
2013-09-29 07:24:14 +02:00
|
|
|
# For picking up the right tor binaries.
|
2015-08-03 19:23:58 +02:00
|
|
|
tor_name=tor
|
|
|
|
tor_gencert_name=tor-gencert
|
|
|
|
if test "$use_coverage_binary" = true; then
|
|
|
|
tor_name=tor-cov
|
|
|
|
fi
|
|
|
|
export CHUTNEY_TOR="${TOR_DIR}/src/or/${tor_name}"
|
|
|
|
export CHUTNEY_TOR_GENCERT="${TOR_DIR}/src/tools/${tor_gencert_name}"
|
|
|
|
|
2013-06-05 15:48:57 +02:00
|
|
|
./tools/bootstrap-network.sh $NETWORK_FLAVOUR || exit 2
|
|
|
|
|
|
|
|
# Sleep some, waiting for the network to bootstrap.
|
|
|
|
# TODO: Add chutney command 'bootstrap-status' and use that instead.
|
2015-09-09 19:23:32 +02:00
|
|
|
BOOTSTRAP_TIME=${BOOTSTRAP_TIME:-35}
|
2014-10-01 09:56:53 +02:00
|
|
|
$ECHO_N "$myname: sleeping for $BOOTSTRAP_TIME seconds"
|
2013-06-05 15:48:57 +02:00
|
|
|
n=$BOOTSTRAP_TIME; while [ $n -gt 0 ]; do
|
2014-10-01 09:56:53 +02:00
|
|
|
sleep 1; n=$(expr $n - 1); $ECHO_N .
|
2013-06-05 15:48:57 +02:00
|
|
|
done; echo ""
|
|
|
|
./chutney verify $CHUTNEY_NETWORK
|
2014-10-05 00:59:27 +02:00
|
|
|
VERIFY_EXIT_STATUS=$?
|
2014-10-04 05:18:56 +02:00
|
|
|
# work around a bug/feature in make -j2 (or more)
|
|
|
|
# where make hangs if any child processes are still alive
|
|
|
|
./chutney stop $CHUTNEY_NETWORK
|
2014-10-05 00:59:27 +02:00
|
|
|
exit $VERIFY_EXIT_STATUS
|