Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions common/rc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,30 @@ _have_driver()
return 0
}

# Check that the specified crypto algorithm is present, regardless of
# whether it's build-in, a module, or provided by the kernel.
# The module will be loaded if it is loadable, and unloaded at test case end.
_have_crypto()
{
local modname="${1//-/_}"

if [ -d "/sys/module/${modname}" ]; then
return 0
fi

if ! modprobe -q "${modname}"; then
if ! grep -q "${modname}" /proc/crypto; then
SKIP_REASONS+=("driver ${modname} is not available")
return 1
fi
return 0
fi

MODULES_TO_UNLOAD+=("${modname}")

return 0
}

# Check that the specified module is available as a loadable module and not
# built-in the kernel.
_have_module() {
Expand Down
2 changes: 1 addition & 1 deletion tests/nvme/043
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requires() {
_require_kernel_nvme_fabrics_feature dhchap_ctrl_secret
_require_nvme_trtype_is_fabrics
_require_nvme_cli_auth
_have_driver dh_generic
_have_crypto dh_generic
}

set_conditions() {
Expand Down
2 changes: 1 addition & 1 deletion tests/nvme/044
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requires() {
_require_kernel_nvme_fabrics_feature dhchap_ctrl_secret
_require_nvme_trtype_is_fabrics
_require_nvme_cli_auth
_have_driver dh_generic
_have_crypto dh_generic
}

set_conditions() {
Expand Down
2 changes: 1 addition & 1 deletion tests/nvme/045
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ requires() {
_require_kernel_nvme_fabrics_feature dhchap_ctrl_secret
_require_nvme_trtype_is_fabrics
_require_nvme_cli_auth
_have_driver dh_generic
_have_crypto dh_generic
}

set_conditions() {
Expand Down