summaryrefslogtreecommitdiffstats
path: root/libs/utils/atfutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'libs/utils/atfutils.py')
-rw-r--r--libs/utils/atfutils.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/libs/utils/atfutils.py b/libs/utils/atfutils.py
index 86b2484..b19ef38 100644
--- a/libs/utils/atfutils.py
+++ b/libs/utils/atfutils.py
@@ -43,6 +43,35 @@ def expect(actual_string, expected_string):
return matched
+def validate_output(output, expected_exit_status, expected_output):
+ """
+ Parameters:
+ output: This is dictionary which is return value of
+ executecommand(ssh module)
+
+ expected_exit_status: exit_status we are expecting
+
+ expected_output : output expected from the execution of command
+
+ Returns:
+ True: if output we got from the command execution matches with
+ expected_exit_status and expected_output is
+
+ False: if output doesn't match with expected_exit_status or
+ expected_output
+ """
+ if expected_exit_status is not 0:
+ exit_status = assert_failure(**output)
+ else:
+ exit_status = assert_success(**output)
+
+ output_status = expect(str(output['stdoutdata']),
+ expected_output)
+ if output_status is True and (not exit_status):
+ return 0
+ else:
+ return 1
+
def print_stdout(stdoutdata):
"""
"""