From 285cecd655220daf474a9733fb277b307eacbd5f Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 6 Nov 2018 14:27:06 +0100 Subject: [PATCH 1/9] scripts/device-crash-test: Remove known crashes Looks like we've fixed them all already in the past months, e.g. with: f7d6bfcdc0fe49040aac3ac131a319cb5427957e spapr_pci: fail gracefully with non-pseries machine types 2363d5ee231bf047479422d56d3b85b7d37a7c23 hw/ppc/spapr_cpu_core: Add a proper check for spapr machine ef0e8fc768a561dd13a86420b3268f6f3d5d0621 iommu: Don't crash if machine is not PC_MACHINE 8929fc3a55f33a103adddf9cfd010bcf2b255c7d hw/block/pflash_cfi*.c: fix confusing assert fail message ... so we can remove these entries from the ERROR_WHITELIST now. Signed-off-by: Thomas Huth Message-Id: <1541510826-21031-1-git-send-email-thuth@redhat.com> Signed-off-by: Eduardo Habkost --- scripts/device-crash-test | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/scripts/device-crash-test b/scripts/device-crash-test index e93a7c0c84..549162a547 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -182,21 +182,6 @@ ERROR_WHITELIST = [ # other exitcode=1 failures not listed above will just generate INFO messages: {'exitcode':1, 'loglevel':logging.INFO}, - # KNOWN CRASHES: - # Known crashes will generate error messages, but won't be fatal. - # Those entries must be removed once we fix the crashes. - {'exitcode':-6, 'log':r"Device 'serial0' is in use", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"qemu_net_client_setup: Assertion `!peer->peer' failed", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r'RAMBlock "[\w.-]+" already registered', 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"find_ram_offset: Assertion `size != 0' failed.", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"add_cpreg_to_hashtable: code should not be reached", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"qemu_alloc_display: Assertion `surface->image != NULL' failed", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"Unexpected error in error_set_from_qdev_prop_error", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"Object .* is not an instance of type spapr-machine", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"Object .* is not an instance of type generic-pc-machine", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"Object .* is not an instance of type e500-ccsr", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'log':r"vmstate_register_with_alias_id: Assertion `!se->compat \|\| se->instance_id == 0' failed", 'loglevel':logging.ERROR}, - # everything else (including SIGABRT and SIGSEGV) will be a fatal error: {'exitcode':None, 'fatal':True, 'loglevel':logging.FATAL}, ] From 9ab5a24b5298ae8272607a8ffc9ba20c15acefaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 8 Nov 2018 15:34:22 +0100 Subject: [PATCH 2/9] scripts: Remove unused python imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-by: LGTM code review Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20181108143422.15955-1-philmd@redhat.com> Signed-off-by: Eduardo Habkost --- scripts/analyse-locks-simpletrace.py | 1 - scripts/analyze-migration.py | 1 - scripts/device-crash-test | 1 - scripts/simpletrace.py | 1 - scripts/tracetool.py | 2 -- scripts/tracetool/format/simpletrace_stap.py | 2 +- 6 files changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/analyse-locks-simpletrace.py b/scripts/analyse-locks-simpletrace.py index 30090bdfff..7d9b574300 100755 --- a/scripts/analyse-locks-simpletrace.py +++ b/scripts/analyse-locks-simpletrace.py @@ -7,7 +7,6 @@ # from __future__ import print_function -import os import simpletrace import argparse import numpy as np diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py index 5c2010c917..e527eb168e 100755 --- a/scripts/analyze-migration.py +++ b/scripts/analyze-migration.py @@ -23,7 +23,6 @@ import json import os import argparse import collections -import pprint def mkdir_p(path): try: diff --git a/scripts/device-crash-test b/scripts/device-crash-test index 549162a547..b32aa93f89 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -26,7 +26,6 @@ check for crashes and unexpected errors. from __future__ import print_function import sys -import os import glob import logging import traceback diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py index 4ad34f90cd..45485b864b 100755 --- a/scripts/simpletrace.py +++ b/scripts/simpletrace.py @@ -11,7 +11,6 @@ from __future__ import print_function import struct -import re import inspect from tracetool import read_events, Event from tracetool.backend.simple import is_string diff --git a/scripts/tracetool.py b/scripts/tracetool.py index fe2b0771f2..3beaa66bd8 100755 --- a/scripts/tracetool.py +++ b/scripts/tracetool.py @@ -15,8 +15,6 @@ __email__ = "stefanha@linux.vnet.ibm.com" import sys import getopt -import os.path -import re from tracetool import error_write, out import tracetool.backend diff --git a/scripts/tracetool/format/simpletrace_stap.py b/scripts/tracetool/format/simpletrace_stap.py index e7e44842ca..57b04061cf 100644 --- a/scripts/tracetool/format/simpletrace_stap.py +++ b/scripts/tracetool/format/simpletrace_stap.py @@ -14,7 +14,7 @@ __email__ = "stefanha@redhat.com" from tracetool import out -from tracetool.backend.dtrace import binary, probeprefix +from tracetool.backend.dtrace import probeprefix from tracetool.backend.simple import is_string from tracetool.format.stap import stap_escape From 755ee70ff758584b8b6190b2cab4b480402af201 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Fri, 9 Nov 2018 10:07:07 -0500 Subject: [PATCH 3/9] configure: keep track of Python version Some functionality is dependent on the Python version detected/configured on configure. While it's possible to run the Python version later and check for the version, doing it once is preferable. Also, it's a relevant information to keep in build logs, as the overall behavior of the build can be affected by it. Signed-off-by: Cleber Rosa Message-Id: <20181109150710.31085-2-crosa@redhat.com> Reviewed-by: Eduardo Habkost Signed-off-by: Eduardo Habkost --- configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 3eee3fcf70..ca3d407d75 100755 --- a/configure +++ b/configure @@ -1797,6 +1797,9 @@ if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then "Use --python=/path/to/python to specify a supported Python." fi +# Preserve python version since some functionality is dependent on it +python_version=$($python -V 2>&1 | sed -e 's/Python\ //') + # Suppress writing compiled files python="$python -B" @@ -6010,7 +6013,7 @@ echo "LDFLAGS $LDFLAGS" echo "QEMU_LDFLAGS $QEMU_LDFLAGS" echo "make $make" echo "install $install" -echo "python $python" +echo "python $python ($python_version)" if test "$slirp" = "yes" ; then echo "smbd $smbd" fi @@ -6959,6 +6962,7 @@ echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak echo "PYTHON=$python" >> $config_host_mak +echo "PYTHON_VERSION=$python_version" >> $config_host_mak echo "CC=$cc" >> $config_host_mak if $iasl -h > /dev/null 2>&1; then echo "IASL=$iasl" >> $config_host_mak From 4061fcf288d146078bab13589064317c8264a1a3 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Fri, 9 Nov 2018 10:07:08 -0500 Subject: [PATCH 4/9] check-venv: use recorded Python version The current approach works fine, but it runs Python on every make command (even if it's not related to the venv usage). This is just an optimization, and not a change of behavior. Signed-off-by: Cleber Rosa Message-Id: <20181109150710.31085-3-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- tests/Makefile.include | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index f403a6571d..f8d4399293 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -958,8 +958,7 @@ TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results # information please refer to "avocado --help". AVOCADO_SHOW=none -PYTHON3 = $(shell $(PYTHON) -c 'import sys; print(1 if sys.version_info >= (3, 0) else 0)') -ifeq ($(PYTHON3), 1) +ifneq ($(findstring v2,"v$(PYTHON_VERSION)"),v2) $(TESTS_VENV_DIR): $(TESTS_VENV_REQ) $(call quiet-command, \ $(PYTHON) -m venv --system-site-packages $@, \ From 53fefde4557cec9afe92a7d389d6d15e9b2d61aa Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Fri, 9 Nov 2018 10:07:09 -0500 Subject: [PATCH 5/9] Travis CI: make specified Python versions usable on jobs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the two Python jobs, which seem to have the goal of making sure QEMU builds successfully on the 3.0-3.6 spectrum of Python 3 versions, the specified version is only applicable if a Python virtual environment is used. To do that, it's necessary to define the (primary?) language of the job to be Python. Also, Travis doesn't have a 3.0 Python installation available for the chosen distro, 3.4 being the lower version available. Reference: https://docs.travis-ci.com/user/languages/python/#specifying-python-versions Signed-off-by: Cleber Rosa Message-Id: <20181109150710.31085-4-crosa@redhat.com> Reviewed-by: Alex Bennée [ehabkost: Now 3.4 is the lowest Python version available] Signed-off-by: Eduardo Habkost fixup! Travis CI: make specified Python versions usable on jobs Signed-off-by: Eduardo Habkost --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 93fd0164a0..87d9fa971c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -175,12 +175,14 @@ matrix: # Python builds - env: - CONFIG="--target-list=x86_64-softmmu" + language: python python: - - "3.0" + - "3.4" - env: - CONFIG="--target-list=x86_64-softmmu" + language: python python: - "3.6" From 54f96b4553e3d7ba1dc822d1e19f0ba0f64bd7d7 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Fri, 9 Nov 2018 10:07:10 -0500 Subject: [PATCH 6/9] check-help: visual and content improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "check" target is not a target that will run all other tests listed, so in order to be accurate it's necessary to list those that will run. The same is true for "check-clean". Then, to give a better visual impression of the differences in the various targets, let's add empty lines. Finally, a small (and hopeful) grammar fix from a non-native speaker. Signed-off-by: Cleber Rosa Message-Id: <20181109150710.31085-5-crosa@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Eduardo Habkost --- tests/Makefile.include | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index f8d4399293..9348451450 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -3,7 +3,8 @@ check-help: @echo "Regression testing targets:" @echo - @echo " $(MAKE) check Run all tests" + @echo " $(MAKE) check Run unit, qapi-schema, qtest and decodetree" + @echo @echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target" @echo " $(MAKE) check-qtest Run qtest tests" @echo " $(MAKE) check-unit Run qobject tests" @@ -12,12 +13,13 @@ check-help: @echo " $(MAKE) check-block Run block tests" @echo " $(MAKE) check-tcg Run TCG tests" @echo " $(MAKE) check-acceptance Run all acceptance (functional) tests" + @echo @echo " $(MAKE) check-report.html Generates an HTML test report" @echo " $(MAKE) check-venv Creates a Python venv for tests" - @echo " $(MAKE) check-clean Clean the tests" + @echo " $(MAKE) check-clean Clean the tests and related data" @echo @echo "Please note that HTML reports do not regenerate if the unit tests" - @echo "has not changed." + @echo "have not changed." @echo @echo "The variable SPEED can be set to control the gtester speed setting." @echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be" From 82d4c923a580751c86dc0852a7cc8e369a78e8ad Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Fri, 9 Nov 2018 13:21:53 -0500 Subject: [PATCH 7/9] Acceptance tests: add Linux initrd checking test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QEMU used to exits with a not accurate error message when an initrd > 2GiB was passed. That was fixed on patch: commit f3839fda5771596152b75dd1e1a6d050e6e6e380 Author: Li Zhijian Date: Thu Sep 13 18:07:13 2018 +0800 change get_image_size return type to int64_t This change adds a regression test for that fix. It starts QEMU with a 2GiB dummy initrd, and checks that it evaluates the file size correctly and prints an accurate message. Signed-off-by: Wainer dos Santos Moschetta Reviewed-by: Caio Carrara Reviewed-by: Cleber Rosa Reviewed-by: Eduardo Habkost Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20181109182153.5390-1-wainersm@redhat.com> Signed-off-by: Eduardo Habkost --- tests/acceptance/linux_initrd.py | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/acceptance/linux_initrd.py diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_initrd.py new file mode 100644 index 0000000000..737355c2ef --- /dev/null +++ b/tests/acceptance/linux_initrd.py @@ -0,0 +1,48 @@ +# Linux initrd acceptance test. +# +# Copyright (c) 2018 Red Hat, Inc. +# +# Author: +# Wainer dos Santos Moschetta +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import tempfile +from avocado.utils.process import run + +from avocado_qemu import Test + + +class LinuxInitrd(Test): + """ + Checks QEMU evaluates correctly the initrd file passed as -initrd option. + + :avocado: enable + :avocado: tags=x86_64 + """ + + timeout = 60 + + def test_with_2gib_file_should_exit_error_msg(self): + """ + Pretends to boot QEMU with an initrd file with size of 2GiB + and expect it exits with error message. + """ + kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/' + 'Everything/x86_64/os/images/pxeboot/vmlinuz') + kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + max_size = 2 * (1024 ** 3) - 1 + + with tempfile.NamedTemporaryFile() as initrd: + initrd.seek(max_size) + initrd.write(b'\0') + initrd.flush() + cmd = "%s -kernel %s -initrd %s" % (self.qemu_bin, kernel_path, + initrd.name) + res = run(cmd, ignore_status=True) + self.assertEqual(res.exit_status, 1) + expected_msg = r'.*initrd is too large.*max: \d+, need %s.*' % ( + max_size + 1) + self.assertRegex(res.stderr_text, expected_msg) From 0cabc8f15e1be8b0f50f70699e9561b339d5c53f Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 11 Jan 2019 14:13:30 -0600 Subject: [PATCH 8/9] qemu.py: Fix error message when qemu dies from signal When qemu dies from a signal, the python code gets a negative value for exitcode; but signal numbers are positive. Copy the pattern used in qemu-iotests/iotests.py for reporting a positive value. CC: qemu-trivial@nongnu.org Signed-off-by: Eric Blake Message-Id: <20190111201330.14473-1-eblake@redhat.com> Signed-off-by: Eduardo Habkost --- scripts/qemu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 6e3b0e6771..0a5e02eb56 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -351,7 +351,7 @@ class QEMUMachine(object): command = ' '.join(self._qemu_full_args) else: command = '' - LOG.warn(msg, exitcode, command) + LOG.warn(msg, -exitcode, command) self._launched = False From 49ebe9b15876f3ce9a5f45cb53a16b6a788d65fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 17 Jan 2019 15:33:38 +0000 Subject: [PATCH 9/9] scripts/replay-dump.py: fix utf-8 mangling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alex Bennée Message-Id: <20190117153338.11820-1-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cleber Rosa Signed-off-by: Eduardo Habkost --- scripts/replay-dump.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py index 5ae77c8a92..ee7fda2638 100755 --- a/scripts/replay-dump.py +++ b/scripts/replay-dump.py @@ -3,7 +3,7 @@ # # Dump the contents of a recorded execution stream # -# Copyright (c) 2017 Alex Bennée +# Copyright (c) 2017 Alex Bennée # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public