summaryrefslogtreecommitdiff
path: root/automated
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2016-11-22 18:02:12 +0800
committerChase Qi <chase.qi@linaro.org>2016-11-23 07:24:08 +0800
commit8cf94d961ea3261f95380812da789be87f958dcb (patch)
tree931e1b3bf6e408f08361825a28651884237fab08 /automated
parentfaff453907bac36d3ac5300e7bdff973628ee3d1 (diff)
automated: linux: added iperf test
Change-Id: Ibf8bebfe78d60028ed7805f5f62080a194a2e660 Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'automated')
-rwxr-xr-xautomated/linux/iperf/iperf.sh80
-rw-r--r--automated/linux/iperf/iperf.yaml37
2 files changed, 117 insertions, 0 deletions
diff --git a/automated/linux/iperf/iperf.sh b/automated/linux/iperf/iperf.sh
new file mode 100755
index 0000000..f2ad3d1
--- /dev/null
+++ b/automated/linux/iperf/iperf.sh
@@ -0,0 +1,80 @@
+#!/bin/sh -e
+
+# shellcheck disable=SC1091
+. ../../lib/sh-test-lib
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+LOGFILE="${OUTPUT}/iperf.txt"
+# Test locahost by defualt, which tests the effificency of TCP/IP stack.
+# To test physical network bandwidth, specify remote test server with '-c'.
+# Execute 'iperf3 -s' on remote host to run iperf3 test server.
+SERVER="127.0.0.1"
+# Time in seconds to transmit for
+TIME="10"
+# Number of parallel client streams to run
+THREADS="1"
+# Specify iperf3 version for CentOS.
+VERSION="3.1.4"
+
+usage() {
+ echo "Usage: $0 [-c server] [-t time] [-p number] [-v version] [-s true|false]" 1>&2
+ exit 1
+}
+
+while getopts "c:t:p:v:s:h" o; do
+ case "$o" in
+ c) SERVER="${OPTARG}" ;;
+ t) TIME="${OPTARG}" ;;
+ p) THREADS="${OPTARG}" ;;
+ v) VERSION="${OPTARG}" ;;
+ s) SKIP_INSTALL="${OPTARG}" ;;
+ h|*) usage ;;
+ esac
+done
+
+[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
+mkdir -p "${OUTPUT}"
+cd "${OUTPUT}"
+
+if [ "${SKIP_INSTALL}" = "true" ] || [ "${SKIP_INSTALL}" = "True" ]; then
+ info_msg "iperf installation skipped"
+else
+ ! check_root && error_msg "You need to be root for installation!"
+ dist_name
+ # shellcheck disable=SC2154
+ case "${dist}" in
+ Debian|Ubuntu|Fedora)
+ install_deps "iperf3"
+ ;;
+ CentOS)
+ install_deps "wget gcc make"
+ wget https://github.com/esnet/iperf/archive/"${VERSION}".tar.gz
+ tar xf "${VERSION}".tar.gz
+ cd iperf-"${VERSION}"
+ ./configure
+ make
+ make install
+ ;;
+ esac
+fi
+
+# Run local iperf3 server as a daemon when testing localhost.
+[ "${SERVER}" = "127.0.0.1" ] && iperf3 -s -D
+
+# Run iperf test with unbuffered output mode.
+stdbuf -o0 iperf3 -c "${SERVER}" -t "${TIME}" -P "${THREADS}" 2>&1 \
+ | tee "${LOGFILE}"
+
+# Parse logfile.
+if [ "${THREADS}" -eq 1 ]; then
+ egrep "(sender|receiver)" "${LOGFILE}" \
+ | awk '{printf("iperf-%s pass %s %s\n", $NF,$7,$8)}' \
+ | tee -a "${RESULT_FILE}"
+elif [ "${THREADS}" -gt 1 ]; then
+ egrep "[SUM].*(sender|receiver)" "${LOGFILE}" \
+ | awk '{printf("iperf-%s pass %s %s\n", $NF,$6,$7)}' \
+ | tee -a "${RESULT_FILE}"
+fi
+
+# Kill iperf test daemon if any.
+pkill iperf3 || true
diff --git a/automated/linux/iperf/iperf.yaml b/automated/linux/iperf/iperf.yaml
new file mode 100644
index 0000000..2d636c6
--- /dev/null
+++ b/automated/linux/iperf/iperf.yaml
@@ -0,0 +1,37 @@
+metadata:
+ name: iperf
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "iperf is a tool for active measurements of the maximum
+ achievable bandwidth on IP networks."
+ maintainer:
+ - chase.qi@linaro.org
+ os:
+ - debian
+ - ubuntu
+ - fedora
+ - centos
+ scope:
+ - performance
+ environment:
+ - lava-test-shell
+ devices:
+ - hi6220-hikey
+ - apq8016-sbc
+ - mustang
+ - moonshot
+ - thunderX
+ - d03
+ - d05
+
+params:
+ # Time in seconds to transmit for
+ TIME: "10"
+ # Number of parallel client streams to run
+ THREADS: "1"
+ SKIP_INSTALL: "false"
+
+run:
+ steps:
+ - cd ./automated/linux/iperf/
+ - ./iperf.sh -t "${TIME}" -p "${THREADS}" -s "${SKIP_INSTALL}"
+ - ../../utils/send-to-lava.sh ./output/result.txt