提交 7a692a80 编写于 作者: N Narasimhan V

Altered the way linux_modules checks loaded module

avocado/utils/linux_modules: module_is_loaded() was using
loaded_module_info() to check if a module is loaded or not,
which is a roundabout approach, and prints some unnecessary
information as well.
Made it to read /proc/modules to check this.
Signed-off-by: NNarasimhan V <sim@linux.vnet.ibm.com>
上级 535590a3
......@@ -26,6 +26,7 @@ import logging
import platform
from . import process
from . import genio
LOG = logging.getLogger('avocado.test')
......@@ -189,11 +190,14 @@ def module_is_loaded(module_name):
:param module_name: Name of module to search for
:type module_name: str
:return: True is module is loaded
:return: True if module is loaded
:rtype: bool
"""
module_name = module_name.replace('-', '_')
return bool(loaded_module_info(module_name))
for line in genio.read_file("/proc/modules").splitlines():
if line.split(None, 1)[0] == module_name:
return True
return False
def get_loaded_modules():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册