summaryrefslogtreecommitdiff
path: root/automated
diff options
context:
space:
mode:
authorNaresh Kamboju <naresh.kamboju@linaro.org>2016-10-18 23:33:10 +0530
committerNaresh Kamboju <naresh.kamboju@linaro.org>2016-10-19 19:53:51 +0530
commit325c4ecfc4ad9f959643267b7322066a0363eaaf (patch)
treedba979a5fa8e59f50631f3aecb5c9e0d5d55cf2a /automated
parent1d5d24be03050b90084f833c5946495dc65ba16e (diff)
v2: linux: Adding fio-test
Change-Id: Icdd8b63e9b8149a71d34cf24833e7e06104e28e7 Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Diffstat (limited to 'automated')
-rwxr-xr-xautomated/linux/fio-test/fio-test.sh157
-rw-r--r--automated/linux/fio-test/fio-test.yaml36
2 files changed, 193 insertions, 0 deletions
diff --git a/automated/linux/fio-test/fio-test.sh b/automated/linux/fio-test/fio-test.sh
new file mode 100755
index 0000000..bf06755
--- /dev/null
+++ b/automated/linux/fio-test/fio-test.sh
@@ -0,0 +1,157 @@
+#!/bin/bash
+#
+# FIO test cases for Linux
+#
+# Copyright (C) 2016, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Naresh Kamboju <naresh.kamboju@linaro.org>
+#
+
+. ../../lib/sh-test-lib
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+FIO_SKIP_LIST="fio_read fio_randread fio_write fio_randwrite fio_512k_write fio_512k_read"
+
+usage() {
+ echo "Usage: $0 [-p <partition>] [-s <true>]" 1>&2
+ exit 1
+}
+
+while getopts "p:s:" o; do
+ case "$o" in
+ # The current working directory will be used by default.
+ # Use '-p' specify partition that used for dd test.
+ p) PARTITION="${OPTARG}" ;;
+ s) SKIP_INSTALL="${OPTARG}" ;;
+ *) usage ;;
+ esac
+done
+
+fio_build_install() {
+ wget http://brick.kernel.dk/snaps/fio-2.1.10.tar.gz
+ tar -xvf fio-2.1.10.tar.gz
+ cd fio-2.1.10
+ ./configure
+ make all
+ make install
+}
+
+install() {
+ dist_name
+ case "${dist}" in
+ Debian|Ubuntu)
+ pkgs="fio"
+ install_deps "${pkgs}" "${SKIP_INSTALL}"
+ ;;
+ Fedora|CentOS)
+ pkgs="gcc tar wget"
+ install_deps "${pkgs}" "${SKIP_INSTALL}"
+ fio_build_install
+ ;;
+ # When build do not have package manager
+ # Assume development tools pre-installed
+ *) fio_build_install ;;
+ esac
+}
+
+parse_output() {
+ test="$1"
+ file="$2"
+ IOPS=$(grep "iops=" "${file}" | cut -d= -f4 | cut -d, -f1)
+ add_metric "${test}" "pass" "${IOPS}" "iops"
+}
+
+fio_device_existence() {
+ # check for block device
+ [ -b "${PARTITION}" ]
+ exit_on_fail "fio_device" "fio ${FIO_SKIP_LIST}"
+}
+
+fio_existence() {
+ eval "which fio"
+ exit_on_fail "fio" "${FIO_SKIP_LIST}"
+}
+
+fio_read() {
+ file="${OUTPUT}/fio_read.txt"
+ fio -filename="${PARTITION}" -rw=read -direct=1 -iodepth 1 -thread \
+ -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting \
+ -name=fio_read 2>&1 | tee -a "${file}"
+ parse_output "fio_read" "${file}"
+
+}
+
+fio_randread() {
+ file="${OUTPUT}/fio_randread.txt"
+ fio -filename="${PARTITION}" -rw=randread -direct=1 -iodepth 1 -thread \
+ -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting \
+ -name=fio_randread 2>&1 | tee -a "${file}"
+ parse_output "fio_randread" "${file}"
+}
+
+fio_write() {
+ file="${OUTPUT}/fio_write.txt"
+ fio -filename="${PARTITION}" -rw=write -direct=1 -iodepth 1 -thread \
+ -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting \
+ -name=fio_write 2>&1 | tee -a "${file}"
+ parse_output "fio_write" "${file}"
+}
+
+fio_randwrite() {
+ file="${OUTPUT}/fio_randwrite.txt"
+ fio -filename="${PARTITION}" -rw=randwrite -direct=1 -iodepth 1 -thread \
+ -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting \
+ -name=fio_randwrite 2>&1 | tee -a "${file}"
+ parse_output "fio_randwrite" "${file}"
+}
+
+fio_512k_write() {
+ file="${OUTPUT}/fio_512k_write.txt"
+ fio -filename="${PARTITION}" -rw=write -direct=1 -iodepth 1 -thread \
+ -ioengine=psync -bs=512k -numjobs=1 -runtime=10 -group_reporting \
+ -name=fio_512k_write 2>&1 | tee -a "${file}"
+ parse_output "fio_512k_write" "${file}"
+}
+
+fio_512k_read() {
+ file="${OUTPUT}/fio_512k_read.txt"
+ fio -filename="${PARTITION}" -rw=read -direct=1 -iodepth 1 -thread \
+ -ioengine=psync -bs=512k -numjobs=1 -runtime=10 -group_reporting \
+ -name=fio_512k_read 2>&1 | tee -a "${file}"
+ parse_output "fio_512k_read" "${file}"
+}
+
+# Test run.
+! check_root && error_msg "This script must be run as root"
+[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
+mkdir -p "${OUTPUT}"
+
+info_msg "About to run fio test..."
+info_msg "Output directory: ${OUTPUT}"
+
+# Install dependency packages
+install
+
+# Run all test
+fio_device_existence
+fio_existence
+fio_read
+fio_randread
+fio_write
+fio_randwrite
+fio_512k_write
+fio_512k_read
diff --git a/automated/linux/fio-test/fio-test.yaml b/automated/linux/fio-test/fio-test.yaml
new file mode 100644
index 0000000..e355495
--- /dev/null
+++ b/automated/linux/fio-test/fio-test.yaml
@@ -0,0 +1,36 @@
+metadata:
+ name: fio-test
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "FIO or Flexible IO is a versatile IO workload generator Test on Linux.
+ The target block device partition required to run this test to be set as '/dev/sdbX'"
+ maintainer:
+ - naresh.kamboju@linaro.org
+ os:
+ - debian
+ - ubuntu
+ - centos
+ - fedora
+ devices:
+ - mustang
+ - overdrive
+ - d02
+ - d03
+ - hi6220-hikey
+ - apq8016-sbc
+ scope:
+ - performance
+ environment:
+ - lava-test-shell
+
+params:
+ # The currenty working directory will be used by default.
+ # Use '-p' specify block device partition that used for fio test.
+ # Example: /dev/sdb1
+ BLK_DEV_PARTITION: ""
+ SKIP_INSTALL: "False"
+
+run:
+ steps:
+ - cd ./automated/linux/fio-test/
+ - ./fio-test.sh -p "${BLK_DEV_PARTITION}" -s "${SKIP_INSTALL}"
+ - ../../utils/send-to-lava.sh ./output/result.txt