From patchwork Tue May 12 19:33:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 186576 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp242542ilb; Tue, 12 May 2020 12:40:50 -0700 (PDT) X-Google-Smtp-Source: APiQypIBPFXzn5GQu30vksr2qvJRdkQ7xxcFrNu6jXrTw6x3wSRc4IkGP2DDqPVt4MROsNOzuj4W X-Received: by 2002:ac8:31ac:: with SMTP id h41mr23401075qte.139.1589312450041; Tue, 12 May 2020 12:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589312450; cv=none; d=google.com; s=arc-20160816; b=gqivN6Vj4wBektSM//WiPVqYwWrY53ffLloLBFUzflVsMN+dp4UawZlffDHU9nWGHR FWxKS9HxSkboBzOvKyhUiC1vo9aPjyav2IiiUzsIXV0BkIN1xdlQDVvntS8RKU/qwoOO qo9rL4PHHPhEc861nwAGhhAlXSi0v6Yjwl0MhbckFhI6aCWWGNwlc9PSgN95Hx83ExJW y4AZzyQdY6hNNvgA4JqOrvSpdLlHPnLWInuohuST9E2T/Jq0egBN+NFVHSR+MLsRSXDU kju8k14p6tIphBWkoG1Eu49XIchADlv3jrby8zoJN0/d6u00oC5U6ij+BJTmsYSIq6Tn RDwg== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=/s//tYI4BgCcobGdVgIcQsFlBmIupQaLWvMZYw32pNg=; b=m1CAk5j/RopxxCxASrIMdF6Y3dDLOHJpcfuk7dDt4LDK3roHHEk6UQgkgqIXcJLIpH /UUyykrhUNJZi4LD7OssWSywiUPsT7TYFc36sipiq+i640MisovWIAfuiowIOlYOFsL3 R19FkS2Is8hEmRCW0bTOHXE+Oj5HVRy9zf7KK5+zy8aNX5xkixbSqj5LsOxfTnjOmVmM BKZAiYA4LAHVYXieUFRQcmU+temvSUwdlEQCI0AV+Ub+ya+E8bQcb0q7ZJvq2o7WSJYq QlPRpyJIUngfc9SHSN2icniRYZr3ZZtrkVc19+DC6/dzOUoRDERcsm2jqwPfBmoIPSOx AAKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=M7k0kKaV; 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 n3si4117144qvk.54.2020.05.12.12.40.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 May 2020 12:40:50 -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=M7k0kKaV; 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]:33636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYall-0003AR-GI for patch@linaro.org; Tue, 12 May 2020 15:40:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYaew-0000RF-EL for qemu-devel@nongnu.org; Tue, 12 May 2020 15:33:46 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:39426) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYaep-0001tG-Qa for qemu-devel@nongnu.org; Tue, 12 May 2020 15:33:43 -0400 Received: by mail-qk1-x741.google.com with SMTP id a136so5957860qkg.6 for ; Tue, 12 May 2020 12:33:38 -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; bh=/s//tYI4BgCcobGdVgIcQsFlBmIupQaLWvMZYw32pNg=; b=M7k0kKaVCvM58fESIjIefSEWXIoY7spL3fQeRU95LWoydJB6GR5zB5l3jDGmmLB1Gj Svv2ATfCEwoeAH09kz50LypPkD9HfIsWA6qtmB06rNybmDDO+9Kt8IHmWmeWWDpqeAFl KcieA0OVPqaqiC2K16Au52FQloYq4riQ4nnl7tFDAooiZCftUyQSNjfn+ms2vSeBgreE IHKZkgTSDT5lVr8EwqGKeeH0ZMDtPJtcTRAzekJa9/QpjPJkLuIOb4Ok3YVFbHgRZPwm SvnG9umIVg8j/ydPKvl6F9wGLHysMnVYkBD59GZCetzrlxfsJN2lmTEykAwO3eogDfqj OM4w== 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; bh=/s//tYI4BgCcobGdVgIcQsFlBmIupQaLWvMZYw32pNg=; b=l85woTQt0Szm+cd2v2m9TeZ+QcXB8Y+LmqBIYvSua9FbEqZz8DDgdWdtqJ0C9BNsrO JHV/uycLm7p9FCesB0fZkD5nXtK4HUKTdzmsrBT9Pb7LD4OdCdkLJefXvtKVzW29vqxy HUxVNOkoFbRxFoLOB2gRX7FXjKnrP9FsTK4q3PFrlOBtTb5ybAAMJcM1Q1UK3GPsAQ/F lO37J+F3hXdOeBKUMR22sbPe/ZNq5o86Ga5blV7R1HqBJJzKwWgW2IzpS8u+pAhwynPj eZPnbVR5vxNmCnkL8l2oDY7efgC/5vcW9t9PQnZwMNQ9FZrOd4lkYzoZOvti1L1YFOfV LR2Q== X-Gm-Message-State: AGi0PuafhZ/s9V86V1lonfQmGWBnhCs4dnXe7Lib8XXMnP+02XmLNdP4 FQ2Wjy11jdUVNUpGkIcuLiUnr7bvCeU5Aw== X-Received: by 2002:a37:4b0c:: with SMTP id y12mr21783463qka.43.1589312017781; Tue, 12 May 2020 12:33:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2020 12:33:37 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v6 8/9] tests/vm: change scripts to use self._config Date: Tue, 12 May 2020 15:33:39 -0400 Message-Id: <20200512193340.265-9-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> Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.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 change converts existing scripts to using for example self.ROOT_PASS, to self._config['root_pass']. We made similar changes for GUEST_USER, and GUEST_PASS. This allows us also to remove the change in basevm.py, which adds __getattr__ for backwards compatibility. Signed-off-by: Robert Foley Reviewed-by: Peter Puhov --- tests/vm/basevm.py | 11 ++--------- tests/vm/fedora | 17 +++++++++-------- tests/vm/freebsd | 16 ++++++++-------- tests/vm/netbsd | 19 ++++++++++--------- tests/vm/openbsd | 17 +++++++++-------- 5 files changed, 38 insertions(+), 42 deletions(-) -- 2.17.1 diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index e94b2d0356..bb20d8ca54 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -180,13 +180,6 @@ class BaseVM(object): self.console_init(timeout=timeout) self.console_wait(wait_string) - def __getattr__(self, name): - # Support direct access to config by key. - # for example, access self._config['cpu'] by self.cpu - if name.lower() in self._config.keys(): - return self._config[name.lower()] - return object.__getattribute__(self, name) - def _download_with_cache(self, url, sha256sum=None, sha512sum=None): def check_sha256sum(fname): if not sha256sum: @@ -236,13 +229,13 @@ class BaseVM(object): return r def ssh(self, *cmd): - return self._ssh_do(self.GUEST_USER, cmd, False) + return self._ssh_do(self._config["guest_user"], cmd, False) def ssh_root(self, *cmd): return self._ssh_do("root", cmd, False) def ssh_check(self, *cmd): - self._ssh_do(self.GUEST_USER, cmd, True) + self._ssh_do(self._config["guest_user"], cmd, True) def ssh_root_check(self, *cmd): self._ssh_do("root", cmd, True) diff --git a/tests/vm/fedora b/tests/vm/fedora index bd9c6cf295..f536a92678 100755 --- a/tests/vm/fedora +++ b/tests/vm/fedora @@ -109,20 +109,20 @@ class FedoraVM(basevm.BaseVM): self.console_wait_send("7) [!] Root password", "7\n") self.console_wait("Password:") - self.console_send("%s\n" % self.ROOT_PASS) + self.console_send("%s\n" % self._config["root_pass"]) self.console_wait("Password (confirm):") - self.console_send("%s\n" % self.ROOT_PASS) + self.console_send("%s\n" % self._config["root_pass"]) self.console_wait_send("8) [ ] User creation", "8\n") self.console_wait_send("1) [ ] Create user", "1\n") self.console_wait_send("3) User name", "3\n") - self.console_wait_send("ENTER:", "%s\n" % self.GUEST_USER) + self.console_wait_send("ENTER:", "%s\n" % self._config["guest_user"]) self.console_wait_send("4) [ ] Use password", "4\n") self.console_wait_send("5) Password", "5\n") self.console_wait("Password:") - self.console_send("%s\n" % self.GUEST_PASS) + self.console_send("%s\n" % self._config["guest_pass"]) self.console_wait("Password (confirm):") - self.console_send("%s\n" % self.GUEST_PASS) + self.console_send("%s\n" % self._config["guest_pass"]) self.console_wait_send("7) Groups", "c\n") while True: @@ -140,7 +140,7 @@ class FedoraVM(basevm.BaseVM): if good: break time.sleep(10) - self.console_send("r\n" % self.GUEST_PASS) + self.console_send("r\n" % self._config["guest_pass"]) self.console_wait_send("'b' to begin install", "b\n") @@ -151,12 +151,13 @@ class FedoraVM(basevm.BaseVM): # setup qemu user prompt = " ~]$" - self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_ssh_init(prompt, self._config["guest_user"], + self._config["guest_pass"]) self.console_wait_send(prompt, "exit\n") # setup root user prompt = " ~]#" - self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_ssh_init(prompt, "root", self._config["root_pass"]) self.console_sshd_config(prompt) # setup virtio-blk #1 (tarfile) diff --git a/tests/vm/freebsd b/tests/vm/freebsd index 298967fe9c..898393b58d 100755 --- a/tests/vm/freebsd +++ b/tests/vm/freebsd @@ -114,9 +114,9 @@ class FreeBSDVM(basevm.BaseVM): # post-install configuration self.console_wait("New Password:") - self.console_send("%s\n" % self.ROOT_PASS) + self.console_send("%s\n" % self._config["root_pass"]) self.console_wait("Retype New Password:") - self.console_send("%s\n" % self.ROOT_PASS) + self.console_send("%s\n" % self._config["root_pass"]) self.console_wait_send("Network Configuration", "\n") self.console_wait_send("IPv4", "y") @@ -135,9 +135,9 @@ class FreeBSDVM(basevm.BaseVM): # qemu user self.console_wait_send("Add User Accounts", "y") self.console_wait("Username") - self.console_send("%s\n" % self.GUEST_USER) + self.console_send("%s\n" % self._config["guest_user"]) self.console_wait("Full name") - self.console_send("%s\n" % self.GUEST_USER) + self.console_send("%s\n" % self._config["guest_user"]) self.console_wait_send("Uid", "\n") self.console_wait_send("Login group", "\n") self.console_wait_send("Login group", "\n") @@ -149,9 +149,9 @@ class FreeBSDVM(basevm.BaseVM): self.console_wait_send("Use an empty password", "\n") self.console_wait_send("Use a random password", "\n") self.console_wait("Enter password:") - self.console_send("%s\n" % self.GUEST_PASS) + self.console_send("%s\n" % self._config["guest_pass"]) self.console_wait("Enter password again:") - self.console_send("%s\n" % self.GUEST_PASS) + self.console_send("%s\n" % self._config["guest_pass"]) self.console_wait_send("Lock out", "\n") self.console_wait_send("OK", "yes\n") self.console_wait_send("Add another user", "no\n") @@ -165,12 +165,12 @@ class FreeBSDVM(basevm.BaseVM): # setup qemu user prompt = "$" - self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_ssh_init(prompt, self._config["guest_user"], self._config["guest_pass"]) self.console_wait_send(prompt, "exit\n") # setup root user prompt = "root@freebsd:~ #" - self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_ssh_init(prompt, "root", self._config["root_pass"]) self.console_sshd_config(prompt) # setup serial console diff --git a/tests/vm/netbsd b/tests/vm/netbsd index b10c9d429d..7e54fe8322 100755 --- a/tests/vm/netbsd +++ b/tests/vm/netbsd @@ -121,24 +121,24 @@ class NetBSDVM(basevm.BaseVM): self.console_wait_send("d: Change root password", "d\n") self.console_wait_send("a: Yes", "a\n") self.console_wait("New password:") - self.console_send("%s\n" % self.ROOT_PASS) + self.console_send("%s\n" % self._config["root_pass"]) self.console_wait("New password:") - self.console_send("%s\n" % self.ROOT_PASS) + self.console_send("%s\n" % self._config["root_pass"]) self.console_wait("Retype new password:") - self.console_send("%s\n" % self.ROOT_PASS) + self.console_send("%s\n" % self._config["root_pass"]) self.console_wait_send("o: Add a user", "o\n") self.console_wait("username") - self.console_send("%s\n" % self.GUEST_USER) + self.console_send("%s\n" % self._config["guest_pass"]) self.console_wait("to group wheel") self.console_wait_send("a: Yes", "a\n") self.console_wait_send("a: /bin/sh", "a\n") self.console_wait("New password:") - self.console_send("%s\n" % self.GUEST_PASS) + self.console_send("%s\n" % self._config["guest_pass"]) self.console_wait("New password:") - self.console_send("%s\n" % self.GUEST_PASS) + self.console_send("%s\n" % self._config["guest_pass"]) self.console_wait("Retype new password:") - self.console_send("%s\n" % self.GUEST_PASS) + self.console_send("%s\n" % self._config["guest_pass"]) self.console_wait_send("a: Configure network", "a\n") self.console_wait_send("a: vioif0", "a\n") @@ -171,12 +171,13 @@ class NetBSDVM(basevm.BaseVM): # setup qemu user prompt = "localhost$" - self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_ssh_init(prompt, self._config["guest_user"], + self._config["guest_pass"]) self.console_wait_send(prompt, "exit\n") # setup root user prompt = "localhost#" - self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_ssh_init(prompt, "root", self._config["root_pass"]) self.console_sshd_config(prompt) # setup virtio-blk #1 (tarfile) diff --git a/tests/vm/openbsd b/tests/vm/openbsd index 0b705f4945..04a532c763 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -99,9 +99,9 @@ class OpenBSDVM(basevm.BaseVM): self.console_wait_send("Which network interface", "done\n") self.console_wait_send("DNS domain name", "localnet\n") self.console_wait("Password for root account") - self.console_send("%s\n" % self.ROOT_PASS) + self.console_send("%s\n" % self._config["root_pass"]) self.console_wait("Password for root account") - self.console_send("%s\n" % self.ROOT_PASS) + self.console_send("%s\n" % self._config["root_pass"]) self.console_wait_send("Start sshd(8)", "yes\n") self.console_wait_send("X Window System", "\n") self.console_wait_send("xenodm", "\n") @@ -109,13 +109,13 @@ class OpenBSDVM(basevm.BaseVM): self.console_wait_send("Which speed", "\n") self.console_wait("Setup a user") - self.console_send("%s\n" % self.GUEST_USER) + self.console_send("%s\n" % self._config["guest_user"]) self.console_wait("Full name") - self.console_send("%s\n" % self.GUEST_USER) + self.console_send("%s\n" % self._config["guest_user"]) self.console_wait("Password") - self.console_send("%s\n" % self.GUEST_PASS) + self.console_send("%s\n" % self._config["guest_pass"]) self.console_wait("Password") - self.console_send("%s\n" % self.GUEST_PASS) + self.console_send("%s\n" % self._config["guest_pass"]) self.console_wait_send("Allow root ssh login", "yes\n") self.console_wait_send("timezone", "UTC\n") @@ -136,12 +136,13 @@ class OpenBSDVM(basevm.BaseVM): # setup qemu user prompt = "$" - self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_ssh_init(prompt, self._config["guest_user"], + self._config["guest_pass"]) self.console_wait_send(prompt, "exit\n") # setup root user prompt = "openbsd#" - self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_ssh_init(prompt, "root", self._config["root_pass"]) self.console_sshd_config(prompt) # setup virtio-blk #1 (tarfile)