Skip to contentSkip to conversation

Python queue, 2019-01-17

GIT PULL Applied Eduardo Habkost 2 participants 11 messages Jan 17, 2019 – Jan 18, 2019

lore
Share & tools
lore
#0 lore raw

The following changes since commit 681d61362d3f766a00806b89d6581869041f73cb:

Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging (2019-01-17 12:48:42 +0000)

are available in the Git repository at:

git://github.com/ehabkost/qemu.git tags/python-next-pull-request

for you to fetch changes up to 49ebe9b15876f3ce9a5f45cb53a16b6a788d65fd:

scripts/replay-dump.py: fix utf-8 mangling (2019-01-17 17:52:40 -0200)

----------------------------------------------------------------
Python queue, 2019-01-17

Fixes:
* Actually test different Python versions on Travis CI
* Fix qemu.py error message when qemu dies from signal

Cleanups:
* Track Python version on config-host.mak
* Remove fixed crashes from scripts/device-crash-test
* Acceptance tests: Linux initrd checking test
* Fix utf-8 mangling at scripts/replay-dump.py
* Remove unused python imports from multiple scripts

----------------------------------------------------------------

Alex Bennée (1):
scripts/replay-dump.py: fix utf-8 mangling

Cleber Rosa (4):
configure: keep track of Python version
check-venv: use recorded Python version
Travis CI: make specified Python versions usable on jobs
check-help: visual and content improvements

Eric Blake (1):
qemu.py: Fix error message when qemu dies from signal

Philippe Mathieu-Daudé (1):
scripts: Remove unused python imports

Thomas Huth (1):
scripts/device-crash-test: Remove known crashes

Wainer dos Santos Moschetta (1):
Acceptance tests: add Linux initrd checking test

 configure                                    |  6 ++-
 scripts/analyse-locks-simpletrace.py         |  1 -
 scripts/analyze-migration.py                 |  1 -
 scripts/qemu.py                              |  2 +-
 scripts/replay-dump.py                       |  2 +-
 scripts/simpletrace.py                       |  1 -
 scripts/tracetool.py                         |  2 -
 scripts/tracetool/format/simpletrace_stap.py |  2 +-
 .travis.yml                                  |  4 +-
 scripts/device-crash-test                    | 16 -------
 tests/Makefile.include                       | 11 +++--
 tests/acceptance/linux_initrd.py             | 48 ++++++++++++++++++++
 12 files changed, 65 insertions(+), 31 deletions(-)
 create mode 100644 tests/acceptance/linux_initrd.py
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#1 lore raw

[Qemu-devel] [PULL 1/9] scripts/device-crash-test: Remove known crashes

From: Thomas Huth <[email protected]>

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.

Message-Id: <[email protected]>

---
 scripts/device-crash-test | 15 ---------------
 1 file changed, 15 deletions(-)
scripts/device-crash-test +0 -15
index e93a7c0c84..549162a547 100755
@@ -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},
 ]
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#2 lore raw

[Qemu-devel] [PULL 2/9] scripts: Remove unused python imports

In reply to Eduardo Habkost

From: Philippe Mathieu-Daudé <[email protected]>

Reported-by LGTM code review

Message-Id: <[email protected]>

---
 scripts/analyse-locks-simpletrace.py         | 1 -
 scripts/analyze-migration.py                 | 1 -
 scripts/simpletrace.py                       | 1 -
 scripts/tracetool.py                         | 2 --
 scripts/tracetool/format/simpletrace_stap.py | 2 +-
 scripts/device-crash-test                    | 1 -
 6 files changed, 1 insertion(+), 7 deletions(-)
scripts/analyse-locks-simpletrace.py +0 -1
index 30090bdfff..7d9b574300 100755
@@ -7,7 +7,6 @@
 #
 
 from __future__ import print_function
-import os
 import simpletrace
 import argparse
 import numpy as np
scripts/analyze-migration.py +0 -1
index 5c2010c917..e527eb168e 100755
@@ -23,7 +23,6 @@ import json
 import os
 import argparse
 import collections
-import pprint
 
 def mkdir_p(path):
     try:
scripts/simpletrace.py +0 -1
index 4ad34f90cd..45485b864b 100755
@@ -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
scripts/tracetool.py +0 -2
index fe2b0771f2..3beaa66bd8 100755
@@ -15,8 +15,6 @@ __email__      = "[email protected]"
 
 import sys
 import getopt
-import os.path
-import re
 
 from tracetool import error_write, out
 import tracetool.backend
scripts/tracetool/format/simpletrace_stap.py +1 -1
index e7e44842ca..57b04061cf 100644
@@ -14,7 +14,7 @@ __email__      = "[email protected]"
 
 
 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
 
scripts/device-crash-test +0 -1
index 549162a547..b32aa93f89 100755
@@ -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
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#3 lore raw

[Qemu-devel] [PULL 3/9] configure: keep track of Python version

In reply to Eduardo Habkost

From: Cleber Rosa <[email protected]>

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.

Message-Id: <[email protected]>

---
 configure | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configure +5 -1
index 3eee3fcf70..ca3d407d75 100755
@@ -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
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#4 lore raw

[Qemu-devel] [PULL 4/9] check-venv: use recorded Python version

In reply to Eduardo Habkost

From: Cleber Rosa <[email protected]>

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.

Message-Id: <[email protected]>

---
 tests/Makefile.include | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tests/Makefile.include +1 -2
index f403a6571d..f8d4399293 100644
@@ -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 $@, \
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#5 lore raw

[Qemu-devel] [PULL 5/9] Travis CI: make specified Python versions usable on jobs

In reply to Eduardo Habkost

From: Cleber Rosa <[email protected]>

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

Message-Id: <[email protected]>

[ehabkost: Now 3.4 is the lowest Python version available]

fixup! Travis CI: make specified Python versions usable on jobs

---
 .travis.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
.travis.yml +3 -1
index 93fd0164a0..87d9fa971c 100644
@@ -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"
 
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#6 lore raw

[Qemu-devel] [PULL 6/9] check-help: visual and content improvements

In reply to Eduardo Habkost

From: Cleber Rosa <[email protected]>

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.

Message-Id: <[email protected]>

---
 tests/Makefile.include | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tests/Makefile.include +5 -3
index f8d4399293..9348451450 100644
@@ -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"
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#7 lore raw

[Qemu-devel] [PULL 7/9] Acceptance tests: add Linux initrd checking test

In reply to Eduardo Habkost

From: Wainer dos Santos Moschetta <[email protected]>

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 <[email protected]>
	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.

Message-Id: <[email protected]>

---
 tests/acceptance/linux_initrd.py | 48 ++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 tests/acceptance/linux_initrd.py
tests/acceptance/linux_initrd.py new file +48 -0
new file mode 100644
index 0000000000..737355c2ef
@@ -0,0 +1,48 @@
+# Linux initrd acceptance test.
+#
+# Copyright (c) 2018 Red Hat, Inc.
+#
+# Author:
+#  Wainer dos Santos Moschetta <[email protected]>
+#
+# 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)
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#8 lore raw

[Qemu-devel] [PULL 9/9] scripts/replay-dump.py: fix utf-8 mangling

In reply to Eduardo Habkost

From: Alex Bennée <[email protected]>

Message-Id: <[email protected]>

---
 scripts/replay-dump.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/replay-dump.py +1 -1
index 5ae77c8a92..ee7fda2638 100755
@@ -3,7 +3,7 @@
 #
 # Dump the contents of a recorded execution stream
 #
-#  Copyright (c) 2017 Alex Bennée <[email protected]>
+#  Copyright (c) 2017 Alex Bennée <[email protected]>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#9 lore raw

[Qemu-devel] [PULL 8/9] qemu.py: Fix error message when qemu dies from signal

In reply to Eduardo Habkost

From: Eric Blake <[email protected]>

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.

Message-Id: <[email protected]>

---
 scripts/qemu.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qemu.py +1 -1
index 6e3b0e6771..0a5e02eb56 100644
@@ -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
 
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
#10 lore raw
In reply to Eduardo Habkost
Quoted 20 lines · Eduardo Habkost

The following changes since commit 681d61362d3f766a00806b89d6581869041f73cb:

Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging (2019-01-17 12:48:42 +0000)

are available in the Git repository at:

git://github.com/ehabkost/qemu.git tags/python-next-pull-request

for you to fetch changes up to 49ebe9b15876f3ce9a5f45cb53a16b6a788d65fd:

scripts/replay-dump.py: fix utf-8 mangling (2019-01-17 17:52:40 -0200)

----------------------------------------------------------------
Python queue, 2019-01-17

Fixes:
* Actually test different Python versions on Travis CI
* Fix qemu.py error message when qemu dies from signal

Quoted 8 lines

Cleanups:
* Track Python version on config-host.mak
* Remove fixed crashes from scripts/device-crash-test
* Acceptance tests: Linux initrd checking test
* Fix utf-8 mangling at scripts/replay-dump.py
* Remove unused python imports from multiple scripts

----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.

-- PMM