Signed-off-by: Konrad Rzeszutek Wilk <konrad.w...@oracle.com Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com> --- v4: Split off from the patch introducing target_cmd_output_root_status. Rewrote all the comments to be true. --- Osstest/TestSupport.pm | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index c36dc76..f54962a 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -692,8 +692,18 @@ sub tcmd { # $tcmd will be put between '' but not escaped 'ssh', sshopts(), @{ $extrasshopts || [] }, sshuho($user,$ho), $tcmd); } + +# target_cmd[_VARIANT]($ho, $cmd, [ $timeout, \@EXTRASSHOPTS ]); +# +# target_cmd executes $cmd with the shell as the osstest user on $ho. +# stdout goes to our own stdout. dies if the command exits nonzero. sub target_cmd ($$;$$) { tcmd(undef,undef,0, 'osstest',@_); } + +# Like target_cmd but as root. sub target_cmd_root ($$;$$) { tcmd(undef,undef,0, 'root',@_); } + +# Like target_cmd_root, but does not die if the command fails. +# Instead, returns the wait status (ie, what came in $?) sub target_cmd_root_status ($$;$$) { tcmd(undef,undef,1, 'root',@_); } sub tcmdout { @@ -708,6 +718,7 @@ sub tcmdout { return $r; } +# Like target_cmd[_root], but collect the stdout and return it as a string. sub target_cmd_output ($$;$) { tcmdout('osstest',@_); } sub target_cmd_output_root ($$;$) { tcmdout('root',@_); } -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel