aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-02-06 19:28:08 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-02-06 19:28:08 +0000
commitbc2943d6caf787e1c9a5f3109cdb98f37630b89e (patch)
treee6d03e9d4c1406017b4ef72a5c76812f83b5ce6f /tests
parent20e0d439a6ded635ec89f6135c08cd5541c68962 (diff)
parent356dc290f0ef930a24b6af3a0908b1cb58ad47c9 (diff)
Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging
Python queue, 2018-02-05 # gpg: Signature made Mon 05 Feb 2018 23:07:57 GMT # gpg: using RSA key 2807936F984DC5A6 # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/python-next-pull-request: (21 commits) docker: change Fedora images to run with python3 travis: improve python version test coverage ui: update keycodemapdb to get py3 fixes input: add missing JIS keys to virtio input qemu.py: don't launch again before shutdown() qemu.py: cleanup redundant calls in launch() qemu.py: use poll() instead of 'returncode' qemu.py: always cleanup on shutdown() qemu.py: refactor launch() qemu.py: better control of created files qemu.py: remove unused import configure: allow use of python 3 scripts: ensure signrom treats data as bytes qapi: force a UTF-8 locale for running Python qapi: ensure stable sort ordering when checking QAPI entities qapi: remove '-q' arg to diff when comparing QAPI output qapi: Adapt to moved location of 'maketrans' function in py3 qapi: adapt to moved location of StringIO module in py3 qapi: Use OrderedDict from standard library if available qapi: use items()/values() intead of iteritems()/itervalues() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.include6
-rw-r--r--tests/docker/dockerfiles/fedora.docker3
-rw-r--r--tests/qapi-schema/test-qapi.py43
3 files changed, 27 insertions, 25 deletions
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 83def6994c..f41da235ae 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -919,10 +919,10 @@ $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
$^ >$*.test.out 2>$*.test.err; \
echo $$? >$*.test.exit, \
"TEST","$*.out")
- @diff -q $(SRC_PATH)/$*.out $*.test.out
+ @diff $(SRC_PATH)/$*.out $*.test.out
@# Sanitize error messages (make them independent of build directory)
- @perl -p -e 's|\Q$(SRC_PATH)\E/||g' $*.test.err | diff -q $(SRC_PATH)/$*.err -
- @diff -q $(SRC_PATH)/$*.exit $*.test.exit
+ @perl -p -e 's|\Q$(SRC_PATH)\E/||g' $*.test.err | diff $(SRC_PATH)/$*.err -
+ @diff $(SRC_PATH)/$*.exit $*.test.exit
.PHONY: check-tests/qapi-schema/doc-good.texi
check-tests/qapi-schema/doc-good.texi: tests/qapi-schema/doc-good.test.texi
diff --git a/tests/docker/dockerfiles/fedora.docker b/tests/docker/dockerfiles/fedora.docker
index 32de731675..26ede4f1d6 100644
--- a/tests/docker/dockerfiles/fedora.docker
+++ b/tests/docker/dockerfiles/fedora.docker
@@ -1,6 +1,6 @@
FROM fedora:latest
ENV PACKAGES \
- ccache gettext git tar PyYAML sparse flex bison python2 bzip2 hostname \
+ ccache gettext git tar PyYAML sparse flex bison python3 bzip2 hostname \
glib2-devel pixman-devel zlib-devel SDL-devel libfdt-devel \
gcc gcc-c++ clang make perl which bc findutils libaio-devel \
nettle-devel libasan libubsan \
@@ -12,6 +12,7 @@ ENV PACKAGES \
mingw64-gtk2 mingw64-gtk3 mingw64-gnutls mingw64-nettle mingw64-libtasn1 \
mingw64-libjpeg-turbo mingw64-libpng mingw64-curl mingw64-libssh2 \
mingw64-bzip2
+ENV QEMU_CONFIGURE_OPTS --python=/usr/bin/python3
RUN dnf install -y $PACKAGES
RUN rpm -q $PACKAGES | sort > /packages.txt
diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
index fe0ca08d78..ac43d3458e 100644
--- a/tests/qapi-schema/test-qapi.py
+++ b/tests/qapi-schema/test-qapi.py
@@ -10,6 +10,7 @@
# See the COPYING file in the top-level directory.
#
+from __future__ import print_function
from qapi import *
from pprint import pprint
import os
@@ -18,51 +19,51 @@ import sys
class QAPISchemaTestVisitor(QAPISchemaVisitor):
def visit_enum_type(self, name, info, values, prefix):
- print 'enum %s %s' % (name, values)
+ print('enum %s %s' % (name, values))
if prefix:
- print ' prefix %s' % prefix
+ print(' prefix %s' % prefix)
def visit_object_type(self, name, info, base, members, variants):
- print 'object %s' % name
+ print('object %s' % name)
if base:
- print ' base %s' % base.name
+ print(' base %s' % base.name)
for m in members:
- print ' member %s: %s optional=%s' % \
- (m.name, m.type.name, m.optional)
+ print(' member %s: %s optional=%s' % \
+ (m.name, m.type.name, m.optional))
self._print_variants(variants)
def visit_alternate_type(self, name, info, variants):
- print 'alternate %s' % name
+ print('alternate %s' % name)
self._print_variants(variants)
def visit_command(self, name, info, arg_type, ret_type,
gen, success_response, boxed):
- print 'command %s %s -> %s' % \
- (name, arg_type and arg_type.name, ret_type and ret_type.name)
- print ' gen=%s success_response=%s boxed=%s' % \
- (gen, success_response, boxed)
+ print('command %s %s -> %s' % \
+ (name, arg_type and arg_type.name, ret_type and ret_type.name))
+ print(' gen=%s success_response=%s boxed=%s' % \
+ (gen, success_response, boxed))
def visit_event(self, name, info, arg_type, boxed):
- print 'event %s %s' % (name, arg_type and arg_type.name)
- print ' boxed=%s' % boxed
+ print('event %s %s' % (name, arg_type and arg_type.name))
+ print(' boxed=%s' % boxed)
@staticmethod
def _print_variants(variants):
if variants:
- print ' tag %s' % variants.tag_member.name
+ print(' tag %s' % variants.tag_member.name)
for v in variants.variants:
- print ' case %s: %s' % (v.name, v.type.name)
+ print(' case %s: %s' % (v.name, v.type.name))
schema = QAPISchema(sys.argv[1])
schema.visit(QAPISchemaTestVisitor())
for doc in schema.docs:
if doc.symbol:
- print 'doc symbol=%s' % doc.symbol
+ print('doc symbol=%s' % doc.symbol)
else:
- print 'doc freeform'
- print ' body=\n%s' % doc.body.text
- for arg, section in doc.args.iteritems():
- print ' arg=%s\n%s' % (arg, section.text)
+ print('doc freeform')
+ print(' body=\n%s' % doc.body.text)
+ for arg, section in doc.args.items():
+ print(' arg=%s\n%s' % (arg, section.text))
for section in doc.sections:
- print ' section=%s\n%s' % (section.name, section.text)
+ print(' section=%s\n%s' % (section.name, section.text))