diff options
author | Naresh Kamboju <naresh.kamboju@linaro.org> | 2016-10-18 21:55:03 +0530 |
---|---|---|
committer | Naresh Kamboju <naresh.kamboju@linaro.org> | 2016-10-18 21:55:03 +0530 |
commit | 1be1dde0ebe5fbb5fe1fedf2b7aa43614366977b (patch) | |
tree | b7bbf0fd1bcf9ae5b42d72aa081d2722b3784b3f | |
parent | aa7abe06276af2ebbbd0793e6e865a214d6e4d05 (diff) |
v2: linux: Adding fio-test
Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
-rwxr-xr-x | automated/linux/fio-test/fio-test.sh | 151 | ||||
-rw-r--r-- | automated/linux/fio-test/fio-test.yaml | 34 |
2 files changed, 185 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..3440d27 --- /dev/null +++ b/automated/linux/fio-test/fio-test.sh @@ -0,0 +1,151 @@ +#!/bin/sh +# +# FIO test cases for Linux Linaro ubuntu +# +# 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 + +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}" + 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 + ;; + esac + +} + +parse_output() { + test="$1" + file="$2" + IOPS=$(grep "iops=" "${file}" | awk '{print $5}' | cut -d, -f1 | cut -d= -f2) + 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="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 "${OUTPUT}"/"${file}" + parse_output "fio_read" "${file}" + +} + +fio_randread() { + file="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 "${OUTPUT}"/"${file}" + parse_output "fio_randread" "${file}" +} + +fio_write() { + file="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 "${OUTPUT}"/"${file}" + parse_output "fio_write" "${file}" +} + +fio_randwrite() { + file="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 "${OUTPUT}"/"${file}" + parse_output "fio_randwrite" "${file}" +} + +fio_512k_write() { + file="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 "${OUTPUT}"/"${file}" + parse_output "fio_512k_write" "${file}" +} + +fio_512k_read() { + file="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 "${OUTPUT}"/"${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..0938be1 --- /dev/null +++ b/automated/linux/fio-test/fio-test.yaml @@ -0,0 +1,34 @@ +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 + 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.py -p "${BLK_DEV_PARTITION}" -s "${SKIP_INSTALL}" + - ../../utils/send-to-lava.sh ./output/result.txt |