From patchwork Tue May 19 13:22:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 186942 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp3852960ilb; Tue, 19 May 2020 06:33:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBzK1ZTt94xz3r/lJLesZvAVwXN//2dYBxmzxfWaIKPFmkF7DZsbROgK2QbNR9XaCDaKgt X-Received: by 2002:a37:27d8:: with SMTP id n207mr21666755qkn.40.1589895196864; Tue, 19 May 2020 06:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589895196; cv=none; d=google.com; s=arc-20160816; b=u5+kwoSD/ZxSkYgIbcuTftDuNZnDuHFgmlxRpP+XgUrRfvUnITLeEC79fSYE5zui4a KepK67exPN52B/tqqhRFPoRHZ4t+QmKTHrRcvt+apdBvpoRQRGsVpXh3AFIYPqjH1CwX LbtKN8caI6vFv6ewr7pFs89/CZxXFAZwZac92tRLKCIGNHqPvQQf60SERIBF30a0t6YE qpfD3I3dz1tVm/i9l8Neo56QvNMKMYR+AsqfFAz8yS/okGPKkwynhKum1VVIkZWA0ngF krU+e8Tdt0xhqiHT7zcfJ2bvTbapeUDCVrkVxy8/KyhB61bhlln4bM+///qXFa6MrF68 5ZVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5HieQNcS49Ddl5x13c1tlfdvYUU3jAT4qZ90zyOAgeo=; b=1JeEgHub5n0cCqou/kUfWtfnZrORWjafCh+qP+QWr25Y2Bm7wJmS2re3eVbrlurtQX UdPPjpNN1ylJ3PChftR44KxVbvR2QtQTD4Eg82h1zOYvlhnDfkt3+ap5BT2VeMvG6aSd 8504NXCSbE/dnM55TVtWFtmcQ057yvfrXtUXFsBRpxI+bdDQsxFoNpjdmM6ECJoTLtMv b3PDyEXRm7sQT843KXaCmh7MVlqJ2jWanH5f+Kz08Sx9V11BcFFHL4t5pczQYqe/+Yi8 pxZwlnSDgAgPH4zNJiPQb8TwZkpHins+L37AQZ8apfGaUWMqV5fp+YMIWAkC4KP4x7PU t65A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gGDlxSp2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c202si7195660qkb.271.2020.05.19.06.33.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 May 2020 06:33:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gGDlxSp2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jb2Mu-0007Be-De for patch@linaro.org; Tue, 19 May 2020 09:33:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jb2Gs-0005Ct-0v for qemu-devel@nongnu.org; Tue, 19 May 2020 09:27:02 -0400 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:39964) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jb2Gr-0008N2-32 for qemu-devel@nongnu.org; Tue, 19 May 2020 09:27:01 -0400 Received: by mail-qk1-x72f.google.com with SMTP id g185so14929224qke.7 for ; Tue, 19 May 2020 06:27:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5HieQNcS49Ddl5x13c1tlfdvYUU3jAT4qZ90zyOAgeo=; b=gGDlxSp2v75NrIPWM5D3XVLcOukIGQXHq7jfkPYa/r5m/dFii5nx9AA5MNV+d+oibK C5P+3TQs7SAxy77yabNMjmIS957d/52IcjbqMik7KdZunAspp3PXMMhao3sOvWjGXmrP Q5TwozpjXYIqM43wozOdjFTGNEFC2ivU6V1zxUJw9NH0q7uVxUkqCt+tJIIYxe2B9wad xtc9ZQYz+HJGWm9buC87hNu4fPNk1vpbzbGlzoJMBUml6xrLpcBCSQIB0jZUpzf+Yksb FwPUjsC6MuvNiCssYSMGeWrV3cP7CgaUUQtVltovYJfyhIWnmxTFe0bczpAh23bspE66 ux+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5HieQNcS49Ddl5x13c1tlfdvYUU3jAT4qZ90zyOAgeo=; b=HWyDOHdRqAq23EcaXdmX5MZePxw88xdxgq3LxwlMKOb4CjX3/TuntTB0qjsv64qiVN GtWPOp09wEbr/A8SP6KFCYBP86elAjPCB7DqrDNKdpdIB9RcUBuas5Udq951ko60kslH eVZn4Cw43OQBo4l7tB8Z3JJJVEKLCV/oDhPTRWBQR3yomFaLF8zbJ/LqE6PaLbSB+EDd qMZ8X+EtXW04AvbT/8xwat2H6Bc/hBoQP9bxKdSwzezalWwyn47/S0FGQOlyJ7PrKb/A iU36nv+POd/xsEZ8AFdLvt3eu/+LHM07r6fL1S/KoDNNgJwpLiN92hCtP55DKmwJwp0g zfow== X-Gm-Message-State: AOAM530t0JX5vaWbPIUIAFsLxZ1m6jS1W0BfG2k0XmukhgThqglcSrPO 5RSd1u1X6Sbhd+tNx+MLYRQom/vgdYWocA== X-Received: by 2002:a05:620a:319:: with SMTP id s25mr20266873qkm.25.1589894819866; Tue, 19 May 2020 06:26:59 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:dd6a:8c63:cd9d:ad15]) by smtp.gmail.com with ESMTPSA id d74sm3482136qke.100.2020.05.19.06.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:26:59 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v7 08/12] tests/vm: allow wait_ssh() to specify command Date: Tue, 19 May 2020 09:22:55 -0400 Message-Id: <20200519132259.405-9-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200519132259.405-1-robert.foley@linaro.org> References: <20200519132259.405-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72f; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x72f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: philmd@redhat.com, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This allows for waiting for completion of arbitrary commands. Signed-off-by: Robert Foley Reviewed-by: Peter Puhov Reviewed-by: Alex Bennée --- tests/vm/basevm.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index d717b967ca..b610581d1b 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -409,24 +409,24 @@ class BaseVM(object): def print_step(self, text): sys.stderr.write("### %s ...\n" % text) - def wait_ssh(self, wait_root=False, seconds=300): + def wait_ssh(self, wait_root=False, seconds=300, cmd="exit 0"): # Allow more time for VM to boot under TCG. if not kvm_available(self.arch): seconds *= self.tcg_ssh_timeout_multiplier starttime = datetime.datetime.now() endtime = starttime + datetime.timedelta(seconds=seconds) - guest_up = False + cmd_success = False while datetime.datetime.now() < endtime: - if wait_root and self.ssh_root("exit 0") == 0: - guest_up = True + if wait_root and self.ssh_root(cmd) == 0: + cmd_success = True break - elif self.ssh("exit 0") == 0: - guest_up = True + elif self.ssh(cmd) == 0: + cmd_success = True break seconds = (endtime - datetime.datetime.now()).total_seconds() logging.debug("%ds before timeout", seconds) time.sleep(1) - if not guest_up: + if not cmd_success: raise Exception("Timeout while waiting for guest ssh") def shutdown(self):