We have currently two test modules that have dependency on a test_tool,
TCPConnection and Multicast which are wrappers around tcp_conn and
multicast test tools.
Reduced synchronization feature introduced a dependency bug. Since the
test module used in an lnst recipe does not have any information about
required test tool such tool will not be synchronized to lnst slave and
will end with an Exception like this:
Exception: CommandException: Tools 'tcp_conn' not found
The patch is introducing the required_tools variable that has to be
specified in a test module source file that will use such test tool
using exec_from() method.
The variable contains a list of strings describing dependant test tools.
<example>
required_tools = ["tcp_conn"]
class TCPConnection(TestGeneric):
def run(self):
self.exec_from("tcp_conn", "./tcp_listen -x -y -z")
</example>
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Controller/NetTestController.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 400cd19..fdfe470 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -246,6 +246,21 @@ class NetTestController:
msg = "Module '%s' not found on the
controller"\
% mod
raise RecipeError(msg, cmd)
+
+ # check deps of test module
+ mod_path =
self._resource_table['module'][mod]['path']
+ mod_src = imp.load_source(mod, mod_path)
+ try:
+ req_tools = getattr(mod_src, "required_tools")
+ except AttributeError:
+ # test module does not have any dependencies
+ req_tools = []
+ except:
+ raise
+
+ for tool in req_tools:
+ sync_table['tools'][tool] =
res_table['tools'][tool]
+
if cmd['type'] == 'exec' and 'from' in cmd:
tool = cmd['from']
if tool in res_table['tools']:
--
1.8.1.4