diff options
author | hnaradla <hanumantha.naradla@linaro.org> | 2014-11-21 16:18:15 +0530 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-11-25 14:28:49 +0000 |
commit | 119e4095f69ee5f93e129079f9520c0c3992d330 (patch) | |
tree | 77248a91fdd0e183d67a3a71e34abc667448f935 | |
parent | 2fd555a9d6a1a1de4135ab2f2c36e560deecdc72 (diff) |
ubuntu: Add test to get Device timings of block devices.
- Dynamically gets all the block devices like sata, sd-card, etc,.
- Perform device timing operations on each device.
Test results are at https://validation.linaro.org/scheduler/job/206365
Change-Id: I861474c9409aa95f126d1b307bd49962702e2031
Signed-off-by: hnaradla <hanumantha.naradla@linaro.org>
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
-rwxr-xr-x | ubuntu/device_read_perf.yaml | 37 | ||||
-rwxr-xr-x | ubuntu/scripts/device_read_perf.sh | 81 |
2 files changed, 118 insertions, 0 deletions
diff --git a/ubuntu/device_read_perf.yaml b/ubuntu/device_read_perf.yaml new file mode 100755 index 0000000..7e3bae4 --- /dev/null +++ b/ubuntu/device_read_perf.yaml @@ -0,0 +1,37 @@ +metadata: + name: device_read_perf + format: "Lava-Test-Shell Test Definition 1.0" + description: "Perform device timings for block devices" + maintainer: + - hanumantha.naradla@linaro.org + os: + - ubuntu + scope: + - performance + devices: + - origen + - snowball + - panda + - panda-es + - vexpress-a9 + - vexpress-tc2 + - highbank + - rtsm_foundation-armv8 + - rtsm_fvp_base-aemv8a + - arndale + - aa9 + environment: + - lava-test-shell +install: + deps: + - hdparm +run: + steps: + - "cd ubuntu/scripts" + - "./device_read_perf.sh" +parse: + pattern: "^test_case_id:(?P<test_case_id>.*-*.+) units:(?P<units>.+) measurement:(?P<measurement>.+) result:(?P<result>\\w+)" +fixupdict: + SKIPPED: skip + PASS: pass + FAIL: fail diff --git a/ubuntu/scripts/device_read_perf.sh b/ubuntu/scripts/device_read_perf.sh new file mode 100755 index 0000000..4ac0d5e --- /dev/null +++ b/ubuntu/scripts/device_read_perf.sh @@ -0,0 +1,81 @@ +#!/bin/sh +# +# Test device timings for block devices on ubuntu +# +# Copyright (C) 2014, 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: Hanumantha Naradla <hanumantha.naradla@linaro.org> + +if [ `whoami` != 'root' ] ; then + echo "You must be the superuser to run this script" >&2 + exit 1 +fi + +. include/sh-test-lib + +## Test case definitions +# Test device read timings (hdparm -t) and cache read timings (hdparm -T) + +test_func(){ + test_cmd=$1 + c_read=0 + p_read=0 + t_read=0 + + for i in 1 2 3; + do + echo "" + echo "device read timings: Iteration $i" + # Perform timings of cache reads + hdparm -T /dev/$test_cmd + # Perform timings of device reads in MB/sec + c_read=(`hdparm -t /dev/$test_cmd | grep 'reads' | awk -v col1=11 '{print $col1}'`) + if [ $c_read ] + then + echo "Device read timings: $c_read MB/sec" + else + echo "test_case_id:device_read_perf-$test_cmd units:none measurement:0 result:fail" + exit 0 + fi + t_read=(`echo $t_read $c_read | awk '{print $1+$2}'`) + done + # Get average of device reads in MB/sec + t_read=(`echo $t_read | awk '{print $1/3}'`) + echo "Average device read timings: $t_read MB/sec" + echo "test_case_id:device_read_perf-$test_cmd units:MBperSecond measurement:$t_read result:pass" +} + +# Get total block devices +disk_count=(`lsblk | grep disk -c`) + +if [ $disk_count -ge 1 ] +then + echo "total block devices are $disk_count" +else + echo "there are no block devices" + echo "test_case_id:device_read_perf-* units:none measurement:0 result:skip" + exit 0 +fi + +# Test device timings for all devices +for i in `lsblk | grep 'disk' | awk -v col1=1 '{print $col1}'` +do + test_func $i +done + +# Clean exit so lava-test can trust the results +exit 0 |