From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557485694; cv=none; d=zoho.com; s=zohoarc; b=gXs98+YBguLRUfeH7b0llpCdfb/p8RI5UvWeSV3MX+aOyp2LF6gflv17oIJo6ck5heLTw+jwXEkAryxjduOqceb0uEj1bIWRaRY4A3uYzRDxegmx8lQ6s8JuNK76n8VQtN+SwijxfEpCUtXen8Y64vRwEx8NkwLrX7FMbkhuiWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557485694; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=IPn4RzgtxTQpaL2YFW6OkckZYZJq3cLSwskFosBwSdM=; b=N9awAziWJCLVAluyoEd/+hHnAK0ETrsvFnl1eceS3cxSNVcA2jjSqUTtgiPs6w9nSbKzOPp1VLRpjkBSntYRK4BHLamAT4IbvuBd31fbUUPdp0o/mDEAPXqD+awftwU/AXcMrI6ZibCUJQJHmnuWHQNpH4BSt2buYoSsLMj+slk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557485694902500.2564897793037; Fri, 10 May 2019 03:54:54 -0700 (PDT) Received: from localhost ([127.0.0.1]:41039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3Ar-0005yZ-Ia for importer@patchew.org; Fri, 10 May 2019 06:54:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP333-0008Iu-SV for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP332-00043d-M6 for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41586) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP332-000436-Ex for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:40 -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 BB163D77F2; Fri, 10 May 2019 10:46:39 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4209E646BB; Fri, 10 May 2019 10:46:34 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 65D16A1E4; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:21 +0200 Message-Id: <20190510104633.9428-2-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-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.38]); Fri, 10 May 2019 10:46:39 +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 v2 01/13] scripts: use git archive in archive-source X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use git archive to create tarballs of qemu and submodules instead of cloning the repository and the submodules. This is a order of magnitude faster because it doesn't fetch the submodules from the internet each time the script runs. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth --- scripts/archive-source.sh | 72 +++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 41 deletions(-) diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh index 8b8994826000..93a48d2063f9 100755 --- a/scripts/archive-source.sh +++ b/scripts/archive-source.sh @@ -19,16 +19,25 @@ if test $# -lt 1; then fi =20 tar_file=3D$(realpath "$1") -list_file=3D"${tar_file}.list" -vroot_dir=3D"${tar_file}.vroot" +sub_tdir=3D$(mktemp -d "${tar_file%.tar}.sub.XXXXXXXX") +sub_file=3D"${sub_tdir}/submodule.tar" =20 # We want a predictable list of submodules for builds, that is # independent of what the developer currently has initialized # in their checkout, because the build environment is completely # different to the host OS. submodules=3D"dtc slirp ui/keycodemapdb tests/fp/berkeley-softfloat-3 test= s/fp/berkeley-testfloat-3" +sub_deinit=3D"" =20 -trap "status=3D$?; rm -rf \"$list_file\" \"$vroot_dir\"; exit \$status" 0 = 1 2 3 15 +function cleanup() { + local status=3D$? + rm -rf "$sub_tdir" + if test "$sub_deinit" !=3D ""; then + git submodule deinit $sub_deinit + fi + exit $status +} +trap "cleanup" 0 1 2 3 15 =20 if git diff-index --quiet HEAD -- &>/dev/null then @@ -36,45 +45,26 @@ then else HEAD=3D$(git stash create) fi -git clone --shared . "$vroot_dir" -test $? -ne 0 && error "failed to clone into '$vroot_dir'" -for sm in $submodules; do - if test -d "$sm/.git" - then - git clone --shared "$sm" "$vroot_dir/$sm" - test $? -ne 0 && error "failed to clone submodule $sm" - fi -done - -cd "$vroot_dir" -test $? -ne 0 && error "failed to change into '$vroot_dir'" - -git checkout $HEAD -test $? -ne 0 && error "failed to checkout $HEAD revision" =20 +git archive --format tar $HEAD > "$tar_file" +test $? -ne 0 && error "failed to archive qemu" for sm in $submodules; do - git submodule update --init $sm - test $? -ne 0 && error "failed to init submodule $sm" + status=3D"$(git submodule status "$sm")" + smhash=3D"${status#[ +-]}" + smhash=3D"${smhash%% *}" + case "$status" in + -*) + sub_deinit=3D"$sub_deinit $sm" + git submodule update --init "$sm" + test $? -ne 0 && error "failed to update submodule $sm" + ;; + +*) + echo "WARNING: submodule $sm is out of sync" + ;; + esac + (cd $sm; git archive --format tar --prefix "$sm/" $smhash) > "$sub_fil= e" + test $? -ne 0 && error "failed to archive submodule $sm ($smhash)" + tar --concatenate --file "$tar_file" "$sub_file" + test $? -ne 0 && error "failed append submodule $sm to $tar_file" done - -if test -n "$submodules"; then - { - git ls-files || error "git ls-files failed" - for sm in $submodules; do - (cd $sm; git ls-files) | sed "s:^:$sm/:" - if test "${PIPESTATUS[*]}" !=3D "0 0"; then - error "git ls-files in submodule $sm failed" - fi - done - } | grep -x -v $(for sm in $submodules; do echo "-e $sm"; done) > "$li= st_file" -else - git ls-files > "$list_file" -fi - -if test $? -ne 0; then - error "failed to generate list file" -fi - -tar -cf "$tar_file" -T "$list_file" || error "failed to create tar file" - exit 0 --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557485719; cv=none; d=zoho.com; s=zohoarc; b=Rmk18iUISIJpRZYB7x3kKojsecLdr2rJ7njertfpbB3yIwNY6dgic9ErwQ8nWGUkK6h7MDPqOMlI+Ho5bTjW6rZnTUSFvp2Os6wgzAsCamuXRyh1Vltv5zhVWvFmhztD+inlGzLB6Wc5WtX3lvXuFaoePiN9Fue1u7pLRIWacAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557485719; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=IXIUK7rBixKWYUwl/8rRJkO/4HESAd0VTOfBq/PsxJE=; b=ADXozX+UndAAD2A8Ov+7oIBWvjWnsZBqRgUH2pZirbPihynmkI1tL2tPxc/nWPCDGrnIzB8n5H0hSblW5yVuRWOHs/rFO3FiD+62orIHMpL6c7Bl3dMf0eTuG3sAEZ5HDmb5693spaPm28TeN1p9hkr97Ek6pF/I0uKy2W9aDWk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557485719122316.12873656528996; Fri, 10 May 2019 03:55:19 -0700 (PDT) Received: from localhost ([127.0.0.1]:41041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3BM-0006NA-2x for importer@patchew.org; Fri, 10 May 2019 06:55:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP332-0008I2-Vw for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP332-00043D-3r for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41568) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP331-00042d-Ux for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:40 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 062BA3082B02; Fri, 10 May 2019 10:46:39 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 413FA5C29A; Fri, 10 May 2019 10:46:34 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6DEFEA1E8; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:22 +0200 Message-Id: <20190510104633.9428-3-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 10 May 2019 10:46:39 +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 v2 02/13] tests/vm: send proxy environment variables over ssh X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Packages are fetched via proxy that way, if configured on the host. That might be required to pass firewalls, and it allows to route package downloads through a caching proxy server. Needs AcceptEnv setup in sshd_config on the guest side to work. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Thomas Huth --- tests/vm/basevm.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 0556bdcf9e9f..6b46674f4497 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -38,6 +38,13 @@ class BaseVM(object): GUEST_PASS =3D "qemupass" ROOT_PASS =3D "qemupass" =20 + envvars =3D [ + "https_proxy", + "http_proxy", + "ftp_proxy", + "no_proxy", + ] + # The script to run in the guest that builds QEMU BUILD_SCRIPT =3D "" # The guest name, to be overridden by subclasses @@ -105,6 +112,8 @@ class BaseVM(object): "-o", "UserKnownHostsFile=3D" + os.devnull, "-o", "ConnectTimeout=3D1", "-p", self.ssh_port, "-i", self._ssh_key_file] + for var in self.envvars: + ssh_cmd +=3D ['-o', "SendEnv=3D%s" % var ] if interactive: ssh_cmd +=3D ['-t'] assert not isinstance(cmd, str) --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557486068; cv=none; d=zoho.com; s=zohoarc; b=DuUzPv0uahahjqjFNnWanZqQMFmQl5mDv4bqs1/kXqkFKqPzNiLgHIL5uH3l4IcvPYcq+MwjdoHigaIVhmTZ8FUO14ICPAJ4ijzGjn2rQihPXHG3nDgnZTdOKg9rq1Uq8iPveuhF0AxFRJ7b0qgWReb1jCoBcQ6OBzPMRJWyhtc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557486068; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=28hpwGcdYJigsmoCrTtDPXFjSftBeINcXy7YJudZfr8=; b=Rp2uktvbfcsQz/cVF7z7lv9IJtBZswSDPCJMtJ09cSt+sGawa5sZ9Qa6Y67iHwaDinkMFxd61yy6JTADHBXVCdIWuBXATukV0BzHeKmm/Am8HFjL7PV7mtCAhdpwlR/1ONo6HXPNsvYV73XNGad/AoAfYrV/h54IRPvBvcihNgk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557486068903747.9727544379492; Fri, 10 May 2019 04:01:08 -0700 (PDT) Received: from localhost ([127.0.0.1]:41136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3Gv-0003P8-JN for importer@patchew.org; Fri, 10 May 2019 07:01:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP334-0008Kr-W7 for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP333-00044X-I3 for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43472) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP333-00043p-Cg for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 804E0A4D21; Fri, 10 May 2019 10:46:40 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 075E65D6A9; Fri, 10 May 2019 10:46:34 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7648CA1E9; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:23 +0200 Message-Id: <20190510104633.9428-4-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 10 May 2019 10:46:40 +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 v2 03/13] tests/vm: use ssh with pty unconditionally X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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 6b46674f4497..89bfa0fe4425 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -106,16 +106,14 @@ class BaseVM(object): os.rename(fname + ".download", fname) return fname =20 - def _ssh_do(self, user, cmd, check, interactive=3DFalse): - ssh_cmd =3D ["ssh", "-q", + def _ssh_do(self, user, cmd, check): + ssh_cmd =3D ["ssh", "-q", "-t", "-o", "StrictHostKeyChecking=3Dno", "-o", "UserKnownHostsFile=3D" + os.devnull, "-o", "ConnectTimeout=3D1", "-p", self.ssh_port, "-i", self._ssh_key_file] for var in self.envvars: ssh_cmd +=3D ['-o', "SendEnv=3D%s" % var ] - if interactive: - ssh_cmd +=3D ['-t'] assert not isinstance(cmd, str) ssh_cmd +=3D ["%s@127.0.0.1" % user] + list(cmd) logging.debug("ssh_cmd: %s", " ".join(ssh_cmd)) @@ -127,9 +125,6 @@ class BaseVM(object): def ssh(self, *cmd): return self._ssh_do(self.GUEST_USER, cmd, False) =20 - 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) =20 @@ -283,9 +278,9 @@ def main(vmcls): return 2 =20 if args.interactive: - if vm.ssh_interactive(*cmd) =3D=3D 0: + if vm.ssh(*cmd) =3D=3D 0: return 0 - vm.ssh_interactive() + vm.ssh() return 3 else: if vm.ssh(*cmd) !=3D 0: --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557485891; cv=none; d=zoho.com; s=zohoarc; b=YcrD+1iIsKgOWawlOOdhaX3Xso8w2JGMCx0jgqghJQLkwCEfZGIIQKvNlLs7qZF1HNghStOTxOuHLiP/pOku6PZ3x3fc1/HXyh1jydWap7ZkwEKPZ/w1kHTuaekAPyB4ziET84ASZ0bZTi8UQO/07UFtYZSA/NDTq2M0vJVE7+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557485891; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=xIqpkn/XHtaQ1Ub6TDw4bNFIe6YSw9G/BIEkW6o5Mm8=; b=Ly9H8SEbuGh7/sMBE5xsQahezblyxoGVn8sxz6AeF46pIO7UVmn+X47FqKe0w3JeQjfPlkahNm7/xofBY2KMx4gu6sq5RjuIiZyZZ5DmOK28IaDKYoYV4Ji5Y4hO/7J84AYFIEAk9EaSNjcYQhdGkDdvoUw0aJdYrVWhZMCATiw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155748589157342.551544093519965; Fri, 10 May 2019 03:58:11 -0700 (PDT) Received: from localhost ([127.0.0.1]:41098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3E7-00010g-IG for importer@patchew.org; Fri, 10 May 2019 06:58:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP334-0008JX-HX for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP333-00044R-HI for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57590) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP333-00043m-C8 for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C9AD36883; Fri, 10 May 2019 10:46:40 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0799F5D70D; Fri, 10 May 2019 10:46:34 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7F391A1EA; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:24 +0200 Message-Id: <20190510104633.9428-5-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 10 May 2019 10:46:40 +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 v2 04/13] tests/vm: run test builds on snapshot X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The build script doesn't shutdown the guest VMs properly, which results in filesystem corruption and guest boot failures sooner or later. Use the --snapshot to run builds on a snapshot, That way killing the VM doesn't corrupt the base image. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth --- tests/vm/Makefile.include | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index 992d823f6bd2..d628e0a986f6 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -53,6 +53,7 @@ vm-build-%: $(IMAGES_DIR)/%.img $(if $(V),--verbose) \ --image "$<" \ $(if $(BUILD_TARGET),--build-target $(BUILD_TARGET)) \ + --snapshot \ --build-qemu $(SRC_PATH) -- \ $(if $(TARGET_LIST),--target-list=3D$(TARGET_LIST)) \ $(if $(EXTRA_CONFIGURE_OPTS),$(EXTRA_CONFIGURE_OPTS)), \ --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557486033; cv=none; d=zoho.com; s=zohoarc; b=Gyd7Wf4jl+YwOA5JNlY/gkLpw/PJN1kwsVNDKCTFp8J+ThZ8gHaMjKFw7tyi1bKFTh/Z9NAORt6EawSGYnhkVEBKGtMhiMk35r2rn0PMBO7ei4x0ESorFosQxqiQd/4wFd4c5ZjFRPSRIcoCurVNcE11w3dH1bzHJExoscG2BYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557486033; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=zCJFpgnuO/dT65oXEtx6t3UwnZBopPrQYhrx0ZZ04lk=; b=Cis6cLdL9iP7BjgmR5/KKRrtBOwSzgLBytuH5DLUt532MDvtBJaWbJX7dJ75W6JIlSR9QG5u6FqKYKkINiZJtN3qy2UKIQh4/8xl/Dc6nh8RfQN00jndrz/4CbpSN8kcIRJFsrYkDDPMd1Ke6M+yrd2Qiz82Jru8+zbxpnViuF8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557486033780325.1897519435381; Fri, 10 May 2019 04:00:33 -0700 (PDT) Received: from localhost ([127.0.0.1]:41123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3GQ-0002ye-NF for importer@patchew.org; Fri, 10 May 2019 07:00:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP339-0008RF-E3 for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP338-0004D5-Hm for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50214) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP338-0004BF-CP for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:46 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C5E3C058CA2; Fri, 10 May 2019 10:46:45 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF03E600C7; Fri, 10 May 2019 10:46:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 87695A208; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:25 +0200 Message-Id: <20190510104633.9428-6-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 10 May 2019 10:46:45 +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 v2 05/13] tests/vm: proper guest shutdown X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When not running in snapshot mode ask the guest to poweroff and wait for this to finish instead of simply quitting qemu, so the guest can flush pending updates to disk. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth --- tests/vm/basevm.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 89bfa0fe4425..cae507323596 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -51,6 +51,8 @@ class BaseVM(object): name =3D "#base" # The guest architecture, to be overridden by subclasses arch =3D "#arch" + # command to halt the guest, can be overridden by subclasses + poweroff =3D "poweroff" def __init__(self, debug=3DFalse, vcpus=3DNone): self._guest =3D None self._tmpdir =3D os.path.realpath(tempfile.mkdtemp(prefix=3D"vm-te= st-", @@ -201,6 +203,10 @@ class BaseVM(object): def wait(self): self._guest.wait() =20 + def graceful_shutdown(self): + self.ssh_root(self.poweroff) + self._guest.wait() + def qmp(self, *args, **kwargs): return self._guest.qmp(*args, **kwargs) =20 @@ -277,11 +283,13 @@ def main(vmcls): traceback.print_exc() return 2 =20 - if args.interactive: - if vm.ssh(*cmd) =3D=3D 0: - return 0 + exitcode =3D 0 + if vm.ssh(*cmd) !=3D 0: + exitcode =3D 3 + if exitcode !=3D 0 and args.interactive: vm.ssh() - return 3 - else: - if vm.ssh(*cmd) !=3D 0: - return 3 + + if not args.snapshot: + vm.graceful_shutdown() + + return exitcode --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557486286; cv=none; d=zoho.com; s=zohoarc; b=YGQaDfSRcW8O8n+SWoJCBWad7NYV/MmZK0bgbEpmt4k6XJCG/T7mDV5FFt/Id/vwZrjXSOTz/tCg098rpg9liNGNVtSiofLwx6dbjx7DwXDt8QcMAKARTK+JZJc7gq2AIk4Gp8y1C1X2ZtlTzFrXNL4FaT2ZIkkogivOduH3C0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557486286; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=thSe/HnBOKpYMKf4HPSHv609fyQ0lCH3nIPtnAZ8TiA=; b=gJwQfJ+YPVqkWlkKsCFinPKN1fSi26TngWHs8WyPfCW336RQABZpzUYCUdMYL62uh6SyHkshM5es0FHE4tLyzR0KFqeuL2W35DVWYeg6gnVQgjqgF0dcWzz5JSbKFwXfp2eKBn6ojJwtt/m89m15mQ9rJmwXiux2DO8cVYIUWn8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557486286820281.5334138262273; Fri, 10 May 2019 04:04:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:41188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3KA-0006Vv-3t for importer@patchew.org; Fri, 10 May 2019 07:04:22 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP334-0008J4-29 for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP333-000440-4C for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16011) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP332-00043L-VA for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:41 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 230E16696C; Fri, 10 May 2019 10:46:40 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id CAEB31001E81; Fri, 10 May 2019 10:46:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8FCDFA212; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:26 +0200 Message-Id: <20190510104633.9428-7-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 10 May 2019 10:46:40 +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 v2 06/13] tests/vm: add vm-boot-{ssh, serial}- targets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For testing/troubleshooting convinience. make vm-boot-serial- Boot guest, with the serial console on stdio. make vm-boot-ssh- Boot guest, login via ssh. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth --- tests/vm/Makefile.include | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index d628e0a986f6..47084d5717c6 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -20,6 +20,10 @@ vm-test: @echo " vm-build-all - Build QEMU in all VMs" @echo " vm-clean-all - Clean up VM images" @echo + @echo "For trouble-shooting:" + @echo " vm-boot-serial- - Boot guest, serial console on = stdio" + @echo " vm-boot-ssh- - Boot guest and login via ssh" + @echo @echo "Special variables:" @echo " BUILD_TARGET=3Dfoo - override the build target" @echo " TARGET_LIST=3Da,b,c - Override target list in builds." @@ -59,3 +63,18 @@ vm-build-%: $(IMAGES_DIR)/%.img $(if $(EXTRA_CONFIGURE_OPTS),$(EXTRA_CONFIGURE_OPTS)), \ " VM-BUILD $*") =20 +vm-boot-serial-%: $(IMAGES_DIR)/%.img + qemu-system-x86_64 -enable-kvm -m 4G -smp 2 -nographic \ + -drive if=3Dnone,id=3Dvblk,cache=3Dwriteback,file=3D"$<" \ + -netdev user,id=3Dvnet \ + -device virtio-blk-pci,drive=3Dvblk \ + -device virtio-net-pci,netdev=3Dvnet \ + || true + +vm-boot-ssh-%: $(IMAGES_DIR)/%.img + $(call quiet-command, \ + $(SRC_PATH)/tests/vm/$* \ + --image "$<" \ + --interactive \ + false, \ + " VM-BOOT-SSH $*") --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557486243; cv=none; d=zoho.com; s=zohoarc; b=L/PZtzVcelvA5Hf7jiDO0zQ2mgv7mbvKkWZCZinsNRhJmLOFcYRciHDhzkCGwIWmWDnucyGMK3S/hjjRS96iF+VirFwwL1BdpjqC0YyT9VvfClnZdhkPw5cs3+6QdxNxZxJzzTwpFGSXNnlwvxVdEyiR6LL8XQMiua8L6anrIDY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557486243; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=HgsKmMDTxok7vlsxcYXCAPrVzlWE8XD+5zJyUlyrb5o=; b=lx+LpGb8mXsJmrk153wVQGo+XCM9hxwRgaApBh6d2aCCM0WZuLcrfFuSkQN+2SMOmoa3pYeRu23J2bM7PXgIcMRFXou6W5541tRRSs81wSJzMyhGy/G91SkcS5vBneVO2NDpZZxzFMakAN6TqMhDFbjFyjmZA6GvU836tYKy8U8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557486243535937.5835901184012; Fri, 10 May 2019 04:04:03 -0700 (PDT) Received: from localhost ([127.0.0.1]:41184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3Jo-0006HE-Bi for importer@patchew.org; Fri, 10 May 2019 07:04:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP336-0008MN-4s for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP335-000486-AV for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54848) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP335-000469-4Q for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 50A6486674; Fri, 10 May 2019 10:46:42 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F2B75D717; Fri, 10 May 2019 10:46:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 98550A213; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:27 +0200 Message-Id: <20190510104633.9428-8-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 10 May 2019 10:46:42 +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 v2 07/13] tests/vm: add DEBUG=1 to help text X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Thomas Huth --- tests/vm/Makefile.include | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index 47084d5717c6..8714b5947958 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -25,6 +25,8 @@ vm-test: @echo " vm-boot-ssh- - Boot guest and login via ssh" @echo @echo "Special variables:" + @echo " DEBUG=3D1 - be verbose, also start interactive" + @echo " shell on build failures" @echo " BUILD_TARGET=3Dfoo - override the build target" @echo " TARGET_LIST=3Da,b,c - Override target list in builds." @echo ' EXTRA_CONFIGURE_OPTS=3D"..."' --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557485862; cv=none; d=zoho.com; s=zohoarc; b=k6DtkZ5uKFKtppVzUQmuuIa0JLQy/GQxhru9hSSGw5tuZFUBstfTSQl08jAzG7hXb1WHWEa2l64DjgWxae9TuhCocompsnLT2SOZWkaEvcNZqRhlYw5cBxgvuaKOGs33+nkvRvzDVjCb/91FYf4Q/9+QkcFLL0lxs66AFrmcS9I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557485862; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=itwi0FvciFk8s0rGn34ghwSYKvhrqA8/4Wvgt8vQQyQ=; b=B8KZIg4LzGsE4vrQ05FrX4lMOhDFHTxYuQPDdesfdx5ZZL3nex1NgvAxpAhhrjOHWkeKgO7oPGkRnVJDh0/EcMy+8bwMw1UgSiWpIhQFaosT+5N9gJC+WDxfPd86z8gc9PNfjSVxhZI65NpHL5Yt615BcUXuimUQJ8PjbK61Q0A= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155748586272411.18860910688727; Fri, 10 May 2019 03:57:42 -0700 (PDT) Received: from localhost ([127.0.0.1]:41096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3De-0000dU-Jj for importer@patchew.org; Fri, 10 May 2019 06:57:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP335-0008LQ-DI for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP334-00045N-43 for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49419) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP333-000448-SJ for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D672C0568FE; Fri, 10 May 2019 10:46:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 633A761D11; Fri, 10 May 2019 10:46:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A11CA9D84; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:28 +0200 Message-Id: <20190510104633.9428-9-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 10 May 2019 10:46:41 +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 v2 08/13] tests/vm: serial console support helpers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a bunch of helpers to talk to the guest using the serial console. Also drop the hard-coded -serial parameter for the vm so QEMUMachine.set_console() actually works. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth --- tests/vm/basevm.py | 85 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 3 deletions(-) diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index cae507323596..c4f67ee4c065 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -2,10 +2,11 @@ # # VM testing base class # -# Copyright 2017 Red Hat Inc. +# Copyright 2017-2019 Red Hat Inc. # # Authors: # Fam Zheng +# Gerd Hoffmann # # This code is licensed under the GPL version 2 or later. See # the COPYING file in the top-level directory. @@ -13,7 +14,9 @@ =20 from __future__ import print_function import os +import re import sys +import socket import logging import time import datetime @@ -79,8 +82,7 @@ class BaseVM(object): "-cpu", "max", "-netdev", "user,id=3Dvnet,hostfwd=3D:127.0.0.1:0-:22", "-device", "virtio-net-pci,netdev=3Dvnet", - "-vnc", "127.0.0.1:0,to=3D20", - "-serial", "file:%s" % os.path.join(self._tmpdir, "serial.out"= )] + "-vnc", "127.0.0.1:0,to=3D20"] if vcpus and vcpus > 1: self._args +=3D ["-smp", str(vcpus)] if kvm_available(self.arch): @@ -161,6 +163,8 @@ class BaseVM(object): logging.debug("QEMU args: %s", " ".join(args)) qemu_bin =3D os.environ.get("QEMU", "qemu-system-" + self.arch) guest =3D QEMUMachine(binary=3Dqemu_bin, args=3Dargs) + guest.set_machine('pc') + guest.set_console() try: guest.launch() except: @@ -183,6 +187,81 @@ class BaseVM(object): raise Exception("Cannot find ssh port from 'info usernet':\n%s= " % \ usernet_info) =20 + def console_init(self, timeout =3D 120): + vm =3D self._guest + vm.console_socket.settimeout(timeout) + + def console_log(self, text): + for line in re.split("[\r\n]", text): + # filter out terminal escape sequences + line =3D re.sub("\x1b\[[0-9;?]*[a-zA-Z]", "", line) + line =3D re.sub("\x1b\([0-9;?]*[a-zA-Z]", "", line) + # replace unprintable chars + line =3D re.sub("\x1b", "", line) + line =3D re.sub("[\x00-\x1f]", ".", line) + if line =3D=3D "": + continue + # log console line + sys.stderr.write("con recv: %s\n" % line) + + def console_wait(self, expect): + vm =3D self._guest + output =3D "" + while True: + try: + chars =3D vm.console_socket.recv(1024) + except socket.timeout: + sys.stderr.write("console: *** read timeout ***\n") + sys.stderr.write("console: waiting for: '%s'\n" % expect) + sys.stderr.write("console: line buffer:\n") + sys.stderr.write("\n") + self.console_log(output.rstrip()) + sys.stderr.write("\n") + raise + output +=3D chars + if expect in output: + break + if "\r" in output or "\n" in output: + lines =3D re.split("[\r\n]", output) + output =3D lines.pop() + if self.debug: + self.console_log("\n".join(lines)) + if self.debug: + self.console_log(output) + + def console_send(self, command): + vm =3D self._guest + if self.debug: + logline =3D re.sub("\n", "", command) + logline =3D re.sub("[\x00-\x1f]", ".", logline) + sys.stderr.write("con send: %s\n" % logline) + for char in list(command): + vm.console_socket.send(char) + time.sleep(0.01) + + def console_wait_send(self, wait, command): + self.console_wait(wait) + self.console_send(command) + + def console_ssh_init(self, prompt, user, pw): + sshkey_cmd =3D "echo '%s' > .ssh/authorized_keys\n" % SSH_PUB_KEY.= rstrip() + self.console_wait_send("login:", "%s\n" % user) + self.console_wait_send("Password:", "%s\n" % pw) + self.console_wait_send(prompt, "mkdir .ssh\n") + self.console_wait_send(prompt, sshkey_cmd) + self.console_wait_send(prompt, "chmod 755 .ssh\n") + self.console_wait_send(prompt, "chmod 644 .ssh/authorized_key= s\n") + + def console_sshd_config(self, prompt): + self.console_wait(prompt) + self.console_send("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_con= fig\n") + for var in self.envvars: + self.console_wait(prompt) + self.console_send("echo 'AcceptEnv %s' >> /etc/ssh/sshd_config= \n" % var) + + def print_step(self, text): + sys.stderr.write("### %s ...\n" % text) + def wait_ssh(self, seconds=3D300): starttime =3D datetime.datetime.now() endtime =3D starttime + datetime.timedelta(seconds=3Dseconds) --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557486411; cv=none; d=zoho.com; s=zohoarc; b=n1Hz2PXP04uzwb0Bf0kKzMOXIEpv7ZaEZQTZ8/HUgqoY5XwWoLzY72PkRNv3wYDrUBPbADBJeQeEZKz+DX5SiD3afT8j+hKx1ePSjuGOvbkDmvxJ4zFQYAX154dymmme+yHu6XKiz426o8F6IiuqZNCBb/rNVQ9Ylrq24iZwZ1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557486411; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ZLm85CdCESIBx8BDIk0bs71inK7UsNgvBsaPRtKtaZ4=; b=iBrbS7VV8RJyyV93g7oVffk1A+hJ4Z7TsNhN+ZpaPcit8SS5qoS/AgaXbO2vsXBHOa3G2SP3sPL2yCP8TEwAn8Me/5v+IzHPw6ZIN5DMbSlaLxzARBfHKYw77iPC4df57VY66FjmxHqpSrqq7cYyXODd0akVb4nlYKc/jEnSd28= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557486411796252.0001707069282; Fri, 10 May 2019 04:06:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:41245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3MT-0000Kh-OT for importer@patchew.org; Fri, 10 May 2019 07:06:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP336-0008NI-Az for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP334-00045u-D1 for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36618) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP334-00044d-4q for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:42 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61F75307D914; Fri, 10 May 2019 10:46:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CAA51001E81; Fri, 10 May 2019 10:46:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AA1BD9DAE; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:29 +0200 Message-Id: <20190510104633.9428-10-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 10 May 2019 10:46:41 +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 v2 09/13] tests/vm: openbsd autoinstall, using serial console X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of fetching the prebuilt image from patchew download the install iso and prepare the image locally. Install to disk, using the serial console. Create qemu user, configure ssh login. Install packages needed for qemu builds. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth --- tests/vm/openbsd | 154 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 141 insertions(+), 13 deletions(-) diff --git a/tests/vm/openbsd b/tests/vm/openbsd index 2105c01a267a..2753cfb1139a 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -2,10 +2,11 @@ # # OpenBSD VM image # -# Copyright 2017 Red Hat Inc. +# Copyright 2017-2019 Red Hat Inc. # # Authors: # Fam Zheng +# Gerd Hoffmann # # This code is licensed under the GPL version 2 or later. See # the COPYING file in the top-level directory. @@ -13,34 +14,161 @@ =20 import os import sys +import socket import subprocess import basevm =20 class OpenBSDVM(basevm.BaseVM): name =3D "openbsd" arch =3D "x86_64" + + link =3D "https://cdn.openbsd.org/pub/OpenBSD/6.5/amd64/install65.iso" + csum =3D "38d1f8cadd502f1c27bf05c5abde6cc505dd28f3f34f8a941048ff9a54f9= f608" + size =3D "20G" + pkgs =3D [ + # tools + "git", + "pkgconf", + "bzip2", "xz", + + # gnu tools + "bash", + "gmake", + "gsed", + "bison", + + # libs: usb + "libusb1", + + # libs: crypto + "gnutls", + + # libs: images + "jpeg", + "png", + + # libs: ui + "sdl2", + "gtk+3", + "libxkbcommon", + ] + BUILD_SCRIPT =3D """ set -e; - rm -rf /var/tmp/qemu-test.* - cd $(mktemp -d /var/tmp/qemu-test.XXXXXX); + rm -rf /home/qemu/qemu-test.* + cd $(mktemp -d /home/qemu/qemu-test.XXXXXX); + mkdir src build; cd src; tar -xf /dev/rsd1c; - ./configure --cc=3Dx86_64-unknown-openbsd6.1-gcc-4.9.4 --python=3D= python2.7 {configure_opts}; - gmake --output-sync -j{jobs} {verbose}; - # XXX: "gmake check" seems to always hang or fail - #gmake --output-sync -j{jobs} check {verbose}; + cd ../build + ../src/configure --cc=3Dcc --python=3Dpython3 {configure_opts}; + gmake --output-sync -j{jobs} {target} {verbose}; """ + poweroff =3D "halt -p" =20 def build_image(self, img): - cimg =3D self._download_with_cache("http://download.patchew.org/op= enbsd-6.1-amd64.img.xz", - sha256sum=3D'8c6cedc483e602cfee5e04f0406c64eb99138495e8ca5= 80bc0293bcf0640c1bf') - img_tmp_xz =3D img + ".tmp.xz" + self.print_step("Downloading install iso") + cimg =3D self._download_with_cache(self.link, sha256sum=3Dself.csu= m) img_tmp =3D img + ".tmp" - sys.stderr.write("Extracting the image...\n") - subprocess.check_call(["cp", "-f", cimg, img_tmp_xz]) - subprocess.check_call(["xz", "-dvf", img_tmp_xz]) + iso =3D img + ".install.iso" + + self.print_step("Preparing iso and disk image") + subprocess.check_call(["cp", "-f", cimg, iso]) + subprocess.check_call(["qemu-img", "create", "-f", "qcow2", + img_tmp, self.size]) + + self.print_step("Booting installer") + self.boot(img_tmp, extra_args =3D [ + "-machine", "graphics=3Doff", + "-cdrom", iso + ]) + self.console_init() + self.console_wait_send("boot>", "set tty com0\n") + self.console_wait_send("boot>", "\n") + + # pre-install configuration + self.console_wait_send("(I)nstall", "i\n") + self.console_wait_send("Terminal type", "xterm\n") + self.console_wait_send("System hostname", "openbsd\n") + self.console_wait_send("Which network interface", "vio0\n") + self.console_wait_send("IPv4 address", "dhcp\n") + self.console_wait_send("IPv6 address", "none\n") + 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_wait("Password for root account") + self.console_send("%s\n" % self.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") + self.console_wait_send("console to com0", "\n") + self.console_wait_send("Which speed", "\n") + + self.console_wait("Setup a user") + self.console_send("%s\n" % self.GUEST_USER) + self.console_wait("Full name") + self.console_send("%s\n" % self.GUEST_USER) + self.console_wait("Password") + self.console_send("%s\n" % self.GUEST_PASS) + self.console_wait("Password") + self.console_send("%s\n" % self.GUEST_PASS) + + self.console_wait_send("Allow root ssh login", "yes\n") + self.console_wait_send("timezone", "UTC\n") + self.console_wait_send("root disk", "\n") + self.console_wait_send("(W)hole disk", "\n") + self.console_wait_send("(A)uto layout", "\n") + self.console_wait_send("Location of sets", "cd0\n") + self.console_wait_send("Pathname to the sets", "\n") + self.console_wait_send("Set name(s)", "\n") + self.console_wait_send("without verification", "yes\n") + + self.print_step("Installation started now, this will take a while") + self.console_wait_send("Location of sets", "done\n") + + self.console_wait("successfully completed") + self.print_step("Installation finished, rebooting") + self.console_wait_send("(R)eboot", "reboot\n") + + # setup qemu user + prompt =3D "$" + self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_wait_send(prompt, "exit\n") + + # setup root user + prompt =3D "openbsd#" + self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_sshd_config(prompt) + + # setup virtio-blk #1 (tarfile) + self.console_wait(prompt) + self.console_send("echo 'chmod 666 /dev/rsd1c' >> /etc/rc.local\n") + + # enable w+x for /home + self.console_wait(prompt) + self.console_send("sed -i -e '/home/s/rw,/rw,wxallowed,/' /etc/fst= ab\n") + + # use http (be proxy cache friendly) + self.console_wait(prompt) + self.console_send("sed -i -e 's/https/http/' /etc/installurl\n") + + self.print_step("Configuration finished, rebooting") + self.console_wait_send(prompt, "reboot\n") + self.console_wait("login:") + self.wait_ssh() + + self.print_step("Installing packages") + self.ssh_root_check("pkg_add %s\n" % " ".join(self.pkgs)) + + # shutdown + self.ssh_root(self.poweroff) + self.wait() + if os.path.exists(img): os.remove(img) os.rename(img_tmp, img) + os.remove(iso) + self.print_step("All done") =20 if __name__ =3D=3D "__main__": sys.exit(basevm.main(OpenBSDVM)) --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557485559; cv=none; d=zoho.com; s=zohoarc; b=Yi6YbJOHpf2j3nr3PzQ7hNlCDuzrbwzROJC/LuNARUZNixGuabZVAayo28wdcIFVVxMM1SOOpRonsyS8tnmCKGeRAFe3YlVKabUxnyhofHC7SJZVGW0WOm1Y8y8tT63MDoMP3boX1ECnp1DQaS1qF3nM9sbfQKJSoIR6HinQm+k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557485559; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Wo5FUORKKpqjvZbGD3DuM5qRmudJO7+0AezV8Pkd21Y=; b=TEiCK6FkECWyZYLlGDhf3mxMHLlus4ZsiTZN+V8oOssdFO4ZJESl4RKt4vwK3wgigGXkhv4LmQbTJfyubJQ6gmtjDXmDA6iNQw6pVajjdebMohr4mBIF4mjyBKMxXe8JETIvdSqym+DWoplRqPwIxnmGTC0z3Pftc0gPxyPJd+A= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557485559984680.5577849898027; Fri, 10 May 2019 03:52:39 -0700 (PDT) Received: from localhost ([127.0.0.1]:41013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP38m-00043p-Sc for importer@patchew.org; Fri, 10 May 2019 06:52:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP336-0008MF-0P for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP334-00045g-9m for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37948) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP334-00044O-1g for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:42 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E87B3DE10; Fri, 10 May 2019 10:46:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88B991001DFE; Fri, 10 May 2019 10:46:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B2F579DB4; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:30 +0200 Message-Id: <20190510104633.9428-11-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 10 May 2019 10:46:41 +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 v2 10/13] tests/vm: freebsd autoinstall, using serial console X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of fetching the prebuilt image from patchew download the install iso and prepare the image locally. Install to disk, using the serial console. Create qemu user, configure ssh login. Install packages needed for qemu builds. Note that freebsd package downloads are delivered as non-cachable content, so I had to configure squid with "ignore-no-store ignore-private ignore-reload" for pkgmir.geo.freebsd.org to make the caching actually work. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Thomas Huth --- tests/vm/freebsd | 175 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 165 insertions(+), 10 deletions(-) diff --git a/tests/vm/freebsd b/tests/vm/freebsd index b0066017a617..57e5c97f3b26 100755 --- a/tests/vm/freebsd +++ b/tests/vm/freebsd @@ -2,43 +2,198 @@ # # FreeBSD VM image # -# Copyright 2017 Red Hat Inc. +# Copyright 2017-2019 Red Hat Inc. # # Authors: # Fam Zheng +# Gerd Hoffmann # # This code is licensed under the GPL version 2 or later. See # the COPYING file in the top-level directory. # =20 import os +import re import sys +import time +import socket import subprocess import basevm =20 class FreeBSDVM(basevm.BaseVM): name =3D "freebsd" arch =3D "x86_64" + + link =3D "https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.0/Fr= eeBSD-12.0-RELEASE-amd64-disc1.iso.xz" + csum =3D "1d40015bea89d05b8bd13e2ed80c40b522a9ec1abd8e7c8b80954fb485fb= 99db" + size =3D "20G" + pkgs =3D [ + # build tools + "git", + "pkgconf", + "bzip2", + + # gnu tools + "bash", + "gmake", + "gsed", + "flex", "bison", + + # libs: crypto + "gnutls", + + # libs: images + "jpeg-turbo", + "png", + + # libs: ui + "sdl2", + "gtk3", + "libxkbcommon", + + # libs: opengl + "libepoxy", + "mesa-libs", + ] + BUILD_SCRIPT =3D """ set -e; - rm -rf /var/tmp/qemu-test.* - cd $(mktemp -d /var/tmp/qemu-test.XXXXXX); + rm -rf /home/qemu/qemu-test.* + cd $(mktemp -d /home/qemu/qemu-test.XXXXXX); + mkdir src build; cd src; tar -xf /dev/vtbd1; - ./configure {configure_opts}; + cd ../build + ../src/configure --python=3Dpython3.6 {configure_opts}; gmake --output-sync -j{jobs} {target} {verbose}; """ =20 + def console_boot_serial(self): + self.console_wait_send("Autoboot", "3") + self.console_wait_send("OK", "set console=3Dcomconsole\n") + self.console_wait_send("OK", "boot\n") + def build_image(self, img): - cimg =3D self._download_with_cache("http://download.patchew.org/fr= eebsd-11.1-amd64.img.xz", - sha256sum=3D'adcb771549b37bc63826c501f05121a206ed3d9f55f49= 145908f7e1432d65891') - img_tmp_xz =3D img + ".tmp.xz" + self.print_step("Downloading install iso") + cimg =3D self._download_with_cache(self.link, sha256sum=3Dself.csu= m) img_tmp =3D img + ".tmp" - sys.stderr.write("Extracting the image...\n") - subprocess.check_call(["cp", "-f", cimg, img_tmp_xz]) - subprocess.check_call(["xz", "-dvf", img_tmp_xz]) + iso =3D img + ".install.iso" + iso_xz =3D iso + ".xz" + + self.print_step("Preparing iso and disk image") + subprocess.check_call(["cp", "-f", cimg, iso_xz]) + subprocess.check_call(["xz", "-dvf", iso_xz]) + subprocess.check_call(["qemu-img", "create", "-f", "qcow2", + img_tmp, self.size]) + + self.print_step("Booting installer") + self.boot(img_tmp, extra_args =3D [ + "-machine", "graphics=3Doff", + "-cdrom", iso + ]) + self.console_init() + self.console_boot_serial() + self.console_wait_send("Console type", "xterm\n") + + # pre-install configuration + self.console_wait_send("Welcome", "\n") + self.console_wait_send("Keymap Selection", "\n") + self.console_wait_send("Set Hostname", "freebsd\n") + self.console_wait_send("Distribution Select", "\n") + self.console_wait_send("Partitioning", "\n") + self.console_wait_send("Partition", "\n") + self.console_wait_send("Scheme", "\n") + self.console_wait_send("Editor", "f") + self.console_wait_send("Confirmation", "c") + + self.print_step("Installation started now, this will take a while") + + # post-install configuration + self.console_wait("New Password:") + self.console_send("%s\n" % self.ROOT_PASS) + self.console_wait("Retype New Password:") + self.console_send("%s\n" % self.ROOT_PASS) + + self.console_wait_send("Network Configuration", "\n") + self.console_wait_send("IPv4", "y") + self.console_wait_send("DHCP", "y") + self.console_wait_send("IPv6", "n") + self.console_wait_send("Resolver", "\n") + + self.console_wait_send("Time Zone Selector", "a\n") + self.console_wait_send("Confirmation", "y") + self.console_wait_send("Time & Date", "\n") + self.console_wait_send("Time & Date", "\n") + + self.console_wait_send("System Configuration", "\n") + self.console_wait_send("System Hardening", "\n") + + # qemu user + self.console_wait_send("Add User Accounts", "y") + self.console_wait("Username") + self.console_send("%s\n" % self.GUEST_USER) + self.console_wait("Full name") + self.console_send("%s\n" % self.GUEST_USER) + self.console_wait_send("Uid", "\n") + self.console_wait_send("Login group", "\n") + self.console_wait_send("Login group", "\n") + self.console_wait_send("Login class", "\n") + self.console_wait_send("Shell", "\n") + self.console_wait_send("Home directory", "\n") + self.console_wait_send("Home directory perm", "\n") + self.console_wait_send("Use password", "\n") + 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_wait("Enter password again:") + self.console_send("%s\n" % self.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") + + self.console_wait_send("Final Configuration", "\n") + self.console_wait_send("Manual Configuration", "\n") + self.console_wait_send("Complete", "\n") + + self.print_step("Installation finished, rebooting") + self.console_boot_serial() + + # setup qemu user + prompt =3D "$" + self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_wait_send(prompt, "exit\n") + + # setup root user + prompt =3D "root@freebsd:~ #" + self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_sshd_config(prompt) + + # setup serial console + self.console_wait(prompt) + self.console_send("echo 'console=3Dcomconsole' >> /boot/loader.con= f\n") + + # setup virtio-blk #1 (tarfile) + self.console_wait(prompt) + self.console_send("echo 'chmod 666 /dev/vtbd1' >> /etc/rc.local\n") + + self.print_step("Configuration finished, rebooting") + self.console_wait_send(prompt, "reboot\n") + self.console_wait("login:") + self.wait_ssh() + + self.print_step("Installing packages") + self.ssh_root_check("pkg install -y %s\n" % " ".join(self.pkgs)) + + # shutdown + self.ssh_root(self.poweroff) + self.console_wait("Uptime:") + self.wait() + if os.path.exists(img): os.remove(img) os.rename(img_tmp, img) + os.remove(iso) + self.print_step("All done") =20 if __name__ =3D=3D "__main__": sys.exit(basevm.main(FreeBSDVM)) --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557486432; cv=none; d=zoho.com; s=zohoarc; b=dgjNJhYknlO6vI5noReMseuT6dRVEGtmyIxVLU92mE/t/hnItVLzPcx+l8QnxBtnRrFnPPah48egeNu8a0dV2wjfBjitwhCmkRsUXRB/OCB/cugSPcXjDWKdFKY5+0ousNboONPdcbffdrBeWmQhqiwUrhjh5W/df3b8BYhfS9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557486432; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Jn7+EsabThIPcT0V2C6/GILqkwrAMlzhGH1P3DJvd2Q=; b=dn4CjWz2/MZyViiXa9gkqw9DXOB+M1emuOcKCMULYNwxBZXLv7CRB/gzvVWqQrf4cqICHMrS1Ivpj8xmWWdkxPeDmZe3n8lSVfv5xiYwGMBfvYui8/anbx+gvHvLS1DIcQW2alOVzd1B2zzXjadqYiZa1Vv/3wJD5h/H98aV6ow= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557486432604258.5828280715491; Fri, 10 May 2019 04:07:12 -0700 (PDT) Received: from localhost ([127.0.0.1]:41247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3Mm-0000mI-DE for importer@patchew.org; Fri, 10 May 2019 07:07:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP336-0008MP-59 for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP334-00045X-6S for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37940) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP333-00044G-UQ for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:42 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 345DF3DDBE; Fri, 10 May 2019 10:46:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8463A1001DE7; Fri, 10 May 2019 10:46:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BBB889DB5; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:31 +0200 Message-Id: <20190510104633.9428-12-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 10 May 2019 10:46:41 +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 v2 11/13] tests/vm: netbsd autoinstall, using serial console X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of fetching the prebuilt image from patchew download the install iso and prepare the image locally. Install to disk, using the serial console. Create qemu user, configure ssh login. Install packages needed for qemu builds. Signed-off-by: Gerd Hoffmann Reviewed-by: Kamil Rytarowski Tested-by: Thomas Huth --- tests/vm/netbsd | 187 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 177 insertions(+), 10 deletions(-) diff --git a/tests/vm/netbsd b/tests/vm/netbsd index 4c6624ea5ed5..6dbfc1b0fbe3 100755 --- a/tests/vm/netbsd +++ b/tests/vm/netbsd @@ -2,10 +2,11 @@ # # NetBSD VM image # -# Copyright 2017 Red Hat Inc. +# Copyright 2017-2019 Red Hat Inc. # # Authors: # Fam Zheng +# Gerd Hoffmann # # This code is licensed under the GPL version 2 or later. See # the COPYING file in the top-level directory. @@ -13,32 +14,198 @@ =20 import os import sys +import time import subprocess import basevm =20 class NetBSDVM(basevm.BaseVM): name =3D "netbsd" arch =3D "x86_64" + + link =3D "https://cdn.netbsd.org/pub/NetBSD/NetBSD-8.0/images/NetBSD-8= .0-amd64.iso" + size =3D "20G" + pkgs =3D [ + # tools + "git-base", + "pkgconf", + "xz", + "python37", + + # gnu tools + "bash", + "gmake", + "gsed", + "flex", "bison", + + # libs: crypto + "gnutls", + + # libs: images + "jpeg", + "png", + + # libs: ui + "SDL2", + "gtk3+", + "libxkbcommon", + ] + BUILD_SCRIPT =3D """ set -e; - rm -rf /var/tmp/qemu-test.* - cd $(mktemp -d /var/tmp/qemu-test.XXXXXX); + rm -rf /home/qemu/qemu-test.* + cd $(mktemp -d /home/qemu/qemu-test.XXXXXX); + mkdir src build; cd src; tar -xf /dev/rld1a; - ./configure --python=3Dpython2.7 {configure_opts}; + cd ../build + ../src/configure --python=3Dpython3.7 --disable-opengl {configure_= opts}; gmake --output-sync -j{jobs} {target} {verbose}; """ + poweroff =3D "/sbin/poweroff" =20 def build_image(self, img): - cimg =3D self._download_with_cache("http://download.patchew.org/ne= tbsd-7.1-amd64.img.xz", - sha256sum=3D'b633d565b0eac3d02015= cd0c81440bd8a7a8df8512615ac1ee05d318be015732') - img_tmp_xz =3D img + ".tmp.xz" + cimg =3D self._download_with_cache(self.link) img_tmp =3D img + ".tmp" - sys.stderr.write("Extracting the image...\n") - subprocess.check_call(["cp", "-f", cimg, img_tmp_xz]) - subprocess.check_call(["xz", "-dvf", img_tmp_xz]) + iso =3D img + ".install.iso" + + self.print_step("Preparing iso and disk image") + subprocess.check_call(["cp", "-f", cimg, iso]) + subprocess.check_call(["qemu-img", "create", "-f", "qcow2", + img_tmp, self.size]) + + self.print_step("Booting installer") + self.boot(img_tmp, extra_args =3D [ + "-device", "VGA", + "-machine", "graphics=3Doff", + "-cdrom", iso + ]) + self.console_init() + self.console_wait("Primary Bootstrap") + + # serial console boot menu output doesn't work for some + # reason, so we have to fly blind ... + for char in list("5consdev com0\n"): + time.sleep(0.2) + self.console_send(char) + self.console_wait("") + self.console_wait_send("> ", "boot\n") + + self.console_wait_send("Terminal type", "xterm\n") + self.console_wait_send("a: Installation messages", "a\n") + self.console_wait_send("b: US-English", "b\n") + self.console_wait_send("a: Install NetBSD", "a\n") + self.console_wait("Shall we continue?") + self.console_wait_send("b: Yes", "b\n") + + self.console_wait_send("a: ld0", "a\n") + self.console_wait_send("a: This is the correct", "a\n") + self.console_wait_send("b: Use the entire disk", "b\n") + self.console_wait("NetBSD bootcode") + self.console_wait_send("a: Yes", "a\n") + self.console_wait_send("b: Use existing part", "b\n") + self.console_wait_send("x: Partition sizes ok", "x\n") + self.console_wait_send("for your NetBSD disk", "\n") + self.console_wait("Shall we continue?") + self.console_wait_send("b: Yes", "b\n") + + self.console_wait_send("b: Use serial port com0", "b\n") + self.console_wait_send("f: Set serial baud rate", "f\n") + self.console_wait_send("a: 9600", "a\n") + self.console_wait_send("x: Exit", "x\n") + + self.console_wait_send("a: Full installation", "a\n") + self.console_wait_send("a: CD-ROM", "a\n") + + self.print_step("Installation started now, this will take a while") + self.console_wait_send("Hit enter to continue", "\n") + + 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_wait("New password:") + self.console_send("%s\n" % self.ROOT_PASS) + self.console_wait("Retype new password:") + self.console_send("%s\n" % self.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_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_wait("New password:") + self.console_send("%s\n" % self.GUEST_PASS) + self.console_wait("Retype new password:") + self.console_send("%s\n" % self.GUEST_PASS) + + self.console_wait_send("a: Configure network", "a\n") + self.console_wait_send("a: vioif0", "a\n") + self.console_wait_send("Network media type", "\n") + self.console_wait("autoconfiguration") + self.console_wait_send("a: Yes", "a\n") + self.console_wait_send("DNS domain", "localnet\n") + self.console_wait("Are they OK?") + self.console_wait_send("a: Yes", "a\n") + self.console_wait("installed in /etc") + self.console_wait_send("a: Yes", "a\n") + + self.console_wait_send("e: Enable install", "e\n") + proxy =3D os.environ.get("http_proxy") + if not proxy is None: + self.console_wait_send("f: Proxy", "f\n") + self.console_wait("Proxy") + self.console_send("%s\n" % proxy) + self.console_wait_send("x: Install pkgin", "x\n") + self.console_init(1200) + self.console_wait_send("Hit enter to continue", "\n") + self.console_init() + + self.console_wait_send("g: Enable sshd", "g\n") + self.console_wait_send("x: Finished conf", "x\n") + self.console_wait_send("Hit enter to continue", "\n") + + self.print_step("Installation finished, rebooting") + self.console_wait_send("d: Reboot the computer", "d\n") + + # setup qemu user + prompt =3D "localhost$" + self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_wait_send(prompt, "exit\n") + + # setup root user + prompt =3D "localhost#" + self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_sshd_config(prompt) + + # setup virtio-blk #1 (tarfile) + self.console_wait(prompt) + self.console_send("echo 'chmod 666 /dev/rld1a' >> /etc/rc.local\n") + + # turn off mprotect (conflicts with tcg) + self.console_wait(prompt) + self.console_send("echo security.pax.mprotect.enabled=3D0 >> /etc/= sysctl.conf\n") + + self.print_step("Configuration finished, rebooting") + self.console_wait_send(prompt, "reboot\n") + self.console_wait("login:") + self.wait_ssh() + + self.print_step("Installing packages") + self.ssh_root_check("pkgin update\n") + self.ssh_root_check("pkgin -y install %s\n" % " ".join(self.pkgs)) + + # shutdown + self.ssh_root(self.poweroff) + self.console_wait("entering state S5") + self.wait() + if os.path.exists(img): os.remove(img) os.rename(img_tmp, img) + os.remove(iso) + self.print_step("All done") =20 if __name__ =3D=3D "__main__": sys.exit(basevm.main(NetBSDVM)) --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557486222; cv=none; d=zoho.com; s=zohoarc; b=ER6fWPUElogV1yDmvldHNEXQaoJK/Of/jymBM0KJyiU0yYH7MY3kVojnqTMWvaFDAmsIXHCUI2WvWyrcqmkMRcP+ChGTTxWJBjO/cK22EXpppsWZ3GaG+PInVYGjXB2zDvL+u280Hx2VC/c5iJIQ0QB7dwnBl8ld4KSbjIQXnXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557486222; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=T0V7tjebjqM15wWEnukKkX3aeyX+wLHCHnGuYg3fPb8=; b=My4J0V3vO2OGsBAoMq9qWDpc1thzQ4kPSZ3sO1Yx4X0fi+AIlnRutf74optAsCZNC9Rb2Rl0uDKsZPf7+aTuVUUF5f0UKKr2wtlSlPF/Mh1UffHeutDjTx9/m8J9groiHfbRVD7A7cW3v2qo9Zs434aAgjnHN3QwzJS8MImPz9E= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557486222477839.5292638814477; Fri, 10 May 2019 04:03:42 -0700 (PDT) Received: from localhost ([127.0.0.1]:41182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP3JP-000629-Bb for importer@patchew.org; Fri, 10 May 2019 07:03:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP33A-0008Sq-Vp for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP339-0004F4-D4 for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34040) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP339-0004Dj-5P for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B3768830A; Fri, 10 May 2019 10:46:46 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C80557A1; Fri, 10 May 2019 10:46:41 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C73AA9DB6; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:32 +0200 Message-Id: <20190510104633.9428-13-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 10 May 2019 10:46:46 +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 v2 12/13] tests/vm: fedora autoinstall, using serial console X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Download the install iso and prepare the image locally. Install to disk, using the serial console. Create qemu user, configure ssh login. Install packages needed for qemu builds. Yes, we have docker images for fedora. But for trouble-shooting it might be helpful to have a vm too. When vm builds fail you can use it to figure whenever the vm setup or the guest os is the problem. Signed-off-by: Gerd Hoffmann Tested-by: Thomas Huth --- tests/vm/basevm.py | 9 +- tests/vm/Makefile.include | 3 +- tests/vm/fedora | 187 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 197 insertions(+), 2 deletions(-) create mode 100755 tests/vm/fedora diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index c4f67ee4c065..9cec3af7cc7e 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -204,7 +204,7 @@ class BaseVM(object): # log console line sys.stderr.write("con recv: %s\n" % line) =20 - def console_wait(self, expect): + def console_wait(self, expect, expectalt =3D None): vm =3D self._guest output =3D "" while True: @@ -213,6 +213,8 @@ class BaseVM(object): except socket.timeout: sys.stderr.write("console: *** read timeout ***\n") sys.stderr.write("console: waiting for: '%s'\n" % expect) + if not expectalt is None: + sys.stderr.write("console: waiting for: '%s' (alt)\n" = % expectalt) sys.stderr.write("console: line buffer:\n") sys.stderr.write("\n") self.console_log(output.rstrip()) @@ -221,6 +223,8 @@ class BaseVM(object): output +=3D chars if expect in output: break + if not expectalt is None and expectalt in output: + break if "\r" in output or "\n" in output: lines =3D re.split("[\r\n]", output) output =3D lines.pop() @@ -228,6 +232,9 @@ class BaseVM(object): self.console_log("\n".join(lines)) if self.debug: self.console_log(output) + if not expectalt is None and expectalt in output: + return False + return True =20 def console_send(self, command): vm =3D self._guest diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index 8714b5947958..6e24ee786910 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -2,7 +2,7 @@ =20 .PHONY: vm-build-all vm-clean-all =20 -IMAGES :=3D ubuntu.i386 freebsd netbsd openbsd centos +IMAGES :=3D ubuntu.i386 freebsd netbsd openbsd centos fedora IMAGES_DIR :=3D $(HOME)/.cache/qemu-vm/images IMAGE_FILES :=3D $(patsubst %, $(IMAGES_DIR)/%.img, $(IMAGES)) =20 @@ -16,6 +16,7 @@ vm-test: @echo " vm-build-netbsd - Build QEMU in NetBSD VM" @echo " vm-build-openbsd - Build QEMU in OpenBSD VM" @echo " vm-build-centos - Build QEMU in CentOS VM, with = Docker" + @echo " vm-build-fedora - Build QEMU in Fedora VM" @echo "" @echo " vm-build-all - Build QEMU in all VMs" @echo " vm-clean-all - Clean up VM images" diff --git a/tests/vm/fedora b/tests/vm/fedora new file mode 100755 index 000000000000..c5621d083221 --- /dev/null +++ b/tests/vm/fedora @@ -0,0 +1,187 @@ +#!/usr/bin/env python +# +# Fedora VM image +# +# Copyright 2019 Red Hat Inc. +# +# Authors: +# Gerd Hoffmann +# +# This code is licensed under the GPL version 2 or later. See +# the COPYING file in the top-level directory. +# + +import os +import re +import sys +import time +import socket +import subprocess +import basevm + +class FedoraVM(basevm.BaseVM): + name =3D "fedora" + arch =3D "x86_64" + + base =3D "http://dl.fedoraproject.org/pub/fedora/linux/releases/30/" + link =3D base + "Server/x86_64/iso/Fedora-Server-netinst-x86_64-30-1.2= .iso" + repo =3D base + "Server/x86_64/os/" + full =3D base + "Everything/x86_64/os/" + csum =3D "5e4eac4566d8c572bfb3bcf54b7d6c82006ec3c6c882a2c9235c6d3494d7= b100" + size =3D "20G" + pkgs =3D [ + # tools + 'git-core', + 'flex', 'bison', + 'gcc', 'binutils', 'make', + + # perl + 'perl-Test-Harness', + + # libs: usb + '"pkgconfig(libusb-1.0)"', + '"pkgconfig(libusbredirparser-0.5)"', + + # libs: crypto + '"pkgconfig(gnutls)"', + + # libs: ui + '"pkgconfig(sdl2)"', + '"pkgconfig(gtk+-3.0)"', + '"pkgconfig(ncursesw)"', + + # libs: audio + '"pkgconfig(libpulse)"', + '"pkgconfig(alsa)"', + ] + + BUILD_SCRIPT =3D """ + set -e; + rm -rf /home/qemu/qemu-test.* + cd $(mktemp -d /home/qemu/qemu-test.XXXXXX); + mkdir src build; cd src; + tar -xf /dev/vdb; + cd ../build + ../src/configure --python=3Dpython3 {configure_opts}; + gmake --output-sync -j{jobs} {target} {verbose}; + """ + + def build_image(self, img): + self.print_step("Downloading install iso") + cimg =3D self._download_with_cache(self.link, sha256sum=3Dself.csu= m) + img_tmp =3D img + ".tmp" + iso =3D img + ".install.iso" + + self.print_step("Preparing iso and disk image") + subprocess.check_call(["cp", "-f", cimg, iso]) + subprocess.check_call(["qemu-img", "create", "-f", "qcow2", + img_tmp, self.size]) + + self.print_step("Booting installer") + self.boot(img_tmp, extra_args =3D [ + "-machine", "graphics=3Doff", + "-cdrom", iso + ]) + self.console_init(300) + self.console_wait("installation process.") + time.sleep(0.3) + self.console_send("\t") + time.sleep(0.3) + self.console_send(" console=3DttyS0") + proxy =3D os.environ.get("http_proxy") + if not proxy is None: + self.console_send(" proxy=3D%s" % proxy) + self.console_send(" inst.repo=3D%s" % self.repo) + self.console_send("\n") + + self.console_wait_send("2) Use text mode", "2\n") + + self.console_wait_send("5) [!] Installation Dest", "5\n") + self.console_wait_send("1) [x]", "c\n") + self.console_wait_send("2) [ ] Use All Space", "2\n") + self.console_wait_send("2) [x] Use All Space", "c\n") + self.console_wait_send("1) [ ] Standard Part", "1\n") + self.console_wait_send("1) [x] Standard Part", "c\n") + + self.console_wait_send("7) [!] Root password", "7\n") + self.console_wait("Password:") + self.console_send("%s\n" % self.ROOT_PASS) + self.console_wait("Password (confirm):") + self.console_send("%s\n" % self.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("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_wait("Password (confirm):") + self.console_send("%s\n" % self.GUEST_PASS) + self.console_wait_send("7) Groups", "c\n") + + while True: + good =3D self.console_wait("3) [x] Installation", + "3) [!] Installation") + self.console_send("r\n") + if good: + break + time.sleep(10) + + while True: + good =3D self.console_wait("4) [x] Software", + "4) [!] Software") + self.console_send("r\n") + if good: + break + time.sleep(10) + self.console_send("r\n" % self.GUEST_PASS) + + self.console_wait_send("'b' to begin install", "b\n") + + self.print_step("Installation started now, this will take a while") + + self.console_wait_send("Installation complete", "\n") + self.print_step("Installation finished, rebooting") + + # setup qemu user + prompt =3D " ~]$" + self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS) + self.console_wait_send(prompt, "exit\n") + + # setup root user + prompt =3D " ~]#" + self.console_ssh_init(prompt, "root", self.ROOT_PASS) + self.console_sshd_config(prompt) + + # setup virtio-blk #1 (tarfile) + self.console_wait(prompt) + self.console_send("echo 'KERNEL=3D=3D\"vdb\" MODE=3D\"666\"' >> %s= \n" % + "/etc/udev/rules.d/99-qemu.rules") + + self.print_step("Configuration finished, rebooting") + self.console_wait_send(prompt, "reboot\n") + self.console_wait("login:") + self.wait_ssh() + + self.print_step("Installing packages") + self.ssh_root_check("rm -vf /etc/yum.repos.d/fedora*.repo\n") + self.ssh_root_check("echo '[fedora]' >> /etc/yum.repos.d/qemu.repo= \n") + self.ssh_root_check("echo 'baseurl=3D%s' >> /etc/yum.repos.d/qemu.= repo\n" % self.full) + self.ssh_root_check("echo 'gpgcheck=3D0' >> /etc/yum.repos.d/qemu.= repo\n") + self.ssh_root_check("dnf install -y %s\n" % " ".join(self.pkgs)) + + # shutdown + self.ssh_root(self.poweroff) + self.console_wait("sleep state S5") + self.wait() + + if os.path.exists(img): + os.remove(img) + os.rename(img_tmp, img) + os.remove(iso) + self.print_step("All done") + +if __name__ =3D=3D "__main__": + sys.exit(basevm.main(FedoraVM)) --=20 2.18.1 From nobody Mon May 6 06:49:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557485355; cv=none; d=zoho.com; s=zohoarc; b=Sl2N9oT81bzNKeIbMo+hLINLPCMbd8fq0F0Dz29FKhXDGQ5P51+b6Y2mQ/+cEbOZ3gR4RSObY5gO2V0K1Aivzqd2EL1LhfhmkaQWUYT8Vwr5Vcp30KD85Sw/FyAtpYcZKfW9rl5iY+9ZlInkrzh/DFYUCuXz4EBg5TEYPctVH0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557485355; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=q/Uqxj8MI8Bz3nxgSlrvs7yudvWMeZA6H3timtkV+cY=; b=EWuTUUGhh3eei04D5aaXNHxh/TWqjLDlctnTmy7KQ0uxhlAYqbbiTgHZy8W/rCJ5uKwO+f/MazuWhOgK2n7f8pkBV3H5QiHzX5ut6237oFPqGHXVabFdCGeH1VfFf3hCFM3b+nRLmfZiqwF75gDbG8cEBfFM7r/qe1tvLA0Ai8k= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557485355782697.6203179015524; Fri, 10 May 2019 03:49:15 -0700 (PDT) Received: from localhost ([127.0.0.1]:40958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP35U-0001A3-Tw for importer@patchew.org; Fri, 10 May 2019 06:49:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP335-0008Ls-QN for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP334-00047D-Om for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41632) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hP334-00045H-JG for qemu-devel@nongnu.org; Fri, 10 May 2019 06:46:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CDB49308795F; Fri, 10 May 2019 10:46:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-74.ams2.redhat.com [10.36.117.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B9132CF37; Fri, 10 May 2019 10:46:41 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CF3D79DB7; Fri, 10 May 2019 12:46:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 12:46:33 +0200 Message-Id: <20190510104633.9428-14-kraxel@redhat.com> In-Reply-To: <20190510104633.9428-1-kraxel@redhat.com> References: <20190510104633.9428-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 10 May 2019 10:46:41 +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 v2 13/13] tests/vm: ubuntu.i386: apt proxy setup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Ed Maste , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kamil Rytarowski , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Li-Wen Hsu , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Configure apt proxy so package downloads can be cached and can pass firewalls. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Thomas Huth --- tests/vm/ubuntu.i386 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/vm/ubuntu.i386 b/tests/vm/ubuntu.i386 index a22d137e76df..b869afd212fa 100755 --- a/tests/vm/ubuntu.i386 +++ b/tests/vm/ubuntu.i386 @@ -51,6 +51,10 @@ class UbuntuX86VM(basevm.BaseVM): " ssh-authorized-keys:\n", " - %s\n" % basevm.SSH_PUB_KEY, "locale: en_US.UTF-8\n"]) + proxy =3D os.environ.get("http_proxy") + if not proxy is None: + udata.writelines(["apt:\n", + " proxy: %s" % proxy]) udata.close() subprocess.check_call(["genisoimage", "-output", "cloud-init.iso", "-volid", "cidata", "-joliet", "-rock", --=20 2.18.1