mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-08-08 23:44:34 +02:00
rename hacks to scripts
This commit is contained in:
36
scripts/run-benchmark
Executable file
36
scripts/run-benchmark
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
function with_set_x() {
|
||||
set -x
|
||||
"$@"
|
||||
{
|
||||
ec=$?
|
||||
set +x
|
||||
return $ec
|
||||
} 2>/dev/null
|
||||
}
|
||||
|
||||
./test-bed up -d
|
||||
|
||||
benchmark() {
|
||||
local sshuttle_bin="${1?:}"
|
||||
local node="${2:-"node-1"}"
|
||||
echo -e "\n======== Benchmarking sshuttle: $sshuttle_bin ========"
|
||||
with_set_x ./exec-sshuttle "$node" --sshuttle-bin="$sshuttle_bin" --listen 55771 &
|
||||
sshuttle_pid=$!
|
||||
trap 'kill -0 $sshuttle_pid &>/dev/null && kill -15 $sshuttle_pid' EXIT
|
||||
while ! nc -z localhost 55771; do sleep 0.1; done
|
||||
sleep 1
|
||||
./exec-tool iperf3 "$node" --time=4
|
||||
with_set_x kill -15 $sshuttle_pid
|
||||
wait $sshuttle_pid || true
|
||||
}
|
||||
|
||||
if [[ "$1" ]]; then
|
||||
benchmark "$1"
|
||||
else
|
||||
benchmark "${SSHUTTLE_BIN:-sshuttle}" node-1
|
||||
benchmark dev node-1
|
||||
fi
|
Reference in New Issue
Block a user