To use in the 'check' script in the following commit, move the helper function _unload_module() from 'common/rc' to 'check'. Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> --- check | 13 +++++++++++++ common/rc | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/check b/check index 85e0569..5f57386 100755 --- a/check +++ b/check @@ -439,6 +439,19 @@ _test_dev_is_zoned() { $(cat "${TEST_DEV_SYSFS}/queue/zoned") != none ]] } +# Arguments: module to unload ($1) and retry count ($2). +_unload_module() { + local i m=$1 rc=${2:-1} + + [ ! -e "/sys/module/$m" ] && return 0 + for ((i=rc;i>0;i--)); do + modprobe -r "$m" + [ ! -e "/sys/module/$m" ] && return 0 + sleep .1 + done + return 1 +} + _run_test() { TEST_NAME="$1" CAN_BE_ZONED=0 diff --git a/common/rc b/common/rc index 738a32f..9bc0dbc 100644 --- a/common/rc +++ b/common/rc @@ -384,19 +384,6 @@ _uptime_s() { awk '{ print int($1) }' /proc/uptime } -# Arguments: module to unload ($1) and retry count ($2). -_unload_module() { - local i m=$1 rc=${2:-1} - - [ ! -e "/sys/module/$m" ] && return 0 - for ((i=rc;i>0;i--)); do - modprobe -r "$m" - [ ! -e "/sys/module/$m" ] && return 0 - sleep .1 - done - return 1 -} - _have_writeable_kmsg() { if [[ ! -w /dev/kmsg ]]; then SKIP_REASONS+=("cannot write to /dev/kmsg") -- 2.37.1