Dmitry Sutyagin c8727d1431 Fix: UnicodeDecodeError, broken spec; add SPT
- Only convert outputs/errors to unicode if printing required,
  use 'replace' error handling to avoid errors. Write original
  byte str to output files to avoid double conversion.
- Fix spec broken with 1.26.6.
- Add simplified-performance-testing config & rq files, scripts.
  Can be used after deployment to get a few benchmark values.
  SPT_parser.sh can be used to parse results.

Change-Id: I2aacfdbd9574ff737a6b88a29d87ae56abd03e46
2017-02-23 16:02:58 -08:00

29 lines
703 B
Bash

#!/bin/bash
set -x
function timeout_kill() {
if [ "$1" -gt 0 ]
then
sleep 10.5
[ "$(pgrep iperf | grep -c "$1")" -gt 0 ] && sleep 5
[ "$(pgrep iperf | grep -c "$1")" -gt 0 ] && kill -9 $1 &>/dev/null
fi
}
SPT_IPERF_PORT=${SPT_IPERF_PORT:-"65432"}
[ -z "$SERVER_IP" ] && echo '$SERVER_IP not provided, exiting' && exit 1
# install iperf
which iperf &>/dev/null
if [ "$?" -ne "0" ]
then
result="$(DEBIAN_FRONTEND=noninteractive apt-get -y install iperf 2>&1)"
[ "$?" -ne "0" ] && echo -e "failed to install iperf:\n$result" && exit 1
fi
iperf -c $SERVER_IP -p $SPT_IPERF_PORT &
timeout_kill $!
iperf -c $SERVER_IP -p $SPT_IPERF_PORT -P10 &
timeout_kill $!