From patchwork Wed Jun 7 17:48:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 9772117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 57E456034B for ; Wed, 7 Jun 2017 17:52:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C2CA2843F for ; Wed, 7 Jun 2017 17:52:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 614F9284CF; Wed, 7 Jun 2017 17:52:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D9AD02843F for ; Wed, 7 Jun 2017 17:52:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIf5n-0002b7-JX; Wed, 07 Jun 2017 17:50:03 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIf5l-0002Gf-A8 for xen-devel@lists.xenproject.org; Wed, 07 Jun 2017 17:50:01 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id 36/8E-01730-8CC38395; Wed, 07 Jun 2017 17:50:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeJIrShJLcpLzFFi42JxWrohUve4jUW kwbVV1hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bpPw8ZC85zV0w8ldjAeJmzi5GTQ0LAX+J+ y0cmEJtNQFeiactfti5GDg4RARWJ23sNuhi5OJgFWhklTr74wQZSIwxUP3H5UjCbBaim+d46d hCbV8BT4vyOV8wQM+Ukzh//CWZzCnhJbH91HqxeCKhmz+d/YPOFBNQk5q6Ph2gVlDg58wkLiM 0sICFx8MUL5gmMvLOQpGYhSS1gZFrFqF6cWlSWWqRrpJdUlJmeUZKbmJmja2hgqpebWlycmJ6 ak5hUrJecn7uJERg2DECwg/H7H6dDjJIcTEqivA+kLSKF+JLyUyozEosz4otKc1KLDzHKcHAo SfAyA8NQSLAoNT21Ii0zBxjAMGkJDh4lEV5OkDRvcUFibnFmOkTqFKOilDjvNmughABIIqM0D 64NFjWXGGWlhHkZgQ4R4ilILcrNLEGVf8UozsGoJAwxniczrwRu+iugxUxAi/kumYAsLklESE k1MIaqCW1/u+6gnLq2fkEaP0f4JyPNHE3D0Ks8OVd8edfKdtS/lLy4+8ASx1XMBm9ULuXape9 hOfLz1Ls9ZluO/7qbW3Klnq39slxR6pn4v18aGtfUx3qbryrQk5e7e3uaXO3UlSxnNpdefqcU k7xVUiO8gLGcyTtmjkwK8/MqqeiLLT813Gf6KbEUZyQaajEXFScCAF7JA3SVAgAA X-Env-Sender: prvs=3243fba83=Ian.Jackson@citrix.com X-Msg-Ref: server-8.tower-206.messagelabs.com!1496857798!102188259!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3557 invoked from network); 7 Jun 2017 17:49:59 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-8.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 7 Jun 2017 17:49:59 -0000 X-IronPort-AV: E=Sophos;i="5.39,311,1493683200"; d="scan'208";a="426953394" From: Ian Jackson To: Date: Wed, 7 Jun 2017 18:48:53 +0100 Message-ID: <1496857742-20191-3-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1496857742-20191-1-git-send-email-ian.jackson@eu.citrix.com> References: <1496857742-20191-1-git-send-email-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Cc: Ian Jackson Subject: [Xen-devel] [OSSTEST PATCH 02/11] TestSupport: target_cmd_*: Add some doc comments X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Konrad Rzeszutek Wilk --- 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',@_); }