Re: [PATCH][KVM_AUTOTEST] Added functionality to the preprocessor to run scripts

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

 



David Huff wrote:
This patch will run pre and post scripts
defined in config file with the parameter pre_command
and post_command post_command.

Also exports all the prameters in preprocess for passing
arguments to the script.
+ #execute any pre_commands
+    pre_command = params.get("pre_command")
+    if pre_command:
+        # export environment vars
+        for k in params.keys():
+            kvm_log.info("Adding KVM_TEST_%s to Environment" % (k))
+            os.putenv("KVM_TEST_%s" % (k), str(params[k]))
+        # execute command
+        kvm_log.info("Executing command '%s'..." % pre_command)
+        timeout = int(params.get("pre_commmand_timeout", "600"))
+        (status, pid, output) = kvm_utils.run_bg("cd %s; %s" % (test.bindir, pre_command),
+                                                 None, kvm_log.debug, "(pre_command) ", timeout=timeout)
+        if status != 0:
+            kvm_utils.safe_kill(pid, signal.SIGTERM)
+            raise error.TestError, "Custom processing pre_command failed"

kvm_utils.run_bg should throw an exception instead of returning status.

But if status != 0, will there actually be a pid to kill?

--
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