fstests: skip AIO-related tests when CONFIG_AIO=n

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/).

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Eric Biggers
2017-05-18 15:49:10 -07:00
committed by Eryu Guan
parent aaf96798d8
commit 9000551d9b
7 changed files with 62 additions and 7 deletions
+18
View File
@@ -1868,7 +1868,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()
@@ -1881,6 +1898,7 @@ _require_aiodio()
AIO_TEST=src/aio-dio-regress/$1
[ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
fi
_require_aio
_require_odirect
}