aboutsummaryrefslogtreecommitdiff
path: root/tests/vm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/vm')
-rw-r--r--tests/vm/Makefile.include3
-rw-r--r--tests/vm/basevm.py5
-rwxr-xr-xtests/vm/haiku.x86_64119
-rwxr-xr-xtests/vm/netbsd6
4 files changed, 127 insertions, 6 deletions
diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index 61f893ffdc..e94d95ec54 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -4,7 +4,7 @@
EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd)
-IMAGES := freebsd netbsd openbsd centos fedora
+IMAGES := freebsd netbsd openbsd centos fedora haiku.x86_64
ifneq ($(GENISOIMAGE),)
IMAGES += ubuntu.i386 centos
ifneq ($(EFI_AARCH64),)
@@ -41,6 +41,7 @@ endif
else
@echo " (install genisoimage to build centos/ubuntu images)"
endif
+ @echo " vm-build-haiku.x86_64 - Build QEMU in Haiku VM"
@echo ""
@echo " vm-build-all - Build QEMU in all VMs"
@echo " vm-clean-all - Clean up VM images"
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 3fac20e929..00f1d5ca8d 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -44,6 +44,7 @@ DEFAULT_CONFIG = {
'machine' : 'pc',
'guest_user' : "qemu",
'guest_pass' : "qemupass",
+ 'root_user' : "root",
'root_pass' : "qemupass",
'ssh_key_file' : SSH_KEY_FILE,
'ssh_pub_key_file': SSH_PUB_KEY_FILE,
@@ -245,13 +246,13 @@ class BaseVM(object):
return self._ssh_do(self._config["guest_user"], cmd, False)
def ssh_root(self, *cmd):
- return self._ssh_do("root", cmd, False)
+ return self._ssh_do(self._config["root_user"], cmd, False)
def ssh_check(self, *cmd):
self._ssh_do(self._config["guest_user"], cmd, True)
def ssh_root_check(self, *cmd):
- self._ssh_do("root", cmd, True)
+ self._ssh_do(self._config["root_user"], cmd, True)
def build_image(self, img):
raise NotImplementedError
diff --git a/tests/vm/haiku.x86_64 b/tests/vm/haiku.x86_64
new file mode 100755
index 0000000000..37af48bf1b
--- /dev/null
+++ b/tests/vm/haiku.x86_64
@@ -0,0 +1,119 @@
+#!/usr/bin/env python3
+#
+# Haiku VM image
+#
+# Copyright 2020 Haiku, Inc.
+#
+# Authors:
+# Alexander von Gluck IV <kallisti5@unixzen.com>
+#
+# 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
+
+VAGRANT_KEY_FILE = os.path.join(os.path.dirname(__file__),
+ "..", "keys", "vagrant")
+
+VAGRANT_PUB_KEY_FILE = os.path.join(os.path.dirname(__file__),
+ "..", "keys", "vagrant.pub")
+
+HAIKU_CONFIG = {
+ 'cpu' : "max",
+ 'machine' : 'pc',
+ 'guest_user' : "vagrant",
+ 'guest_pass' : "",
+ 'root_user' : "vagrant",
+ 'root_pass' : "",
+ 'ssh_key_file' : VAGRANT_KEY_FILE,
+ 'ssh_pub_key_file': VAGRANT_PUB_KEY_FILE,
+ 'memory' : "4G",
+ 'extra_args' : [],
+ 'qemu_args' : "-device VGA",
+ 'dns' : "",
+ 'ssh_port' : 0,
+ 'install_cmds' : "",
+ 'boot_dev_type' : "block",
+ 'ssh_timeout' : 1,
+}
+
+class HaikuVM(basevm.BaseVM):
+ name = "haiku"
+ arch = "x86_64"
+
+ link = "https://app.vagrantup.com/haiku-os/boxes/r1beta2-x86_64/versions/20200702/providers/libvirt.box"
+ csum = "41c38b316e0cbdbc66b5dbaf3612b866700a4f35807cb1eb266a5bf83e9e68d5"
+
+ poweroff = "shutdown"
+
+ requirements = [
+ "devel:libbz2",
+ "devel:libcapstone",
+ "devel:libcurl",
+ "devel:libfdt",
+ "devel:libgcrypt",
+ "devel:libgl",
+ "devel:libglib_2.0",
+ "devel:libgnutls",
+ "devel:libgpg_error",
+ "devel:libintl",
+ "devel:libjpeg",
+ "devel:liblzo2",
+ "devel:libncursesw",
+ "devel:libnettle",
+ "devel:libpixman_1",
+ "devel:libpng16",
+ "devel:libsdl2_2.0",
+ "devel:libsnappy",
+ "devel:libssh2",
+ "devel:libtasn1",
+ "devel:libusb_1.0",
+ "devel:libz",
+ "ninja",
+ "setuptools_python3"
+ ]
+
+ # https://dev.haiku-os.org/ticket/16512 virtio disk1 shows up as 0 (reversed order)
+ BUILD_SCRIPT = """
+ set -e;
+ rm -rf /tmp/qemu-test.*
+ cd $(mktemp -d /tmp/qemu-test.XXXXXX);
+ mkdir src build; cd src;
+ tar -xf /dev/disk/virtual/virtio_block/0/raw;
+ mkdir -p /usr/bin
+ ln -s /boot/system/bin/env /usr/bin/env
+ cd ../build
+ ../src/configure --disable-slirp {configure_opts};
+ make --output-sync -j{jobs} {target} {verbose};
+ """
+
+ def build_image(self, img):
+ self.print_step("Downloading disk image")
+ tarball = self._download_with_cache(self.link, sha256sum=self.csum)
+
+ self.print_step("Extracting disk image")
+
+ subprocess.check_call(["tar", "xzf", tarball, "./box.img", "-O"],
+ stdout=open(img, 'wb'))
+
+ self.print_step("Preparing disk image")
+ self.boot(img)
+
+ # Wait for ssh to be available.
+ self.wait_ssh(wait_root=True, cmd="exit 0")
+
+ # Install packages
+ self.ssh_root("pkgman install -y %s" % " ".join(self.requirements))
+ self.graceful_shutdown()
+
+ self.print_step("All done")
+
+if __name__ == "__main__":
+ sys.exit(basevm.main(HaikuVM, config=HAIKU_CONFIG))
diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index 447de9747d..596717cc76 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -22,8 +22,8 @@ class NetBSDVM(basevm.BaseVM):
name = "netbsd"
arch = "x86_64"
- link = "https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/images/NetBSD-9.0-amd64.iso"
- csum = "34da4882ee61bdbf69f241195a8933dc800949d30b43fc6988da853d57fc2b8cac50cf97a0d2adaf93250b4e329d189c1a8b83c33bd515226f37745d50c33369"
+ link = "https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/images/NetBSD-9.1-amd64.iso"
+ csum = "65bddc95945991c3b2021f9c8ded7f34c25f0a7611b7aa15a15fe23399e902307e926ae97fcd01dc1662ac67b5f6e4be643c6a2b581692ddcb616d30125066f9"
size = "20G"
pkgs = [
# tools
@@ -38,7 +38,7 @@ class NetBSDVM(basevm.BaseVM):
"bash",
"gmake",
"gsed",
- "gettext",
+ "gettext-tools",
# libs: crypto
"gnutls",