From: Jiri Pirko <jiri(a)mellanox.com>
This is very dump test module. All it knows to do is to get option named
"fail" and according to the value, it either fails or passes. Also, it
takes all options user passed to this test module and pushes them into
result data.
Purpose of this test module is to be used from python tasks, providing
possibility to do "embedded" tests directly inside python tasks.
Signed-off-by: Jiri Pirko <jiri(a)mellanox.com>
---
v2->v3:
- no change
v1->v2:
- whitespace issue fixed
---
test_modules/Custom.py | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 test_modules/Custom.py
diff --git a/test_modules/Custom.py b/test_modules/Custom.py
new file mode 100644
index 0000000..ac3c742
--- /dev/null
+++ b/test_modules/Custom.py
@@ -0,0 +1,31 @@
+"""
+This module defines custom test
+
+Copyright 2016 Mellanox Technologies. All rights reserved.
+Licensed under the GNU General Public License, version 2 as
+published by the Free Software Foundation; see COPYING for details.
+"""
+
+__author__ = """
+jiri(a)mellanox.com (Jiri Pirko)
+"""
+
+from lnst.Common.TestsCommon import TestGeneric
+from lnst.Common.Utils import bool_it
+
+class Custom(TestGeneric):
+ def run(self):
+ fail_str = self.get_opt("fail")
+ if not fail_str:
+ fail = False
+ else:
+ fail = bool_it(fail_str)
+
+ res_data = self.get_single_opts()
+ if "fail" in res_data:
+ del(res_data["fail"])
+
+ if fail:
+ return self.set_fail(res_data)
+
+ return self.set_pass(res_data)
--
2.4.3