From nobody Sat Feb 7 06:54:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=listsout.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail header.i=fam@euphon.net; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from listsout.gnu.org (listsout.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15467531786321003.8737021928154; Sat, 5 Jan 2019 21:39:38 -0800 (PST) Received: from localhost ([127.0.0.1]:48896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg19t-00046x-Gw for importer@patchew.org; Sun, 06 Jan 2019 00:39:37 -0500 Received: from eggsout.gnu.org ([209.51.188.92]:46098 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg161-0000v9-Co for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gg15z-0004MH-2t for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:37 -0500 Received: from sender2-op-o12.zoho.com.cn ([163.53.93.243]:17747 helo=sender1.zoho.com.cn) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg15y-0004Kf-Fc for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:35 -0500 Received: from localhost (120.52.147.40 [120.52.147.40]) by mx.zoho.com.cn with SMTPS id 1546752883870214.2197467440826; Sun, 6 Jan 2019 13:34:43 +0800 (CST) ARC-Seal: i=1; a=rsa-sha256; t=1546752884; cv=none; d=zoho.com.cn; s=zohoarc; b=qEYD5p++zAYj7TkoukiDOHZS1O8QLYOPcrm8ls/4epBFjwmPVrsxkTQTrCDvpm7sJ4t5mbAwU9MIiMSwhLDNzSqOB5l8YmFq+OrRPButPBwk66KHVDCTqZZiv+Ny48RQIjULGMGgGQSmYAiwcF5E4XgxxDWVQp8XlUgs7D9c/lY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1546752884; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=JExTmp1PiSunE4svQlfl9FlaPuH5a8LMw6+vI/nE4Io=; b=QNXsIAnKQcldyfPGQSyCuehyiPhZZleWlftrwMWikPIfDYmyQqPvUkn/B3hsHQMBUpXLrsog91Y6RGbO5iJd8a5R22W8u6HW9O29J4a33dRiavBnu7bchsPiFncQRrES8waWCJbQBc5DvB0dTcqR/j5hf96pwMvf5e0sJ9ISxnc= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=euphon.net; spf=pass smtp.mailfrom=fam@euphon.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1546752884; s=zoho; d=euphon.net; i=fam@euphon.net; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=5622; bh=JExTmp1PiSunE4svQlfl9FlaPuH5a8LMw6+vI/nE4Io=; b=X1E8y81/SjkfgV8le74Z/0vBgzoqm4UaLK7qrgDeB2rC2DOK9aFcc7FFwYKaghMw UhZK8uBT9WMRSkqvOhq3qzy5/Fw05DhFTQryGVZMQS38YPY+ft+JUpoaAnwUvdW4qYH 259nGRAxQxsgiMmcMi8DOIAsjA2zK6r/bBdaTgPI= From: Fam Zheng To: qemu-devel@nongnu.org Date: Sun, 6 Jan 2019 13:34:09 +0800 Message-Id: <20190106053409.10712-4-fam@euphon.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190106053409.10712-1-fam@euphon.net> References: <20190106053409.10712-1-fam@euphon.net> X-ZohoCNMailClient: External X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 163.53.93.243 Subject: [Qemu-devel] [PULL 3/3] tests: vm: auto_install OpenBSD 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 , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng Upgrade OpenBSD to 6.4 using auto_install. Especially, drop SDL1, include SDL2. Also do the build in $HOME since both /var/tmp and /tmp are tmpfs with limited capacities. Signed-off-by: Fam Zheng Message-Id: <20181031025712.18602-1-famz@redhat.com> Signed-off-by: Fam Zheng --- tests/vm/basevm.py | 6 ++-- tests/vm/openbsd | 85 ++++++++++++++++++++++++++++++++++++++++++++++----= ---- 2 files changed, 76 insertions(+), 15 deletions(-) diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 5caf77d6b8..6fb446d4c5 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -68,8 +68,6 @@ class BaseVM(object): self._args =3D [ \ "-nodefaults", "-m", "4G", "-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"= )] if vcpus and vcpus > 1: @@ -146,8 +144,10 @@ class BaseVM(object): "-device", "virtio-blk,drive=3D%s,serial=3D%s,bootindex= =3D1" % (name, name)] =20 - def boot(self, img, extra_args=3D[]): + def boot(self, img, extra_args=3D[], extra_usernet_args=3D""): args =3D self._args + [ + "-netdev", "user,id=3Dvnet,hostfwd=3D:127.0.0.1:0-:22" + extra= _usernet_args, + "-device", "virtio-net-pci,netdev=3Dvnet", "-device", "VGA", "-drive", "file=3D%s,if=3Dnone,id=3Ddrive0,cache=3Dwriteback" = % img, "-device", "virtio-blk,drive=3Ddrive0,bootindex=3D0"] diff --git a/tests/vm/openbsd b/tests/vm/openbsd index cfe0572c59..99a7e98d80 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -14,6 +14,9 @@ import os import sys import subprocess +import time +import atexit +import tempfile import basevm =20 class OpenBSDVM(basevm.BaseVM): @@ -21,25 +24,83 @@ class OpenBSDVM(basevm.BaseVM): arch =3D "x86_64" BUILD_SCRIPT =3D """ set -e; - rm -rf /var/tmp/qemu-test.* - cd $(mktemp -d /var/tmp/qemu-test.XXXXXX); + rm -rf $HOME/qemu-test.* + cd $(mktemp -d $HOME/qemu-test.XXXXXX); tar -xf /dev/rsd1c; - ./configure --cc=3Dx86_64-unknown-openbsd6.1-gcc-4.9.4 --python=3D= python2.7 {configure_opts}; + ./configure {configure_opts}; gmake --output-sync -j{jobs} {verbose}; # XXX: "gmake check" seems to always hang or fail #gmake --output-sync -j{jobs} check {verbose}; """ =20 + def _install_os(self, img): + tmpdir =3D tempfile.mkdtemp() + pxeboot =3D self._download_with_cache("https://fastly.cdn.openbsd.= org/pub/OpenBSD/6.4/amd64/pxeboot", + sha256sum=3D"d87ab39d941ff926d693943a927585945456ccedb76ea= 504a251b4b93cd4c266") + bsd_rd =3D self._download_with_cache("https://fastly.cdn.openbsd.o= rg/pub/OpenBSD/6.4/amd64/bsd.rd", + sha256sum=3D"89505c683cbcd75582fe475e847ed53d89e2b8180c3e3= d61f4eb4b76b5e11f5c") + install =3D self._download_with_cache("https://fastly.cdn.openbsd.= org/pub/OpenBSD/6.4/amd64/install64.iso", + sha256sum=3D'81833b79e23dc0f961ac5fb34484bca66386deb3181dd= b8236870fa4f488cdd2') + subprocess.check_call(["qemu-img", "create", img, "32G"]) + subprocess.check_call(["cp", pxeboot, os.path.join(tmpdir, "auto_i= nstall")]) + subprocess.check_call(["cp", bsd_rd, os.path.join(tmpdir, "bsd")]) + + self._gen_install_conf(tmpdir) + # BOOTP filename being auto_install makes sure OpenBSD installer + # not prompt for "auto install mode" + usernet_args =3D ",tftp=3D%s,bootfile=3D/auto_install" % tmpdir + usernet_args +=3D ",tftp-server-name=3D10.0.2.4" + usernet_args +=3D ",guestfwd=3Dtcp:10.0.2.4:80-cmd:cat %s" % \ + os.path.join(tmpdir, "install.conf") + self.boot(img, + extra_args=3D["-boot", "once=3Dn", "-no-reboot", + "-cdrom", install], + extra_usernet_args=3Dusernet_args) + self.wait() + + def _gen_install_conf(self, tmpdir): + contents =3D """\ +HTTP/1.0 200 OK + +System hostname =3D qemu-openbsd +Password for root =3D qemupass +Public ssh key for root =3D {pub_key} +Allow root ssh login =3D yes +Network interfaces =3D vio0 +IPv4 address for vio0 =3D dhcp +Setup a user =3D qemu +Password for user =3D qemupass +Public ssh key for user =3D {pub_key} +What timezone are you in =3D US/Eastern +Server =3D fastly.cdn.openbsd.org +Use http =3D yes +Default IPv4 route =3D 10.0.2.2 +Location of sets =3D cd0 +Set name(s) =3D all +Continue without verification =3D yes +""".format(pub_key=3Dbasevm.SSH_PUB_KEY) + with open(os.path.join(tmpdir, "install.conf"), "w") as f: + f.write(contents) + 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" - img_tmp =3D img + ".tmp" - subprocess.check_call(["cp", "-f", cimg, img_tmp_xz]) - subprocess.check_call(["xz", "-df", img_tmp_xz]) - if os.path.exists(img): - os.remove(img) - os.rename(img_tmp, img) + + self._install_os(img + ".tmp") + + self.boot(img + ".tmp") + self.wait_ssh() + + self.ssh_root("usermod -G operator qemu") + self.ssh_root("echo https://fastly.cdn.openbsd.org/pub/OpenBSD > /= etc/installurl") + for pkg in ["git", "gmake", "glib2", "bison", "sdl2"]: + self.ssh_root("pkg_add " + pkg) + self.ssh_root("ln -sf /usr/local/bin/python2.7 /usr/local/bin/pyth= on") + self.ssh_root("ln -sf /usr/local/bin/python2.7-2to3 /usr/local/bin= /2to3") + self.ssh_root("ln -sf /usr/local/bin/python2.7-config /usr/local/b= in/python-config") + self.ssh_root("ln -sf /usr/local/bin/pydoc2.7 /usr/local/bin/pydoc= ") + self.ssh_root("shutdown -p now") + self.wait() + + subprocess.check_call(["mv", img + ".tmp", img]) =20 if __name__ =3D=3D "__main__": sys.exit(basevm.main(OpenBSDVM)) --=20 2.11.0