Which is similar to target_cmd_root_status except it outputs both return value _and_ output.
To make this work we expose the $backstatusok in tcmdout sub-routine and if set - return the value and output. Otherwise the old mechanism is used. Signed-off-by: Konrad Rzeszutek Wilk <konrad.w...@oracle.com> --- v2: New patch --- Osstest/TestSupport.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 0d105ee..2486320 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -51,7 +51,7 @@ BEGIN { get_runvar_default need_runvars unique_incrementing_runvar next_unique_name - target_cmd_root_status + target_cmd_root_status target_cmd_output_root_status target_cmd_root target_cmd target_cmd_build target_cmd_output_root target_cmd_output target_cmd_inputfh_root sshuho @@ -667,18 +667,21 @@ sub target_cmd_root_status ($$;$$) { tcmd(undef,undef,1, 'root',@_); } sub tcmdout { my $stdout= IO::File::new_tmpfile(); - tcmd(undef,$stdout,0,@_); + my $badstatusok = $_[1]; + my $rc = tcmd(undef,$stdout,@_); $stdout->seek(0,0) or die "$stdout $!"; my $r; { local ($/) = undef; $r= <$stdout>; } die "$stdout $!" if !defined $r or $stdout->error or !close $stdout; chomp($r); + return ($rc, $r) if $badstatusok; return $r; } -sub target_cmd_output ($$;$) { tcmdout('osstest',@_); } -sub target_cmd_output_root ($$;$) { tcmdout('root',@_); } +sub target_cmd_output ($$;$) { tcmdout(0, 'osstest',@_); } +sub target_cmd_output_root ($$;$) { tcmdout(0, 'root',@_); } +sub target_cmd_output_root_status ($$;$$) { tcmdout(1, 'root',@_); } sub target_cmd_inputfh_root ($$$;$$) { my ($tho,$stdinfh,$tcmd,@rest) = @_; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel