Skip to contentSkip to conversation

xfstests: skip AIO-related tests when CONFIG_AIO=n

PATCH New Eric Biggers 1 participant 1 message May 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: skip AIO-related tests when CONFIG_AIO=n

From: Eric Biggers <[email protected]>

When running xfstests on a kernel configured with CONFIG_AIO=n, all AIO-related tests fail, often due to an error similar to the following:

error Function not implemented during io_setup

This affected at least the following tests: generic/036, generic/112, generic/113, generic/198, generic/207, generic/208, generic/210, generic/211, generic/239, generic/323, generic/427, xfs/240, xfs/241.

Fix this by enhancing the 'feature' program to allow testing for asynchronous I/O support, then skipping all AIO-related tests when AIO is unsupported.

This change is useful because CONFIG_AIO is sometimes disabled to reduce the kernel's attack surface (e.g. see
https://android-review.googlesource.com/#/c/292158/).

---
 common/rc         | 18 ++++++++++++++++++
 src/Makefile      |  1 +
 src/feature.c     | 42 +++++++++++++++++++++++++++++++++++++++---
 tests/generic/112 |  1 +
 tests/generic/113 |  1 +
 tests/xfs/240     |  3 +--
 tests/xfs/241     |  3 +--
 7 files changed, 62 insertions(+), 7 deletions(-)
common/rc +18 -0
index ee4902b6..a6ce6ca0 100644
@@ -1886,7 +1886,24 @@ _require_nonexternal()
 	_notrun "External device testing in progress, skipped this test"
 }
 
+# this test requires that the kernel supports asynchronous I/O
+_require_aio()
+{
+	$here/src/feature -A
+	case $? in
+	0)
+		;;
+	1)
+		_notrun "kernel does not support asynchronous I/O"
+		;;
+	*)
+		_fail "unexpected error testing for asynchronous I/O support"
+		;;
+	esac
+}
+
 # this test requires that a (specified) aio-dio executable exists
+# and that the kernel supports asynchronous I/O.
 # $1 - command (optional)
 #
 _require_aiodio()
@@ -1899,6 +1916,7 @@ _require_aiodio()
         AIO_TEST=src/aio-dio-regress/$1
         [ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
     fi
+    _require_aio
     _require_odirect
 }
 
src/Makefile +1 -0
index e5042c9b..940c2694 100644
@@ -59,6 +59,7 @@ endif
 
 ifeq ($(HAVE_AIO), true)
 SUBDIRS += aio-dio-regress
+LLDLIBS += -laio
 endif
 
 ifeq ($(HAVE_SSL), true)
src/feature.c +39 -3

89 lines not on this page · raw message

tests/generic/112 +1 -0
index 55be3948..0ab1c8c8 100755
@@ -122,6 +122,7 @@ _process_args()
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_aio
 
 [ -x $here/ltp/aio-stress ] || \
 	_notrun "fsx not built with AIO for this platform"
tests/generic/113 +1 -0
index 54d61918..7e20d684 100755
@@ -77,6 +77,7 @@ _do_test()
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_aio
 _require_odirect
 
 [ -x $here/ltp/aio-stress ] || _notrun "aio-stress not built for this platform"
tests/xfs/240 +1 -2
index 62a7735b..fa0edc77 100755
@@ -49,9 +49,8 @@ _require_scratch_reflink
 _require_cp_reflink
 _require_dm_target error
 _require_xfs_io_command "cowextsize"
-_require_test_program "aio-dio-regress/aiocp"
+_require_aiodio "aiocp"
 AIO_TEST="src/aio-dio-regress/aiocp"
-_require_odirect
 
 rm -f $seqres.full
 
tests/xfs/241 +1 -2
index 5b29f4d1..b3096732 100755
@@ -46,9 +46,8 @@ _supported_fs xfs
 _require_scratch_reflink
 _require_cp_reflink
 _require_xfs_io_command "cowextsize"
-_require_test_program "aio-dio-regress/aiocp"
+_require_aiodio "aiocp"
 AIO_TEST="src/aio-dio-regress/aiocp"
-_require_odirect
 
 rm -f $seqres.full
 
Signature · 1 line
2.13.0.303.g4ebf302169-goog