From patchwork Tue May 12 19:33:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 186569 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp239067ilb; Tue, 12 May 2020 12:35:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPi6z49KBkj1G3bDSkngh3jpBruOF8rtvI5/rP2CQ70gTKTJFuJxlYjMMZiG7xWQJ/FUCx X-Received: by 2002:ac8:7413:: with SMTP id p19mr6284843qtq.282.1589312118893; Tue, 12 May 2020 12:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589312118; cv=none; d=google.com; s=arc-20160816; b=WBNLksnM8CfCkaBseg9JIb3HJ/FcGhg/wu4XG9M7vJoksK5Ss3Srx6cdhGkBMXsBFs cHeMw0qpoLt5NCCiiBJu7fJY8TRtqQqNRB72B8JKRMIxbyZ18aIQSQxnL8HCCxvGaN31 BhiBzbTE3OLNojdK1p7DzM25GQiuGkZ1rZh8babkf/GaY20CpOd/ebWn1fnU3mDqnuGV QI8Unkhqy3tpPnYt9TgX7burbCi/G6cp3/dOKn5QKNoQBhMq/F5pmseQCY0TI4DmUH9Q mxgDli5GoMS0dyKD7mxK7o34DliZhuJ6KesroI1Clnv7eacqZ/YHxfIy/haYWNvCBKVk yRFw== 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=BTKcYeUaFGhya1RL8BEXIQFfl5d3zBX2OKJUpLkqnTc=; b=xwJggh7Gb/1VYLOWtEGUqLv9O+ESplsohFp1+QLYluRxr6hsVpeFoQY5WzsoHK3BjB 0H5QQUR9ZC4MN65p8RLOWxyhHoJ8HwTHv6A7nh7jUfOh/IFGhO4W5iJEhqfHUvEpdQGB +/t/Z6ZOGy3ysmPBlpYcSw5KA7+Jxd8oaRqbA2I3Qjs/gw4DWRK0RE3qHUqgZ3GVrnDC WqxBODPC1Or47enkCHqDgHulRBMfRdtxBDk0itV5tXY6B28e3j8J966KycQpxNfZTt9g 1qPK2j1epuhFSoFnZ4xqjXzTDu5N7CVYsONX99MM/Og2DNhD75LziogdXQrk+FhQoBr1 sjow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NjpZiQRd; 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 l35si7970768qtl.26.2020.05.12.12.35.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 May 2020 12:35:18 -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=NjpZiQRd; 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]:40368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYagQ-0001Mt-B8 for patch@linaro.org; Tue, 12 May 2020 15:35:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYaen-0000NX-Cn for qemu-devel@nongnu.org; Tue, 12 May 2020 15:33:37 -0400 Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]:41619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYael-0001rZ-DJ for qemu-devel@nongnu.org; Tue, 12 May 2020 15:33:37 -0400 Received: by mail-qk1-x734.google.com with SMTP id n14so14913960qke.8 for ; Tue, 12 May 2020 12:33:35 -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=BTKcYeUaFGhya1RL8BEXIQFfl5d3zBX2OKJUpLkqnTc=; b=NjpZiQRdMt5gv9uZV8Bp/WU1fBG4c49Q8pvOU3hZnfF3+Y3n1hwa7QH5FE/yoAmwtG b3rEG3iNb7Ulf7w0bzVzYq11OYLcOwa+s9qca2o16VD2mGjS7RMVwFrT6i01Od7AFMm1 K8lJtEAMUR5cdnXxHdm2qYpROog9gTVfyMZUUbeqPs686y4hGnqkpVtKIrOnv07ZkzsE c1Rn42BYaTRw2NlXxNULFnF/h+fciYAXXDxRU7e+TcGdD5Ze+/SoXrfjSPcyZk1gmRlo NJuZpY7VTLRfMCOsVPjDPonZNoORb/RPEWgMuzDuqCIAOH/dtgFIKID+oESQLPZWFAOV cmAg== 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=BTKcYeUaFGhya1RL8BEXIQFfl5d3zBX2OKJUpLkqnTc=; b=HWDNrDRgI+mj1TkMK+OPCvJW3Td/6feg8pKSx1TiuMbCaohyLHoKVB6fStyHlklOD2 D0vFq+5tm3aVE4hhdhOo9sOkfQJwn9amzmURP61/ewlQREq+Eny6PMulD9RhiPt/r/VF 7VymdTpM8AFO75mJIB23LTUcPTwFsycTIF13FBKGsCFTm5DpTlO2CAOdQmjRMvBb0pdM o0pbzwfjEhq+l8uAaOGzjiHFWNhEGT1KU9MLzusApYZ5p6cTYoxIi/OI5qtf2VDbowz6 DLKL3hZ+wsq74FZs4raCWs4utiY2lgGVadHza1yxsM0rcvyfrJuXTnTOFGi1cRsV/xcP xlWQ== X-Gm-Message-State: AGi0PubFgdxwlPSuMLyfllPRXNOcfRlUmfOB5F1FuICITX94T1236V0I j+Kcu7BFquIQg2K6KQICZ/mk1LbYCliN6w== X-Received: by 2002:a37:b185:: with SMTP id a127mr21996182qkf.87.1589312014195; Tue, 12 May 2020 12:33:34 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:d31:9f53:b3eb:9b53]) by smtp.gmail.com with ESMTPSA id j45sm2100998qtk.14.2020.05.12.12.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2020 12:33:33 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v6 5/9] tests/vm: allow wait_ssh() to specify command Date: Tue, 12 May 2020 15:33:36 -0400 Message-Id: <20200512193340.265-6-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200512193340.265-1-robert.foley@linaro.org> References: <20200512193340.265-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::734; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x734.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 1cb104c402..4fa1ea8fde 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):