xfstests: add aiodio helper functions
PATCH 1/1 xfstests: add aiodio helper functions
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 <[email protected]>
--- 198 | 3 ++- 207 | 7 +------ 208 | 7 +------ 209 | 7 +------ 210 | 7 +------ 211 | 7 +------ 212 | 7 +------ 239 | 4 +--- 240 | 3 ++- common.rc | 36 ++++++++++++++++++++++++++++++++++++ 10 files changed, 47 insertions(+), 41 deletions(-)
198 +2 -1
@@ -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
207 +1 -6
@@ -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
208 +1 -6
@@ -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
209 +1 -6
@@ -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
210 +1 -6
@@ -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
211 +1 -6
@@ -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
212 +1 -6
@@ -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
239 +1 -3
@@ -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"
240 +2 -1
@@ -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
common.rc +36 -0
@@ -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()
Signature · 7 lines
1.7.7.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs