[Fuego] [PATCH] fio: Add test cases of command fio.

Yuan Chao yuanc.fnst at cn.fujitsu.com
Wed Jun 12 00:55:58 UTC 2019


This is a simple test to check the option help/rw/version of command fio.

Signed-off-by: Yuan Chao <yuanc.fnst at cn.fujitsu.com>
---
 tests/Functional.fio/fio_test.sh          |  4 ++
 tests/Functional.fio/fuego_test.sh        | 17 +++++++
 tests/Functional.fio/parser.py            | 20 +++++++++
 tests/Functional.fio/spec.json            |  6 +++
 tests/Functional.fio/test.yaml            | 19 ++++++++
 tests/Functional.fio/tests/fio_help.sh    | 13 ++++++
 tests/Functional.fio/tests/fio_rw.sh      | 75 +++++++++++++++++++++++++++++++
 tests/Functional.fio/tests/fio_version.sh | 13 ++++++
 8 files changed, 167 insertions(+)
 create mode 100644 tests/Functional.fio/fio_test.sh
 create mode 100644 tests/Functional.fio/fuego_test.sh
 create mode 100644 tests/Functional.fio/parser.py
 create mode 100644 tests/Functional.fio/spec.json
 create mode 100644 tests/Functional.fio/test.yaml
 create mode 100644 tests/Functional.fio/tests/fio_help.sh
 create mode 100644 tests/Functional.fio/tests/fio_rw.sh
 create mode 100644 tests/Functional.fio/tests/fio_version.sh

diff --git a/tests/Functional.fio/fio_test.sh b/tests/Functional.fio/fio_test.sh
new file mode 100644
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.fio/fio_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.fio/fuego_test.sh b/tests/Functional.fio/fuego_test.sh
new file mode 100644
index 0000000..2a2afb3
--- /dev/null
+++ b/tests/Functional.fio/fuego_test.sh
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program fio
+}
+
+function test_deploy {
+    put $TEST_HOME/fio_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./fio_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.fio/parser.py b/tests/Functional.fio/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.fio/parser.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/tests/Functional.fio/spec.json b/tests/Functional.fio/spec.json
new file mode 100644
index 0000000..f66bbee
--- /dev/null
+++ b/tests/Functional.fio/spec.json
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.fio",
+    "specs": {
+        "default": {}
+    }
+}
diff --git a/tests/Functional.fio/test.yaml b/tests/Functional.fio/test.yaml
new file mode 100644
index 0000000..82c3bc5
--- /dev/null
+++ b/tests/Functional.fio/test.yaml
@@ -0,0 +1,19 @@
+fuego_package_version: 1
+name: Functional.fio
+description: |
+        Fio a tool for doing a particular type of I/O action as specified by the user.
+        This is a simple test to check the option help/rw/version of command fio.
+license: BSD-3-Clause
+author: Yuan Chao <yuanc.fnst at cn.fujitsu.com>
+maintainer: Wang Mingyu <wangmy at cn.fujitsu.com>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['benchmark']
+data_files:
+ - fio_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
diff --git a/tests/Functional.fio/tests/fio_help.sh b/tests/Functional.fio/tests/fio_help.sh
new file mode 100644
index 0000000..cb81d58
--- /dev/null
+++ b/tests/Functional.fio/tests/fio_help.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command fio, and check if help option can execute.
+#  1) Option: -h
+
+test="fio"
+
+if fio -h | grep "fio"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.fio/tests/fio_rw.sh b/tests/Functional.fio/tests/fio_rw.sh
new file mode 100644
index 0000000..12ebc33
--- /dev/null
+++ b/tests/Functional.fio/tests/fio_rw.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+#  In target, run command fio, and check if different type of rw option can execute.
+#  1) Option: -rw
+
+test="fio"
+
+test_blk=$(lsblk  -o name | sed -n "2p")
+test_file="result_fio.txt"
+
+test_type="read"
+fio -filename=/dev/$test_blk -direct=1 -iodepth=1 -rw=$test_type -ioengine=libaio -bs=4k -size=1M -runtime=10 -name="fio_test_1M" > $test_file
+if cat $test_file | grep "Run status"
+then
+    echo " -> $test: $test_type executed."
+else
+    echo " -> $test: TEST-FAIL"
+    rm -f $test_file
+    exit
+fi
+
+test_type="write"
+fio -filename=/dev/$test_blk -direct=1 -iodepth=1 -rw=$test_type -ioengine=libaio -bs=4k -size=1M -runtime=10 -name="fio_test_1M" > $test_file
+if cat $test_file | grep "Run status"
+then
+    echo " -> $test: $test_type executed."
+else
+    echo " -> $test: TEST-FAIL"
+    rm -f $test_file
+    exit
+fi
+
+test_type="rw"
+fio -filename=/dev/$test_blk -direct=1 -iodepth=1 -rw=$test_type -ioengine=libaio -bs=4k -size=1M -runtime=10 -name="fio_test_1M" > $test_file
+if cat $test_file | grep "Run status"
+then
+    echo " -> $test: $test_type executed."
+else
+    echo " -> $test: TEST-FAIL"
+    rm -f $test_file
+    exit
+fi
+
+test_type="randread"
+fio -filename=/dev/$test_blk -direct=1 -iodepth=1 -rw=$test_type -ioengine=libaio -bs=4k -size=1M -runtime=10 -name="fio_test_1M" > $test_file
+if cat $test_file | grep "Run status"
+then
+    echo " -> $test: $test_type executed."
+else
+    echo " -> $test: TEST-FAIL"
+    rm -f $test_file
+    exit
+fi
+
+test_type="randwrite"
+fio -filename=/dev/$test_blk -direct=1 -iodepth=1 -rw=$test_type -ioengine=libaio -bs=4k -size=1M -runtime=10 -name="fio_test_1M" > $test_file
+if cat $test_file | grep "Run status"
+then
+    echo " -> $test: $test_type executed."
+else
+    echo " -> $test: TEST-FAIL"
+    rm -f $test_file
+    exit
+fi
+
+test_type="randrw"
+fio -filename=/dev/$test_blk -direct=1 -iodepth=1 -rw=$test_type -ioengine=libaio -bs=4k -size=1M -runtime=10 -name="fio_test_1M" > $test_file
+if cat $test_file | grep "Run status"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -f $test_file
diff --git a/tests/Functional.fio/tests/fio_version.sh b/tests/Functional.fio/tests/fio_version.sh
new file mode 100644
index 0000000..8e632ce
--- /dev/null
+++ b/tests/Functional.fio/tests/fio_version.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command fio, and check if version option can execute.
+#  1) Option: -r
+
+test="fio"
+
+if fio -v | grep "fio"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
-- 
1.8.3.1





More information about the Fuego mailing list