From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH][KVM_AUTOTEST] Added functionality to the preprocessor to run scripts Date: Sun, 31 May 2009 14:23:19 +0300 Message-ID: <4A2268A7.6090807@redhat.com> References: <4A1C13C6.4020603@redhat.com> <1243372101-11455-1-git-send-email-dhuff@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: David Huff Return-path: Received: from mx2.redhat.com ([66.187.237.31]:45031 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754491AbZEaLXT (ORCPT ); Sun, 31 May 2009 07:23:19 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n4VBNM0T012055 for ; Sun, 31 May 2009 07:23:22 -0400 In-Reply-To: <1243372101-11455-1-git-send-email-dhuff@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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