Re: [PATCH][KVM-AUTOTEST] Check exit status of custom install script and fail if script failed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike Burns wrote:
Signed-off-by: Mike Burns <mburns@xxxxxxxxxx>
---
 client/tests/kvm_runtest_2/kvm_install.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm_runtest_2/kvm_install.py b/client/tests/kvm_runtest_2/kvm_install.py
index ebd8b7d..392ef0c 100755
--- a/client/tests/kvm_runtest_2/kvm_install.py
+++ b/client/tests/kvm_runtest_2/kvm_install.py
@@ -90,7 +90,12 @@ def run_kvm_install(test, params, env):
 	  kvm_log.info("Adding KVM_INSTALL_%s to Environment" % (k))
           os.putenv("KVM_INSTALL_%s" % (k), str(params[k]))
 	kvm_log.info("Running " + script + " to install kvm")
-        os.system("cd %s; %s" % (test.bindir, script))
+        install_result = os.system("cd %s; %s" % (test.bindir, script))
+	if os.WEXITSTATUS(install_result) != 0:
+          message = "Custom Script encountered an error"
+          kvm_log.error(message)
+          raise error.TestError, message
+

How about a helper that does os.system() (or rather, commands.getstatusoutput()) and throws an exception on failure? I imagine it could be used in many places.

Oh and "Custom script encountered an error" is unfriendly. Mention the command line and the actual output.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux