diff mbox

[OSSTEST,02/11] TestSupport: target_cmd_*: Add some doc comments

Message ID 1496857742-20191-3-git-send-email-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Jackson June 7, 2017, 5:48 p.m. UTC
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com
Signed-off-by: Ian Jackson <Ian.Jackson@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 mbox

Patch

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',@_); }