test/common: Check if igb_uio is loaded before removing it

igb_uio doesn't necessarily have to be loaded into the kernel as SDPK
still may be built with support for it but only particular set of
tests is actually using it. If such a condition is met then rmmod will
fail the entire test run since it always exits with != 0 if given
module is not found.

Avoid this by checking first if igb_uio is actually in use.

Change-Id: Ib97488797c657f810b588a0b427e578807ebe6c6
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/625
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Michal Berger 2020-02-06 16:26:58 +01:00 committed by Tomasz Zawadzki
parent f17e02a01b
commit a11aab73e8

View File

@ -1000,7 +1000,7 @@ function autotest_cleanup()
$rootdir/scripts/setup.sh cleanup
if [ $(uname -s) = "Linux" ]; then
if grep -q '#define SPDK_CONFIG_IGB_UIO_DRIVER 1' $rootdir/include/spdk/config.h; then
rmmod igb_uio
[[ -e /sys/module/igb_uio ]] && rmmod igb_uio
else
modprobe -r uio_pci_generic
fi