summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorVincent Fu <vincent.fu@wdc.com>2018-06-18 10:55:21 -0600
committerVincent Fu <vincent.fu@wdc.com>2018-06-18 13:37:14 -0600
commit4e5c281e0c6a467881af2eb5b332f2e0de668ee7 (patch)
tree29f254e9a009f5c2e3d7bce4963f880d64d01419 /t
parent4027b2a142c01869a913c8c0654e3392ef1d0489 (diff)
downloadfio-4e5c281e0c6a467881af2eb5b332f2e0de668ee7.tar.gz
fio-4e5c281e0c6a467881af2eb5b332f2e0de668ee7.tar.bz2
testing: add test script for readonly parameter
Add a shell script and jobs for testing the readonly parameter
Diffstat (limited to 't')
-rw-r--r--t/jobs/readonly-r.fio5
-rw-r--r--t/jobs/readonly-t.fio5
-rw-r--r--t/jobs/readonly-w.fio5
-rwxr-xr-xt/readonly.sh84
4 files changed, 99 insertions, 0 deletions
diff --git a/t/jobs/readonly-r.fio b/t/jobs/readonly-r.fio
new file mode 100644
index 00000000..34ba9b5e
--- /dev/null
+++ b/t/jobs/readonly-r.fio
@@ -0,0 +1,5 @@
+[test]
+filename=${DUT}
+rw=randread
+time_based
+runtime=1s
diff --git a/t/jobs/readonly-t.fio b/t/jobs/readonly-t.fio
new file mode 100644
index 00000000..f3e093c1
--- /dev/null
+++ b/t/jobs/readonly-t.fio
@@ -0,0 +1,5 @@
+[test]
+filename=${DUT}
+rw=randtrim
+time_based
+runtime=1s
diff --git a/t/jobs/readonly-w.fio b/t/jobs/readonly-w.fio
new file mode 100644
index 00000000..26029ef2
--- /dev/null
+++ b/t/jobs/readonly-w.fio
@@ -0,0 +1,5 @@
+[test]
+filename=${DUT}
+rw=randwrite
+time_based
+runtime=1s
diff --git a/t/readonly.sh b/t/readonly.sh
new file mode 100755
index 00000000..d7094146
--- /dev/null
+++ b/t/readonly.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+#
+# Do some basic test of the --readonly parameter
+#
+# DUT should be a device that accepts read, write, and trim operations
+#
+# Example usage:
+#
+# DUT=/dev/fioa t/readonly.sh
+#
+TESTNUM=1
+
+#
+# The first parameter is the return code
+# The second parameter is 0 if the return code should be 0
+# positive if the return code should be positive
+#
+check () {
+ echo "********************"
+
+ if [ $2 -gt 0 ]; then
+ if [ $1 -eq 0 ]; then
+ echo "Test $TESTNUM failed"
+ echo "********************"
+ exit 1
+ else
+ echo "Test $TESTNUM passed"
+ fi
+ else
+ if [ $1 -gt 0 ]; then
+ echo "Test $TESTNUM failed"
+ echo "********************"
+ exit 1
+ else
+ echo "Test $TESTNUM passed"
+ fi
+ fi
+
+ echo "********************"
+ echo
+ TESTNUM=$((TESTNUM+1))
+}
+
+./fio --name=test --filename=$DUT --rw=randread --readonly --time_based --runtime=1s &> /dev/null
+check $? 0
+./fio --name=test --filename=$DUT --rw=randwrite --readonly --time_based --runtime=1s &> /dev/null
+check $? 1
+./fio --name=test --filename=$DUT --rw=randtrim --readonly --time_based --runtime=1s &> /dev/null
+check $? 1
+
+./fio --name=test --filename=$DUT --readonly --rw=randread --time_based --runtime=1s &> /dev/null
+check $? 0
+./fio --name=test --filename=$DUT --readonly --rw=randwrite --time_based --runtime=1s &> /dev/null
+check $? 1
+./fio --name=test --filename=$DUT --readonly --rw=randtrim --time_based --runtime=1s &> /dev/null
+check $? 1
+
+./fio --name=test --filename=$DUT --rw=randread --time_based --runtime=1s &> /dev/null
+check $? 0
+./fio --name=test --filename=$DUT --rw=randwrite --time_based --runtime=1s &> /dev/null
+check $? 0
+./fio --name=test --filename=$DUT --rw=randtrim --time_based --runtime=1s &> /dev/null
+check $? 0
+
+./fio t/jobs/readonly-r.fio --readonly &> /dev/null
+check $? 0
+./fio t/jobs/readonly-w.fio --readonly &> /dev/null
+check $? 1
+./fio t/jobs/readonly-t.fio --readonly &> /dev/null
+check $? 1
+
+./fio --readonly t/jobs/readonly-r.fio &> /dev/null
+check $? 0
+./fio --readonly t/jobs/readonly-w.fio &> /dev/null
+check $? 1
+./fio --readonly t/jobs/readonly-t.fio &> /dev/null
+check $? 1
+
+./fio t/jobs/readonly-r.fio &> /dev/null
+check $? 0
+./fio t/jobs/readonly-w.fio &> /dev/null
+check $? 0
+./fio t/jobs/readonly-t.fio &> /dev/null
+check $? 0