----- "Lukáš Doktor" <ldoktor@xxxxxxxxxx> wrote: > Hi, > > the way how kvm_autotest currently handle pre_command/post_command it > 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 = "command0" pre_command += " && command1" pre_command += " && command2" > In .cfg file we just change variable from: > pre_command = "command" > to: > pre_commane += "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 return > > value (if something go wrong, other commands are not executed and > return > value is preserve. > > example: > in cfg: > pre_command += "echo A &&" > pre_command += "echo B &&" > pre_command += "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áš Doktor In any case, the proposed solution does not allow the user to use pre_command in the most straightforward way: pre_command = "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 = true" at the top of the config file, and then using: pre_command += " && command0" pre_command += " && command1" "pre_command = 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 = "command0 &&" pre_command += "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@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html