From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?THVrw6HFoSBEb2t0b3I=?= Subject: Re: [KVM_AUTOTEST][RFC] pre_command chaining Date: Mon, 13 Jul 2009 09:40:58 +0200 Message-ID: <4A5AE50A.2090400@redhat.com> References: <2062114795.286811247239674709.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: KVM list To: Michael Goldish Return-path: Received: from mx2.redhat.com ([66.187.237.31]:55300 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752773AbZGMHlA (ORCPT ); Mon, 13 Jul 2009 03:41:00 -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 n6D7f0jL010187 for ; Mon, 13 Jul 2009 03:41:00 -0400 In-Reply-To: <2062114795.286811247239674709.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi Michael, you are right, it is possible. But if I specify "pre_command =3D true" = at=20 the top of my config file, this command will be executed even if no=20 additional command is added into the queue. (tests with pre_commands ar= e=20 not selected) That is my reason why I'd like to see this two lines change into the=20 framework. Still you are right that it's basically a "cosmetic" modification for=20 simplification the config file. Dne 10.7.2009 17:27, Michael Goldish napsal(a): > ----- "Luk=C3=A1=C5=A1 Doktor" wrote: > >> Hi, >> >> the way how kvm_autotest currently handle pre_command/post_command i= t >> don't allow to specify more than one command. BASH can handle this >> itself with a small change in the framework , as shown in the >> attachment. > > Why do you say the framework doesn't allow chaining pre_commands? > What's wrong with: > pre_command =3D "command0" > pre_command +=3D "&& command1" > pre_command +=3D "&& command2" > >> In .cfg file we just change variable from: >> pre_command =3D "command" >> to: >> pre_commane +=3D "command&&" >> produce: >> $(command&& true) >> >> Framework adds the last command true, which enclose whole command. >> This >> way we can chain infinite pre/post_commands without losing the retur= n >> >> value (if something go wrong, other commands are not executed and >> return >> value is preserve. >> >> example: >> in cfg: >> pre_command +=3D "echo A&&" >> pre_command +=3D "echo B&&" >> pre_command +=3D "echo C&&" >> framework params.get("pre_command"): >> "echo A&& echo B&& echo C&&" >> framework process_command execute on the host: >> "echo A&& echo B&& echo C&& true" >> >> regards, >> Luk=C3=A1=C5=A1 Doktor > > In any case, the proposed solution does not allow the user to use > pre_command in the most straightforward way: > pre_command =3D "command" > because that would get translated into: > "command true" > So the user must append&& to the command, which makes little sense. > > There could be other solutions, like > > 1. Specifying "pre_command =3D true" at the top of the config file, a= nd > then using: > pre_command +=3D "&& command0" > pre_command +=3D "&& command1" > > "pre_command =3D command" will also work fine in this case. > > 2. Removing the final "&&" from the command, if any, so that if the > user enters: > pre_command =3D "command0&&" > pre_command +=3D "command1&&" > the framework will run: > "command0&& command1" instead of "command0&& command1&&". > > In any case, can you provide an example where it's impossible or > difficult to do command chaining without changing the framework? > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html