]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstests: add aiodio helper functions
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Wed, 23 Nov 2011 02:39:08 +0000 (11:39 +0900)
committerChristoph Hellwig <hch@lst.de>
Thu, 8 Dec 2011 17:11:38 +0000 (17:11 +0000)
For 198, 239 and 240, use _require_aiodio to fail gracefully if
required program was not built.

For 207-212, use _run_aiodio that includes _require_aiodio and
kicks specified aio-dio program, to make code expressly simple.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
198
207
208
209
210
211
212
239
240
common.rc

diff --git a/198 b/198
index e46ec8d0b43c24649d5820a1fa3aacacd9c6c87e..2c72677872db298e6b3b832f8d42eea8ac740dab 100755 (executable)
--- a/198
+++ b/198
@@ -44,6 +44,7 @@ _cleanup()
 
 _supported_fs generic
 _supported_os Linux
+_require_aiodio aiodio_sparse2
 
 echo "Silence is golden."
 
@@ -51,7 +52,7 @@ echo "Silence is golden."
 rm -f $seq.full
 
 rm -f "$TEST_DIR/aiodio_sparse*"
-$here/src/aio-dio-regress/aiodio_sparse2 "$TEST_DIR/aiodio_sparse"
+$AIO_TEST "$TEST_DIR/aiodio_sparse"
 
 status=$?
 exit
diff --git a/207 b/207
index 32e62990457421aee29aa6c815a345ac9bb088d1..6fff833dd1b6a3291c3457dd089ce4d89d3efbb6 100755 (executable)
--- a/207
+++ b/207
@@ -46,11 +46,6 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 
-rm -f $TEST_DIR/aio-testfile
-AIO_TEST=src/aio-dio-regress/aio-dio-extend-stat
-[ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
-$AIO_TEST $TEST_DIR/aio-testfile 2>&1
-status=$?
-rm -f $TEST_DIR/aio-testfile
+_run_aiodio aio-dio-extend-stat
 
 exit $status
diff --git a/208 b/208
index e1fdaa154fa866aa17e0e4bb03245d6153cfd52f..ca015581853e4793cd789969833909ff6a8d1c31 100755 (executable)
--- a/208
+++ b/208
@@ -46,11 +46,6 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 
-rm -f $TEST_DIR/aio-testfile
-AIO_TEST=src/aio-dio-regress/aio-dio-invalidate-failure
-[ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
-$AIO_TEST $TEST_DIR/aio-testfile 2>&1
-status=$?
-rm -f $TEST_DIR/aio-testfile
+_run_aiodio aio-dio-invalidate-failure
 
 exit $status
diff --git a/209 b/209
index 06f10ae29669026d3aba93efdedb4fdb2708a0b4..650e3008126bc008355d37dfbdc459bb11f30742 100755 (executable)
--- a/209
+++ b/209
@@ -46,11 +46,6 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 
-rm -f $TEST_DIR/aio-testfile
-AIO_TEST=src/aio-dio-regress/aio-dio-invalidate-readahead
-[ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
-$AIO_TEST $TEST_DIR/aio-testfile 2>&1
-status=$?
-rm -f $TEST_DIR/aio-testfile
+_run_aiodio aio-dio-invalidate-readahead
 
 exit $status
diff --git a/210 b/210
index e093079294e62dd29bf6436e14d9b78be7aec2b8..a0873f8fca3863ce58b4b185c55da16d9f8c1a04 100755 (executable)
--- a/210
+++ b/210
@@ -46,11 +46,6 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 
-rm -f $TEST_DIR/aio-testfile
-AIO_TEST=src/aio-dio-regress/aio-dio-subblock-eof-read
-[ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
-$AIO_TEST $TEST_DIR/aio-testfile 2>&1
-status=$?
-rm -f $TEST_DIR/aio-testfile
+_run_aiodio aio-dio-subblock-eof-read
 
 exit $status
diff --git a/211 b/211
index 94283205a65e86e2069e87cddb4bc6a9e0b878fd..bb8d2aabdb5f6df2e0e72413272b687c125441fc 100755 (executable)
--- a/211
+++ b/211
@@ -46,11 +46,6 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 
-rm -f $TEST_DIR/aio-testfile
-AIO_TEST=src/aio-dio-regress/aio-free-ring-with-bogus-nr-pages
-[ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
-$AIO_TEST $TEST_DIR/aio-testfile 2>&1
-status=$?
-rm -f $TEST_DIR/aio-testfile
+_run_aiodio aio-free-ring-with-bogus-nr-pages
 
 exit $status
diff --git a/212 b/212
index 627a431f66e420ba81427efbda4770b9b9a9b526..1b4bb8af74291a9ed8f5e8c938b90e19febb71f0 100755 (executable)
--- a/212
+++ b/212
@@ -47,11 +47,6 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 
-rm -f $TEST_DIR/aio-testfile
-AIO_TEST=src/aio-dio-regress/aio-io-setup-with-nonwritable-context-pointer
-[ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
-$AIO_TEST $TEST_DIR/aio-testfile 2>&1
-status=$?
-rm -f $TEST_DIR/aio-testfile
+_run_aiodio aio-io-setup-with-nonwritable-context-pointer
 
 exit $status
diff --git a/239 b/239
index 88ff776a8abc247d547516eaeb894d864f3f70a3..6457c46ef083ad89624935d7e9ed86c364551102 100755 (executable)
--- a/239
+++ b/239
@@ -46,9 +46,7 @@ _supported_fs generic
 _supported_os Linux
 
 _require_sparse_files
-
-AIO_TEST=src/aio-dio-regress/aio-dio-hole-filling-race
-[ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
+_require_aiodio aio-dio-hole-filling-race
 
 echo "Silence is golden"
 
diff --git a/240 b/240
index 563449e76174b53c39c03786cf0207df9c75d061..dafcef3ba39377384f6ea0f1a51877f85a0f4ef4 100755 (executable)
--- a/240
+++ b/240
@@ -52,6 +52,7 @@ _supported_fs generic
 _supported_os Linux
 
 _require_sparse_files
+_require_aiodio aiodio_sparse2
 
 echo "Silence is golden."
 
@@ -69,7 +70,7 @@ fi
 
 # 2 threads, fs block sized writes, 64k filesize, stride through file by
 # fs block size, start at logical block size offset
-$here/src/aio-dio-regress/aiodio_sparse2 -i 2 -w $fs_block_size -s 64k -n $fs_block_size -o $logical_block_size "$TEST_DIR/aiodio_sparse"
+$AIO_TEST -i 2 -w $fs_block_size -s 64k -n $fs_block_size -o $logical_block_size "$TEST_DIR/aiodio_sparse"
 
 status=$?
 exit
index cab0b646a62a8f78c03e9ccec21844c9dbe90f44..bb3645fa516ca60803dbcff7bc25c4ae794fcc0b 100644 (file)
--- a/common.rc
+++ b/common.rc
@@ -864,6 +864,42 @@ _require_nonexternal()
        _notrun "External device testing in progress, skipped this test"
 }
 
+# this test requires that a (specified) aio-dio executable exists
+# $1 - command (optional)
+#
+_require_aiodio()
+{
+    if [ -z "$1" ]
+    then
+        AIO_TEST=src/aio-dio-regress/aiodio_sparse2
+        [ -x $AIO_TEST ] || _notrun "aio-dio utilities required"
+    else
+        AIO_TEST=src/aio-dio-regress/$1
+        [ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
+    fi
+}
+
+# run an aio-dio program
+# $1 - command
+_run_aiodio()
+{
+    if [ -z "$1" ]
+    then
+        echo "usage: _run_aiodio command_name" 2>&1
+        status=1; exit 1
+    fi
+
+    _require_aiodio $1
+
+    local testtemp=$TEST_DIR/aio-testfile
+    rm -f $testtemp
+    $AIO_TEST $testtemp 2>&1
+    status=$?
+    rm -f $testtemp
+
+    return $status
+}
+
 # indicate whether YP/NIS is active or not
 #
 _yp_active()