aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/acceptance/linux_ssh_mips_malta.py106
-rw-r--r--tests/docker/Makefile.include6
-rw-r--r--tests/docker/dockerfiles/travis.docker6
-rwxr-xr-xtests/qemu-iotests/1183
-rw-r--r--tests/qemu-iotests/iotests.py10
-rw-r--r--tests/rtc-test.c3
-rw-r--r--tests/vhost-user-bridge.c8
-rwxr-xr-xtests/vm/basevm.py5
-rwxr-xr-xtests/vm/netbsd7
9 files changed, 97 insertions, 57 deletions
diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/linux_ssh_mips_malta.py
index 25a1df5098..aa12001942 100644
--- a/tests/acceptance/linux_ssh_mips_malta.py
+++ b/tests/acceptance/linux_ssh_mips_malta.py
@@ -25,15 +25,44 @@ class LinuxSSH(Test):
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
VM_IP = '127.0.0.1'
+ BASE_URL = 'https://people.debian.org/~aurel32/qemu/'
IMAGE_INFO = {
- 'be': {'image_url': ('https://people.debian.org/~aurel32/qemu/mips/'
- 'debian_wheezy_mips_standard.qcow2'),
- 'image_hash': '8987a63270df67345b2135a6b7a4885a35e392d5'},
- 'le': {'image_url': ('https://people.debian.org/~aurel32/qemu/mipsel/'
- 'debian_wheezy_mipsel_standard.qcow2'),
- 'image_hash': '7866764d9de3ef536ffca24c9fb9f04ffdb45802'}
+ 'be': {'base_url': 'mips',
+ 'image_name': 'debian_wheezy_mips_standard.qcow2',
+ 'image_hash': '8987a63270df67345b2135a6b7a4885a35e392d5',
+ 'kernel_hash': {
+ 32: '592e384a4edc16dade52a6cd5c785c637bcbc9ad',
+ 64: 'db6eea7de35d36c77d8c165b6bcb222e16eb91db'}
+ },
+ 'le': {'base_url': 'mipsel',
+ 'image_name': 'debian_wheezy_mipsel_standard.qcow2',
+ 'image_hash': '7866764d9de3ef536ffca24c9fb9f04ffdb45802',
+ 'kernel_hash': {
+ 32: 'a66bea5a8adaa2cb3d36a1d4e0ccdb01be8f6c2a',
+ 64: '6a7f77245acf231415a0e8b725d91ed2f3487794'}
+ }
}
+ CPU_INFO = {
+ 32: {'cpu': 'MIPS 24Kc', 'kernel_release': '3.2.0-4-4kc-malta'},
+ 64: {'cpu': 'MIPS 20Kc', 'kernel_release': '3.2.0-4-5kc-malta'}
+ }
+
+ def get_url(self, endianess, path=''):
+ qkey = {'le': 'el', 'be': ''}
+ return '%s/mips%s/%s' % (self.BASE_URL, qkey[endianess], path)
+
+ def get_image_info(self, endianess):
+ dinfo = self.IMAGE_INFO[endianess]
+ image_url = self.get_url(endianess, dinfo['image_name'])
+ image_hash = dinfo['image_hash']
+ return (image_url, image_hash)
+ def get_kernel_info(self, endianess, wordsize):
+ minfo = self.CPU_INFO[wordsize]
+ kernel_url = self.get_url(endianess,
+ 'vmlinux-%s' % minfo['kernel_release'])
+ kernel_hash = self.IMAGE_INFO[endianess]['kernel_hash'][wordsize]
+ return kernel_url, kernel_hash
@skipUnless(ssh.SSH_CLIENT_BINARY, 'No SSH client available')
@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
@@ -91,8 +120,7 @@ class LinuxSSH(Test):
return stdout_lines, stderr_lines
def boot_debian_wheezy_image_and_ssh_login(self, endianess, kernel_path):
- image_url = self.IMAGE_INFO[endianess]['image_url']
- image_hash = self.IMAGE_INFO[endianess]['image_hash']
+ image_url, image_hash = self.get_image_info(endianess)
image_path = self.fetch_asset(image_url, asset_hash=image_hash)
self.vm.set_machine('malta')
@@ -102,7 +130,7 @@ class LinuxSSH(Test):
self.vm.add_args('-no-reboot',
'-kernel', kernel_path,
'-append', kernel_command_line,
- '-hda', image_path,
+ '-drive', 'file=%s,snapshot=on' % image_path,
'-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
'-device', 'pcnet,netdev=vnet')
self.vm.launch()
@@ -127,34 +155,31 @@ class LinuxSSH(Test):
else:
self.fail('"%s" output does not contain "%s"' % (cmd, exp))
- def run_common_commands(self):
+ def run_common_commands(self, wordsize):
self.ssh_command_output_contains(
'cat /proc/cpuinfo',
- '24Kc')
+ self.CPU_INFO[wordsize]['cpu'])
self.ssh_command_output_contains(
'uname -m',
'mips')
self.ssh_command_output_contains(
'uname -r',
- '3.2.0-4-4kc-malta')
+ self.CPU_INFO[wordsize]['kernel_release'])
self.ssh_command_output_contains(
'cat /proc/interrupts',
- 'timer')
+ 'XT-PIC timer')
self.ssh_command_output_contains(
'cat /proc/interrupts',
- 'i8042')
+ 'XT-PIC i8042')
self.ssh_command_output_contains(
'cat /proc/interrupts',
- 'serial')
+ 'XT-PIC serial')
self.ssh_command_output_contains(
'cat /proc/interrupts',
- 'ata_piix')
+ 'XT-PIC ata_piix')
self.ssh_command_output_contains(
'cat /proc/interrupts',
- 'eth0')
- self.ssh_command_output_contains(
- 'cat /proc/interrupts',
- 'eth0')
+ 'XT-PIC eth0')
self.ssh_command_output_contains(
'cat /proc/devices',
'input')
@@ -166,13 +191,13 @@ class LinuxSSH(Test):
'fb')
self.ssh_command_output_contains(
'cat /proc/ioports',
- 'serial')
+ ' : serial')
self.ssh_command_output_contains(
'cat /proc/ioports',
- 'ata_piix')
+ ' : ata_piix')
self.ssh_command_output_contains(
'cat /proc/ioports',
- 'piix4_smbus')
+ ' : piix4_smbus')
self.ssh_command_output_contains(
'lspci -d 11ab:4620',
'GT-64120')
@@ -182,18 +207,21 @@ class LinuxSSH(Test):
self.ssh_command_output_contains(
'cat /proc/mtd',
'YAMON')
- # Empty 'Board Config'
+ # Empty 'Board Config' (64KB)
self.ssh_command_output_contains(
'md5sum /dev/mtd2ro',
'0dfbe8aa4c20b52e1b8bf3cb6cbdf193')
- def check_mips_malta(self, endianess, kernel_path, uname_m):
+ def check_mips_malta(self, uname_m, endianess):
+ wordsize = 64 if '64' in uname_m else 32
+ kernel_url, kernel_hash = self.get_kernel_info(endianess, wordsize)
+ kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
self.boot_debian_wheezy_image_and_ssh_login(endianess, kernel_path)
stdout, _ = self.ssh_command('uname -a')
self.assertIn(True, [uname_m + " GNU/Linux" in line for line in stdout])
- self.run_common_commands()
+ self.run_common_commands(wordsize)
self.shutdown_via_ssh()
def test_mips_malta32eb_kernel3_2_0(self):
@@ -203,12 +231,7 @@ class LinuxSSH(Test):
:avocado: tags=endian:big
:avocado: tags=device:pcnet32
"""
- kernel_url = ('https://people.debian.org/~aurel32/qemu/mips/'
- 'vmlinux-3.2.0-4-4kc-malta')
- kernel_hash = '592e384a4edc16dade52a6cd5c785c637bcbc9ad'
- kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-
- self.check_mips_malta('be', kernel_path, 'mips')
+ self.check_mips_malta('mips', 'be')
def test_mips_malta32el_kernel3_2_0(self):
"""
@@ -217,12 +240,7 @@ class LinuxSSH(Test):
:avocado: tags=endian:little
:avocado: tags=device:pcnet32
"""
- kernel_url = ('https://people.debian.org/~aurel32/qemu/mipsel/'
- 'vmlinux-3.2.0-4-4kc-malta')
- kernel_hash = 'a66bea5a8adaa2cb3d36a1d4e0ccdb01be8f6c2a'
- kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-
- self.check_mips_malta('le', kernel_path, 'mips')
+ self.check_mips_malta('mips', 'le')
def test_mips_malta64eb_kernel3_2_0(self):
"""
@@ -231,11 +249,7 @@ class LinuxSSH(Test):
:avocado: tags=endian:big
:avocado: tags=device:pcnet32
"""
- kernel_url = ('https://people.debian.org/~aurel32/qemu/mips/'
- 'vmlinux-3.2.0-4-5kc-malta')
- kernel_hash = 'db6eea7de35d36c77d8c165b6bcb222e16eb91db'
- kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
- self.check_mips_malta('be', kernel_path, 'mips64')
+ self.check_mips_malta('mips64', 'be')
def test_mips_malta64el_kernel3_2_0(self):
"""
@@ -244,8 +258,4 @@ class LinuxSSH(Test):
:avocado: tags=endian:little
:avocado: tags=device:pcnet32
"""
- kernel_url = ('https://people.debian.org/~aurel32/qemu/mipsel/'
- 'vmlinux-3.2.0-4-5kc-malta')
- kernel_hash = '6a7f77245acf231415a0e8b725d91ed2f3487794'
- kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
- self.check_mips_malta('le', kernel_path, 'mips64')
+ self.check_mips_malta('mips64', 'le')
diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 89c56a3a88..19dbe26169 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -2,6 +2,8 @@
.PHONY: docker docker-test docker-clean docker-image docker-qemu-src
+HOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m))
+
DOCKER_SUFFIX := .docker
DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
# we don't run tests on intermediate images (used as base by another image)
@@ -88,7 +90,7 @@ endif
# Enforce dependencies for composite images
docker-image-debian9-mxe: docker-image-debian9
-ifeq ($(ARCH),x86_64)
+ifeq ($(HOST_ARCH),x86_64)
docker-image-debian-amd64: docker-image-debian9
DOCKER_PARTIAL_IMAGES += debian-amd64-cross
else
@@ -106,7 +108,7 @@ docker-image-debian-win32-cross: docker-image-debian9-mxe
docker-image-debian-win64-cross: docker-image-debian9-mxe
# For non-x86 hosts not all cross-compilers have been packaged
-ifneq ($(ARCH),x86_64)
+ifneq ($(HOST_ARCH),x86_64)
DOCKER_PARTIAL_IMAGES += debian-mips-cross debian-mipsel-cross debian-mips64el-cross
DOCKER_PARTIAL_IMAGES += debian-ppc64el-cross
DOCKER_PARTIAL_IMAGES += debian-s390x-cross
diff --git a/tests/docker/dockerfiles/travis.docker b/tests/docker/dockerfiles/travis.docker
index ea14da29d9..e8eb48dccf 100644
--- a/tests/docker/dockerfiles/travis.docker
+++ b/tests/docker/dockerfiles/travis.docker
@@ -1,4 +1,8 @@
-FROM travisci/ci-sardonyx:packer-1546978056-2c98a19
+#
+# Travis Image - this is broadly the same image that we run our CI
+# tests on.
+#
+FROM travisci/ci-sardonyx:packer-1552557266-f909ac5
ENV DEBIAN_FRONTEND noninteractive
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118
index ea0b326ae0..e20080e9a6 100755
--- a/tests/qemu-iotests/118
+++ b/tests/qemu-iotests/118
@@ -446,6 +446,7 @@ class TestChangeReadOnly(ChangeBaseClass):
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
+ @iotests.skip_if_user_is_root
def test_rw_ro_retain(self):
os.chmod(new_img, 0o444)
self.vm.add_drive(old_img, 'media=disk', 'none')
@@ -530,6 +531,7 @@ class TestChangeReadOnly(ChangeBaseClass):
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
+ @iotests.skip_if_user_is_root
def test_make_ro_rw(self):
os.chmod(new_img, 0o444)
self.vm.add_drive(old_img, 'media=disk', 'none')
@@ -571,6 +573,7 @@ class TestChangeReadOnly(ChangeBaseClass):
self.assert_qmp(result, 'return[0]/inserted/ro', True)
self.assert_qmp(result, 'return[0]/inserted/image/filename', new_img)
+ @iotests.skip_if_user_is_root
def test_make_ro_rw_by_retain(self):
os.chmod(new_img, 0o444)
self.vm.add_drive(old_img, 'media=disk', 'none')
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 693fde155a..709def4d5d 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -931,6 +931,16 @@ def skip_if_unsupported(required_formats=[], read_only=False):
return func_wrapper
return skip_test_decorator
+def skip_if_user_is_root(func):
+ '''Skip Test Decorator
+ Runs the test only without root permissions'''
+ def func_wrapper(*args, **kwargs):
+ if os.getuid() == 0:
+ case_notrun('{}: cannot be run as root'.format(args[0]))
+ else:
+ return func(*args, **kwargs)
+ return func_wrapper
+
def execute_unittest(output, verbosity, debug):
runner = unittest.TextTestRunner(stream=output, descriptions=True,
verbosity=verbosity)
diff --git a/tests/rtc-test.c b/tests/rtc-test.c
index 6309b0ef6c..c7af34f6b1 100644
--- a/tests/rtc-test.c
+++ b/tests/rtc-test.c
@@ -15,7 +15,8 @@
#include "libqtest-single.h"
#include "qemu/timer.h"
-#include "hw/timer/mc146818rtc_regs.h"
+#include "hw/rtc/mc146818rtc.h"
+#include "hw/rtc/mc146818rtc_regs.h"
#define UIP_HOLD_LENGTH (8 * NANOSECONDS_PER_SECOND / 32768)
diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c
index c4e350e1f5..6c3d490611 100644
--- a/tests/vhost-user-bridge.c
+++ b/tests/vhost-user-bridge.c
@@ -468,8 +468,8 @@ vubr_queue_set_started(VuDev *dev, int qidx, bool started)
if (started && vubr->notifier.fd >= 0) {
vu_set_queue_host_notifier(dev, vq, vubr->notifier.fd,
- getpagesize(),
- qidx * getpagesize());
+ qemu_real_host_page_size,
+ qidx * qemu_real_host_page_size);
}
if (qidx % 2 == 1) {
@@ -594,7 +594,7 @@ static void *notifier_thread(void *arg)
{
VuDev *dev = (VuDev *)arg;
VubrDev *vubr = container_of(dev, VubrDev, vudev);
- int pagesize = getpagesize();
+ int pagesize = qemu_real_host_page_size;
int qidx;
while (true) {
@@ -630,7 +630,7 @@ vubr_host_notifier_setup(VubrDev *dev)
void *addr;
int fd;
- length = getpagesize() * VHOST_USER_BRIDGE_MAX_QUEUES;
+ length = qemu_real_host_page_size * VHOST_USER_BRIDGE_MAX_QUEUES;
fd = mkstemp(template);
if (fd < 0) {
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index b5d1479bee..2929de23aa 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -57,6 +57,8 @@ class BaseVM(object):
arch = "#arch"
# command to halt the guest, can be overridden by subclasses
poweroff = "poweroff"
+ # enable IPv6 networking
+ ipv6 = True
def __init__(self, debug=False, vcpus=None):
self._guest = None
self._tmpdir = os.path.realpath(tempfile.mkdtemp(prefix="vm-test-",
@@ -81,7 +83,8 @@ class BaseVM(object):
self._args = [ \
"-nodefaults", "-m", "4G",
"-cpu", "max",
- "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22",
+ "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22" +
+ (",ipv6=no" if not self.ipv6 else ""),
"-device", "virtio-net-pci,netdev=vnet",
"-vnc", "127.0.0.1:0,to=20"]
if vcpus and vcpus > 1:
diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index ee9eaeab50..18aa56ae82 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -28,6 +28,13 @@ class NetBSDVM(basevm.BaseVM):
gmake --output-sync -j{jobs} {target} {verbose};
"""
+ # Workaround for NetBSD + IPv6 + slirp issues.
+ # NetBSD seems to ignore the ICMPv6 Destination Unreachable
+ # messages generated by slirp. When the host has no IPv6
+ # connectivity, this causes every connection to ftp.NetBSD.org
+ # take more than a minute to be established.
+ ipv6 = False
+
def build_image(self, img):
cimg = self._download_with_cache("http://download.patchew.org/netbsd-7.1-amd64.img.xz",
sha256sum='b633d565b0eac3d02015cd0c81440bd8a7a8df8512615ac1ee05d318be015732')