fence-agents: master - testing: Add verbose mode to testing library

Marek GrĂ¡c marx at fedoraproject.org
Mon Feb 11 18:09:57 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=f0969886c13feae734547d4cb9241f9f6eae0d9f
Commit:        f0969886c13feae734547d4cb9241f9f6eae0d9f
Parent:        81dfafdf982309ded440c1806c28da82aff49ba0
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Mon Feb 11 15:46:49 2013 +0100
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Mon Feb 11 15:46:49 2013 +0100

testing: Add verbose mode to testing library

---
 tests/fence_testing.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/fence_testing.py b/tests/fence_testing.py
index 566872e..166eaf8 100755
--- a/tests/fence_testing.py
+++ b/tests/fence_testing.py
@@ -55,7 +55,7 @@ def _prepare_command(agent_file, method):
 
 	return (final_command, stdin_values)		
 
-def test_action(agent, action_file, method):
+def test_action(agent, action_file, method, verbose = False):
 	""" Run defined sequence of actions on a given fence agent.
 
 	This function will run one set of test on a fence agent. Test itself consists of
@@ -110,7 +110,11 @@ def test_action(agent, action_file, method):
 		if method == "stdin" and sleep_wait == None:
 			current_command = "/bin/echo -e \"" + current_stdin_options + "\" | " + current_command
 
-		result = os.system(current_command + " &> /dev/null")
+		if verbose == False:
+			result = os.system(current_command + " &> /dev/null")
+		else:
+			print current_command
+			result = os.system(current_command)
 		exitcode = (result >> 8) & 0xFF
 
 		is_valid_result_code = re.search(action["return_code"], str(exitcode), re.IGNORECASE)


More information about the cluster-commits mailing list