From patchwork Mon Jun 17 04:38:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 10997953 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E015C1398 for ; Mon, 17 Jun 2019 04:41:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0B992880C for ; Mon, 17 Jun 2019 04:41:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4A1028814; Mon, 17 Jun 2019 04:41:15 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C36EB2880C for ; Mon, 17 Jun 2019 04:41:14 +0000 (UTC) Received: from localhost ([::1]:44206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcjSE-0003Pg-76 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 17 Jun 2019 00:41:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60172) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcjQE-0001P7-Pw for qemu-devel@nongnu.org; Mon, 17 Jun 2019 00:39:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcjQC-0005rt-8H for qemu-devel@nongnu.org; Mon, 17 Jun 2019 00:39:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58866) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hcjQB-0005oH-Dd for qemu-devel@nongnu.org; Mon, 17 Jun 2019 00:39:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA90D3162900; Mon, 17 Jun 2019 04:39:04 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-33.ams2.redhat.com [10.36.116.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id C05FB82A11; Mon, 17 Jun 2019 04:38:59 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E99BF16E1A; Mon, 17 Jun 2019 06:38:58 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 17 Jun 2019 06:38:49 +0200 Message-Id: <20190617043858.8290-3-kraxel@redhat.com> In-Reply-To: <20190617043858.8290-1-kraxel@redhat.com> References: <20190617043858.8290-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 17 Jun 2019 04:39:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 02/11] tests/vm: use ssh with pty unconditionally X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?utf-8?q?Ale?= =?utf-8?q?x_Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Allways ask ssh to run with a pseudo terminal. Not having a terminal causes problems now and then. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé --- tests/vm/basevm.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 5e30bac66154..395eefaec948 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -107,16 +107,14 @@ class BaseVM(object): os.rename(fname + ".download", fname) return fname - def _ssh_do(self, user, cmd, check, interactive=False): - ssh_cmd = ["ssh", "-q", + def _ssh_do(self, user, cmd, check): + ssh_cmd = ["ssh", "-q", "-t", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=" + os.devnull, "-o", "ConnectTimeout=1", "-p", self.ssh_port, "-i", self._ssh_key_file] for var in self.envvars: ssh_cmd += ['-o', "SendEnv=%s" % var ] - if interactive: - ssh_cmd += ['-t'] assert not isinstance(cmd, str) ssh_cmd += ["%s@127.0.0.1" % user] + list(cmd) logging.debug("ssh_cmd: %s", " ".join(ssh_cmd)) @@ -128,9 +126,6 @@ class BaseVM(object): def ssh(self, *cmd): return self._ssh_do(self.GUEST_USER, cmd, False) - def ssh_interactive(self, *cmd): - return self._ssh_do(self.GUEST_USER, cmd, False, True) - def ssh_root(self, *cmd): return self._ssh_do("root", cmd, False) @@ -284,9 +279,9 @@ def main(vmcls): return 2 if args.interactive: - if vm.ssh_interactive(*cmd) == 0: + if vm.ssh(*cmd) == 0: return 0 - vm.ssh_interactive() + vm.ssh() return 3 else: if vm.ssh(*cmd) != 0: