Merge tag 'pull-error-2023-02-23' of https://repo.or.cz/qemu/armbru into staging
Error reporting patches patches for 2023-02-23
# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmP3ZogSHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZT+PsP/ibioHJkJiR8yMt2/2iSwpkMrphZDmRQ
# 5sAgxCARdcp0m7maH4McCFkgtERcROip+j98FV29qI4y2P/mLkt1jyMYC+TH9r4O
# X3G997526gzZBLIJJsnYlVlJ1Gbgn+uCy4AzRLuhaKAHsYoxkP0jygoSs/eIZ9tK
# Wg2tkQ/wY4bXihrlzdOpWqU3Y0ADo2PQ29p7HWheRMDQz6JQxq82hFFs1jgGQ1aq
# 4HmcpIMX0+/LshFbDU91dL1pxW17vWT9J3xtzAsWlfBBgAh257LKvJqVD0XojL04
# FxJZ05IqTXZ04gvwgji0dcvNjdmP/dXVoGLfxAYwCFtKxiig700bdNb0+6MjCT6u
# P2tSPyQQzNQ5LYI7AgER4kMyXK22RkBXx+Q7y7QK1YXszWWSmGFZWGLA2FSg4lO6
# 5jsCgtEGixsMym/ox3XeoywSh4BgWkNXC+gKMSg/hQXgfriQmndHUOlK0ZU95I43
# 7gnPol+pU1HIEy/GDU8oMyieG513Ti1KVPZyv/FbuW75AYUDlHAXH/5OFlsuaLIR
# 1QF449xCLR5vIOOLXHbKJ9jbkcAaidhq5pOhLr7oV3yKh4H53iNB7gy8+vJ6XtBf
# tXXcYPVD8LpZxDegKNpIaeT0Nr4pyy6bYfrF+YeisVotD6PDtPALfJ9eSCWjaQsl
# DG2opOfv5xuV
# =VRxu
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 23 Feb 2023 13:13:44 GMT
# gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg: issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* tag 'pull-error-2023-02-23' of https://repo.or.cz/qemu/armbru:
rocker: Tweak stubbed out monitor commands' error messages
migration/colo: Improve an x-colo-lost-heartbeat error message
hw/core: Improve the query-hotpluggable-cpus error message
replay: Simplify setting replay blockers
qga: Drop dangling reference to QERR_QGA_LOGGING_DISABLED
hw/acpi: Move QMP command to hw/core/
hw/acpi: Dumb down acpi_table_add() stub
hw/smbios: Dumb down smbios_entry_add() stub
hw/core: Improve error message when machine doesn't provide NMIs
dump: Assert cpu_get_note_size() can't fail
dump: Improve error message when target doesn't support memory dump
error: Drop superfluous #include "qapi/qmp/qerror.h"
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/.gitlab-ci.d/static_checks.yml b/.gitlab-ci.d/static_checks.yml
index 289ad13..b4cbdbc 100644
--- a/.gitlab-ci.d/static_checks.yml
+++ b/.gitlab-ci.d/static_checks.yml
@@ -23,12 +23,12 @@
before_script:
- apk -U add git
-check-python-pipenv:
+check-python-minreqs:
extends: .base_job_template
stage: test
image: $CI_REGISTRY_IMAGE/qemu/python:latest
script:
- - make -C python check-pipenv
+ - make -C python check-minreqs
variables:
GIT_DEPTH: 1
needs:
diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
index ef5193c..1cf404c 100644
--- a/accel/tcg/translator.c
+++ b/accel/tcg/translator.c
@@ -176,8 +176,16 @@
if (host == NULL) {
tb_page_addr_t phys_page =
get_page_addr_code_hostp(env, base, &db->host_addr[1]);
- /* We cannot handle MMIO as second page. */
- assert(phys_page != -1);
+
+ /*
+ * If the second page is MMIO, treat as if the first page
+ * was MMIO as well, so that we do not cache the TB.
+ */
+ if (unlikely(phys_page == -1)) {
+ tb_set_page_addr0(tb, -1);
+ return NULL;
+ }
+
tb_set_page_addr1(tb, phys_page);
#ifdef CONFIG_USER_ONLY
page_protect(end);
diff --git a/configs/targets/microblaze-linux-user.mak b/configs/targets/microblaze-linux-user.mak
index 4249a37..0a2322c 100644
--- a/configs/targets/microblaze-linux-user.mak
+++ b/configs/targets/microblaze-linux-user.mak
@@ -3,3 +3,4 @@
TARGET_SYSTBL=syscall.tbl
TARGET_BIG_ENDIAN=y
TARGET_HAS_BFLT=y
+TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml
diff --git a/configs/targets/microblaze-softmmu.mak b/configs/targets/microblaze-softmmu.mak
index 8385e2d..e84c0cc 100644
--- a/configs/targets/microblaze-softmmu.mak
+++ b/configs/targets/microblaze-softmmu.mak
@@ -2,3 +2,4 @@
TARGET_BIG_ENDIAN=y
TARGET_SUPPORTS_MTTCG=y
TARGET_NEED_FDT=y
+TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml
diff --git a/configs/targets/microblazeel-linux-user.mak b/configs/targets/microblazeel-linux-user.mak
index d0e775d..2707431 100644
--- a/configs/targets/microblazeel-linux-user.mak
+++ b/configs/targets/microblazeel-linux-user.mak
@@ -2,3 +2,4 @@
TARGET_SYSTBL_ABI=common
TARGET_SYSTBL=syscall.tbl
TARGET_HAS_BFLT=y
+TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml
diff --git a/configs/targets/microblazeel-softmmu.mak b/configs/targets/microblazeel-softmmu.mak
index af40391..9b68803 100644
--- a/configs/targets/microblazeel-softmmu.mak
+++ b/configs/targets/microblazeel-softmmu.mak
@@ -1,3 +1,4 @@
TARGET_ARCH=microblaze
TARGET_SUPPORTS_MTTCG=y
TARGET_NEED_FDT=y
+TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml
diff --git a/cpus-common.c b/cpus-common.c
index 793364d..39f355d 100644
--- a/cpus-common.c
+++ b/cpus-common.c
@@ -192,6 +192,11 @@
CPUState *other_cpu;
int running_cpus;
+ if (current_cpu->exclusive_context_count) {
+ current_cpu->exclusive_context_count++;
+ return;
+ }
+
qemu_mutex_lock(&qemu_cpu_list_lock);
exclusive_idle();
@@ -219,13 +224,16 @@
*/
qemu_mutex_unlock(&qemu_cpu_list_lock);
- current_cpu->in_exclusive_context = true;
+ current_cpu->exclusive_context_count = 1;
}
/* Finish an exclusive operation. */
void end_exclusive(void)
{
- current_cpu->in_exclusive_context = false;
+ current_cpu->exclusive_context_count--;
+ if (current_cpu->exclusive_context_count) {
+ return;
+ }
qemu_mutex_lock(&qemu_cpu_list_lock);
qatomic_set(&pending_cpus, 0);
diff --git a/docs/about/build-platforms.rst b/docs/about/build-platforms.rst
index 1c1e7b9..20b97c3 100644
--- a/docs/about/build-platforms.rst
+++ b/docs/about/build-platforms.rst
@@ -86,6 +86,38 @@
For macOS, `Homebrew`_ will be used, although `MacPorts`_ is expected to carry
similar versions.
+Some build dependencies may follow less conservative rules:
+
+Python runtime
+ Distributions with long-term support often provide multiple versions
+ of the Python runtime. While QEMU will initially aim to support the
+ distribution's default runtime, it may later increase its minimum version
+ to any newer python that is available as an option from the vendor.
+ In this case, it will be necessary to use the ``--python`` command line
+ option of the ``configure`` script to point QEMU to a supported
+ version of the Python runtime.
+
+ As of QEMU |version|, the minimum supported version of Python is 3.6.
+
+Python build dependencies
+ Some of QEMU's build dependencies are written in Python. Usually these
+ are only packaged by distributions for the default Python runtime.
+ If QEMU bumps its minimum Python version and a non-default runtime is
+ required, it may be necessary to fetch python modules from the Python
+ Package Index (PyPI) via ``pip``, in order to build QEMU.
+
+Optional build dependencies
+ Build components whose absence does not affect the ability to build
+ QEMU may not be available in distros, or may be too old for QEMU's
+ requirements. Many of these, such as the Avocado testing framework
+ or various linters, are written in Python and therefore can also
+ be installed using ``pip``. Cross compilers are another example
+ of optional build-time dependency; in this case it is possible to
+ download them from repositories such as EPEL, to use container-based
+ cross compilation using ``docker`` or ``podman``, or to use pre-built
+ binaries distributed with QEMU.
+
+
Windows
-------
diff --git a/docs/devel/qapi-code-gen.rst b/docs/devel/qapi-code-gen.rst
index 5edc49a..23e7f2f 100644
--- a/docs/devel/qapi-code-gen.rst
+++ b/docs/devel/qapi-code-gen.rst
@@ -685,9 +685,10 @@
that previously resulted in an error). QMP clients may still need to
know whether the extension is available.
-For this purpose, a list of features can be specified for a command or
-struct type. Each list member can either be ``{ 'name': STRING, '*if':
-COND }``, or STRING, which is shorthand for ``{ 'name': STRING }``.
+For this purpose, a list of features can be specified for definitions,
+enumeration values, and struct members. Each feature list member can
+either be ``{ 'name': STRING, '*if': COND }``, or STRING, which is
+shorthand for ``{ 'name': STRING }``.
The optional 'if' member specifies a conditional. See `Configuring
the schema`_ below for more on this.
@@ -817,8 +818,8 @@
A union's discriminator may not be conditional.
-Likewise, individual enumeration values be conditional. This requires
-the longhand form of ENUM-VALUE_.
+Likewise, individual enumeration values may be conditional. This
+requires the longhand form of ENUM-VALUE_.
Example: an enum type with unconditional value 'foo' and conditional
value 'bar' ::
@@ -1157,9 +1158,8 @@
Type "q_obj-EVENT_C-arg" is an implicitly defined object type with
the two members from the event's definition.
-The SchemaInfo for struct and union types has meta-type "object".
-
-The SchemaInfo for a struct type has variant member "members".
+The SchemaInfo for struct and union types has meta-type "object" and
+variant member "members".
The SchemaInfo for a union type additionally has variant members "tag"
and "variants".
diff --git a/gdb-xml/microblaze-core.xml b/gdb-xml/microblaze-core.xml
new file mode 100644
index 0000000..becf77c
--- /dev/null
+++ b/gdb-xml/microblaze-core.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2008 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.microblaze.core">
+ <reg name="r0" bitsize="32" regnum="0"/>
+ <reg name="r1" bitsize="32" type="data_ptr"/>
+ <reg name="r2" bitsize="32"/>
+ <reg name="r3" bitsize="32"/>
+ <reg name="r4" bitsize="32"/>
+ <reg name="r5" bitsize="32"/>
+ <reg name="r6" bitsize="32"/>
+ <reg name="r7" bitsize="32"/>
+ <reg name="r8" bitsize="32"/>
+ <reg name="r9" bitsize="32"/>
+ <reg name="r10" bitsize="32"/>
+ <reg name="r11" bitsize="32"/>
+ <reg name="r12" bitsize="32"/>
+ <reg name="r13" bitsize="32"/>
+ <reg name="r14" bitsize="32"/>
+ <reg name="r15" bitsize="32"/>
+ <reg name="r16" bitsize="32"/>
+ <reg name="r17" bitsize="32"/>
+ <reg name="r18" bitsize="32"/>
+ <reg name="r19" bitsize="32"/>
+ <reg name="r20" bitsize="32"/>
+ <reg name="r21" bitsize="32"/>
+ <reg name="r22" bitsize="32"/>
+ <reg name="r23" bitsize="32"/>
+ <reg name="r24" bitsize="32"/>
+ <reg name="r25" bitsize="32"/>
+ <reg name="r26" bitsize="32"/>
+ <reg name="r27" bitsize="32"/>
+ <reg name="r28" bitsize="32"/>
+ <reg name="r29" bitsize="32"/>
+ <reg name="r30" bitsize="32"/>
+ <reg name="r31" bitsize="32"/>
+ <reg name="rpc" bitsize="32" type="code_ptr"/>
+ <reg name="rmsr" bitsize="32"/>
+ <reg name="rear" bitsize="32"/>
+ <reg name="resr" bitsize="32"/>
+ <reg name="rfsr" bitsize="32"/>
+ <reg name="rbtr" bitsize="32"/>
+ <reg name="rpvr0" bitsize="32"/>
+ <reg name="rpvr1" bitsize="32"/>
+ <reg name="rpvr2" bitsize="32"/>
+ <reg name="rpvr3" bitsize="32"/>
+ <reg name="rpvr4" bitsize="32"/>
+ <reg name="rpvr5" bitsize="32"/>
+ <reg name="rpvr6" bitsize="32"/>
+ <reg name="rpvr7" bitsize="32"/>
+ <reg name="rpvr8" bitsize="32"/>
+ <reg name="rpvr9" bitsize="32"/>
+ <reg name="rpvr10" bitsize="32"/>
+ <reg name="rpvr11" bitsize="32"/>
+ <reg name="redr" bitsize="32"/>
+ <reg name="rpid" bitsize="32"/>
+ <reg name="rzpr" bitsize="32"/>
+ <reg name="rtlbx" bitsize="32"/>
+ <reg name="rtlbsx" bitsize="32"/>
+ <reg name="rtlblo" bitsize="32"/>
+ <reg name="rtlbhi" bitsize="32"/>
+</feature>
diff --git a/gdb-xml/microblaze-stack-protect.xml b/gdb-xml/microblaze-stack-protect.xml
new file mode 100644
index 0000000..997301e
--- /dev/null
+++ b/gdb-xml/microblaze-stack-protect.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2008 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.microblaze.stack-protect">
+ <reg name="rslr" bitsize="32"/>
+ <reg name="rshr" bitsize="32"/>
+</feature>
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 2417597..671f041 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -349,7 +349,7 @@
bool unplug;
bool crash_occurred;
bool exit_request;
- bool in_exclusive_context;
+ int exclusive_context_count;
uint32_t cflags_next_tb;
/* updates protected by BQL */
uint32_t interrupt_request;
@@ -758,7 +758,7 @@
*/
static inline bool cpu_in_exclusive_context(const CPUState *cpu)
{
- return cpu->in_exclusive_context;
+ return cpu->exclusive_context_count;
}
/**
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index 5b38c7b..97d0243 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -51,14 +51,34 @@
extern "C" {
#endif
-#if defined(_WIN64)
-/* On w64, setjmp is implemented by _setjmp which needs a second parameter.
+#if defined(__aarch64__)
+/*
+ * On windows-arm64, setjmp is available in only one variant, and longjmp always
+ * does stack unwinding. This crash with generated code.
+ * Thus, we use another implementation of setjmp (not windows one), coming from
+ * mingw, which never performs stack unwinding.
+ */
+#undef setjmp
+#undef longjmp
+/*
+ * These functions are not declared in setjmp.h because __aarch64__ defines
+ * setjmp to _setjmpex instead. However, they are still defined in libmingwex.a,
+ * which gets linked automatically.
+ */
+extern int __mingw_setjmp(jmp_buf);
+extern void __attribute__((noreturn)) __mingw_longjmp(jmp_buf, int);
+#define setjmp(env) __mingw_setjmp(env)
+#define longjmp(env, val) __mingw_longjmp(env, val)
+#elif defined(_WIN64)
+/*
+ * On windows-x64, setjmp is implemented by _setjmp which needs a second parameter.
* If this parameter is NULL, longjump does no stack unwinding.
* That is what we need for QEMU. Passing the value of register rsp (default)
- * lets longjmp try a stack unwinding which will crash with generated code. */
+ * lets longjmp try a stack unwinding which will crash with generated code.
+ */
# undef setjmp
# define setjmp(env) _setjmp(env, NULL)
-#endif
+#endif /* __aarch64__ */
/* QEMU uses sigsetjmp()/siglongjmp() as the portable way to specify
* "longjmp and don't touch the signal masks". Since we know that the
* savemask parameter will always be zero we can safely define these
diff --git a/linux-user/main.c b/linux-user/main.c
index 4290651..4ff30ff 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -161,13 +161,15 @@
}
qemu_init_cpu_list();
gdbserver_fork(thread_cpu);
- /* qemu_init_cpu_list() takes care of reinitializing the
- * exclusive state, so we don't need to end_exclusive() here.
- */
} else {
cpu_list_unlock();
- end_exclusive();
}
+ /*
+ * qemu_init_cpu_list() reinitialized the child exclusive state, but we
+ * also need to keep current_cpu consistent, so call end_exclusive() for
+ * both child and parent.
+ */
+ end_exclusive();
}
__thread CPUState *thread_cpu;
diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c
index 5ccf9e9..212e62d 100644
--- a/linux-user/microblaze/cpu_loop.c
+++ b/linux-user/microblaze/cpu_loop.c
@@ -25,8 +25,8 @@
void cpu_loop(CPUMBState *env)
{
+ int trapnr, ret, si_code, sig;
CPUState *cs = env_cpu(env);
- int trapnr, ret, si_code;
while (1) {
cpu_exec_start(cs);
@@ -76,6 +76,7 @@
env->iflags &= ~(IMM_FLAG | D_FLAG);
switch (env->esr & 31) {
case ESR_EC_DIVZERO:
+ sig = TARGET_SIGFPE;
si_code = TARGET_FPE_INTDIV;
break;
case ESR_EC_FPU:
@@ -84,6 +85,7 @@
* if there's no recognized bit set. Possibly this
* implies that si_code is 0, but follow the structure.
*/
+ sig = TARGET_SIGFPE;
si_code = env->fsr;
if (si_code & FSR_IO) {
si_code = TARGET_FPE_FLTINV;
@@ -97,13 +99,17 @@
si_code = TARGET_FPE_FLTRES;
}
break;
+ case ESR_EC_PRIVINSN:
+ sig = SIGILL;
+ si_code = ILL_PRVOPC;
+ break;
default:
fprintf(stderr, "Unhandled hw-exception: 0x%x\n",
env->esr & ESR_EC_MASK);
cpu_dump_state(cs, stderr, 0);
exit(EXIT_FAILURE);
}
- force_sig_fault(TARGET_SIGFPE, si_code, env->pc);
+ force_sig_fault(sig, si_code, env->pc);
break;
case EXCP_DEBUG:
diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c
index 434c90a..c120c42 100644
--- a/linux-user/sparc/cpu_loop.c
+++ b/linux-user/sparc/cpu_loop.c
@@ -248,6 +248,14 @@
cpu_exec_step_atomic(cs);
break;
default:
+ /*
+ * Most software trap numbers vector to BAD_TRAP.
+ * Handle anything not explicitly matched above.
+ */
+ if (trapnr >= TT_TRAP && trapnr <= TT_TRAP + 0x7f) {
+ force_sig_fault(TARGET_SIGILL, ILL_ILLTRP, env->pc);
+ break;
+ }
fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
cpu_dump_state(cs, stderr, 0);
exit(EXIT_FAILURE);
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1e868e9..a6c426d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6752,6 +6752,7 @@
cpu_clone_regs_parent(env, flags);
fork_end(0);
}
+ g_assert(!cpu_in_exclusive_context(cpu));
}
return ret;
}
diff --git a/meson.build b/meson.build
index bc7e5b1..6cb2b1a 100644
--- a/meson.build
+++ b/meson.build
@@ -2129,6 +2129,18 @@
pthread_create(&thread, 0, f, 0);
return 0;
}''', dependencies: threads))
+config_host_data.set('CONFIG_PTHREAD_SET_NAME_NP', cc.links(gnu_source_prefix + '''
+ #include <pthread.h>
+ #include <pthread_np.h>
+
+ static void *f(void *p) { return NULL; }
+ int main(void)
+ {
+ pthread_t thread;
+ pthread_create(&thread, 0, f, 0);
+ pthread_set_name_np(thread, "QEMU");
+ return 0;
+ }''', dependencies: threads))
config_host_data.set('CONFIG_PTHREAD_CONDATTR_SETCLOCK', cc.links(gnu_source_prefix + '''
#include <pthread.h>
#include <time.h>
@@ -2466,6 +2478,27 @@
}''', name: '_lock_file and _unlock_file'))
endif
+if targetos == 'windows'
+ mingw_has_setjmp_longjmp = cc.links('''
+ #include <setjmp.h>
+ int main(void) {
+ /*
+ * These functions are not available in setjmp header, but may be
+ * available at link time, from libmingwex.a.
+ */
+ extern int __mingw_setjmp(jmp_buf);
+ extern void __attribute__((noreturn)) __mingw_longjmp(jmp_buf, int);
+ jmp_buf env;
+ __mingw_setjmp(env);
+ __mingw_longjmp(env, 0);
+ }
+ ''', name: 'mingw setjmp and longjmp')
+
+ if cpu == 'aarch64' and not mingw_has_setjmp_longjmp
+ error('mingw must provide setjmp/longjmp for windows-arm64')
+ endif
+endif
+
########################
# Target configuration #
########################
diff --git a/python/.gitignore b/python/.gitignore
index 904f324..c3ceb1c 100644
--- a/python/.gitignore
+++ b/python/.gitignore
@@ -11,8 +11,8 @@
.idea/
.vscode/
-# virtual environments (pipenv et al)
-.venv/
+# virtual environments
+.min-venv/
.tox/
.dev-venv/
diff --git a/python/Makefile b/python/Makefile
index b170708..c5bd6ff 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -1,15 +1,16 @@
QEMU_VENV_DIR=.dev-venv
+QEMU_MINVENV_DIR=.min-venv
QEMU_TOX_EXTRA_ARGS ?=
.PHONY: help
help:
@echo "python packaging help:"
@echo ""
- @echo "make check-pipenv:"
- @echo " Run tests in pipenv's virtual environment."
+ @echo "make check-minreqs:"
+ @echo " Run tests in the minreqs virtual environment."
@echo " These tests use the oldest dependencies."
- @echo " Requires: Python 3.6 and pipenv."
- @echo " Hint (Fedora): 'sudo dnf install python3.6 pipenv'"
+ @echo " Requires: Python 3.6"
+ @echo " Hint (Fedora): 'sudo dnf install python3.6'"
@echo ""
@echo "make check-tox:"
@echo " Run tests against multiple python versions."
@@ -33,8 +34,8 @@
@echo " and install the qemu package in editable mode."
@echo " (Can be used in or outside of a venv.)"
@echo ""
- @echo "make pipenv"
- @echo " Creates pipenv's virtual environment (.venv)"
+ @echo "make min-venv"
+ @echo " Creates the minreqs virtual environment ($(QEMU_MINVENV_DIR))"
@echo ""
@echo "make dev-venv"
@echo " Creates a simple venv for check-dev. ($(QEMU_VENV_DIR))"
@@ -43,21 +44,38 @@
@echo " Remove package build output."
@echo ""
@echo "make distclean:"
- @echo " remove pipenv/venv files, qemu package forwarder,"
+ @echo " remove venv files, qemu package forwarder,"
@echo " built distribution files, and everything from 'make clean'."
@echo ""
@echo -e "Have a nice day ^_^\n"
-.PHONY: pipenv
-pipenv: .venv
-.venv: Pipfile.lock
- @PIPENV_VENV_IN_PROJECT=1 pipenv sync --dev --keep-outdated
- rm -f pyproject.toml
- @touch .venv
+.PHONY: pipenv check-pipenv
+pipenv check-pipenv:
+ @echo "pipenv was dropped; try 'make check-minreqs' or 'make min-venv'"
+ @exit 1
-.PHONY: check-pipenv
-check-pipenv: pipenv
- @pipenv run make check
+.PHONY: min-venv
+min-venv: $(QEMU_MINVENV_DIR) $(QEMU_MINVENV_DIR)/bin/activate
+$(QEMU_MINVENV_DIR) $(QEMU_MINVENV_DIR)/bin/activate: setup.cfg tests/minreqs.txt
+ @echo "VENV $(QEMU_MINVENV_DIR)"
+ @python3.6 -m venv $(QEMU_MINVENV_DIR)
+ @( \
+ echo "ACTIVATE $(QEMU_MINVENV_DIR)"; \
+ . $(QEMU_MINVENV_DIR)/bin/activate; \
+ echo "INSTALL -r tests/minreqs.txt $(QEMU_MINVENV_DIR)";\
+ pip install -r tests/minreqs.txt 1>/dev/null; \
+ echo "INSTALL -e qemu $(QEMU_MINVENV_DIR)"; \
+ pip install -e . 1>/dev/null; \
+ )
+ @touch $(QEMU_MINVENV_DIR)
+
+.PHONY: check-minreqs
+check-minreqs: min-venv
+ @( \
+ echo "ACTIVATE $(QEMU_MINVENV_DIR)"; \
+ . $(QEMU_MINVENV_DIR)/bin/activate; \
+ make check; \
+ )
.PHONY: dev-venv
dev-venv: $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate
@@ -106,6 +124,7 @@
.PHONY: distclean
distclean: clean
- rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/
+ rm -rf qemu.egg-info/ .eggs/ dist/
+ rm -rf $(QEMU_VENV_DIR) $(QEMU_MINVENV_DIR) .tox/
rm -f .coverage .coverage.*
rm -rf htmlcov/
diff --git a/python/Pipfile b/python/Pipfile
deleted file mode 100644
index e7acb8c..0000000
--- a/python/Pipfile
+++ /dev/null
@@ -1,13 +0,0 @@
-[[source]]
-name = "pypi"
-url = "https://pypi.org/simple"
-verify_ssl = true
-
-[dev-packages]
-qemu = {editable = true, extras = ["devel"], path = "."}
-
-[packages]
-qemu = {editable = true,path = "."}
-
-[requires]
-python_version = "3.6"
diff --git a/python/Pipfile.lock b/python/Pipfile.lock
deleted file mode 100644
index ce46404..0000000
--- a/python/Pipfile.lock
+++ /dev/null
@@ -1,347 +0,0 @@
-{
- "_meta": {
- "hash": {
- "sha256": "f1a25654d884a5b450e38d78b1f2e3ebb9073e421cc4358d4bbb83ac251a5670"
- },
- "pipfile-spec": 6,
- "requires": {
- "python_version": "3.6"
- },
- "sources": [
- {
- "name": "pypi",
- "url": "https://pypi.org/simple",
- "verify_ssl": true
- }
- ]
- },
- "default": {
- "qemu": {
- "editable": true,
- "path": "."
- }
- },
- "develop": {
- "appdirs": {
- "hashes": [
- "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41",
- "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"
- ],
- "version": "==1.4.4"
- },
- "astroid": {
- "hashes": [
- "sha256:09bdb456e02564731f8b5957cdd0c98a7f01d2db5e90eb1d794c353c28bfd705",
- "sha256:6a8a51f64dae307f6e0c9db752b66a7951e282389d8362cc1d39a56f3feeb31d"
- ],
- "index": "pypi",
- "version": "==2.6.0"
- },
- "avocado-framework": {
- "hashes": [
- "sha256:244cb569f8eb4e50a22ac82e1a2b2bba2458999f4281efbe2651bd415d59c65b",
- "sha256:6f15998b67ecd0e7dde790c4de4dd249d6df52dfe6d5cc4e2dd6596df51c3583"
- ],
- "index": "pypi",
- "version": "==90.0"
- },
- "distlib": {
- "hashes": [
- "sha256:106fef6dc37dd8c0e2c0a60d3fca3e77460a48907f335fa28420463a6f799736",
- "sha256:23e223426b28491b1ced97dc3bbe183027419dfc7982b4fa2f05d5f3ff10711c"
- ],
- "index": "pypi",
- "version": "==0.3.2"
- },
- "filelock": {
- "hashes": [
- "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59",
- "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"
- ],
- "index": "pypi",
- "version": "==3.0.12"
- },
- "flake8": {
- "hashes": [
- "sha256:6a35f5b8761f45c5513e3405f110a86bea57982c3b75b766ce7b65217abe1670",
- "sha256:c01f8a3963b3571a8e6bd7a4063359aff90749e160778e03817cd9b71c9e07d2"
- ],
- "index": "pypi",
- "version": "==3.6.0"
- },
- "fusepy": {
- "hashes": [
- "sha256:10f5c7f5414241bffecdc333c4d3a725f1d6605cae6b4eaf86a838ff49cdaf6c",
- "sha256:a9f3a3699080ddcf0919fd1eb2cf743e1f5859ca54c2018632f939bdfac269ee"
- ],
- "index": "pypi",
- "version": "==2.0.4"
- },
- "importlib-metadata": {
- "hashes": [
- "sha256:90bb658cdbbf6d1735b6341ce708fc7024a3e14e99ffdc5783edea9f9b077f83",
- "sha256:dc15b2969b4ce36305c51eebe62d418ac7791e9a157911d58bfb1f9ccd8e2070"
- ],
- "markers": "python_version < '3.8'",
- "version": "==1.7.0"
- },
- "importlib-resources": {
- "hashes": [
- "sha256:54161657e8ffc76596c4ede7080ca68cb02962a2e074a2586b695a93a925d36e",
- "sha256:e962bff7440364183203d179d7ae9ad90cb1f2b74dcb84300e88ecc42dca3351"
- ],
- "index": "pypi",
- "version": "==5.1.4"
- },
- "isort": {
- "hashes": [
- "sha256:408e4d75d84f51b64d0824894afee44469eba34a4caee621dc53799f80d71ccc",
- "sha256:64022dea6a06badfa09b300b4dfe8ba968114a737919e8ed50aea1c288f078aa"
- ],
- "index": "pypi",
- "version": "==5.1.2"
- },
- "lazy-object-proxy": {
- "hashes": [
- "sha256:17e0967ba374fc24141738c69736da90e94419338fd4c7c7bef01ee26b339653",
- "sha256:1fee665d2638491f4d6e55bd483e15ef21f6c8c2095f235fef72601021e64f61",
- "sha256:22ddd618cefe54305df49e4c069fa65715be4ad0e78e8d252a33debf00f6ede2",
- "sha256:24a5045889cc2729033b3e604d496c2b6f588c754f7a62027ad4437a7ecc4837",
- "sha256:410283732af311b51b837894fa2f24f2c0039aa7f220135192b38fcc42bd43d3",
- "sha256:4732c765372bd78a2d6b2150a6e99d00a78ec963375f236979c0626b97ed8e43",
- "sha256:489000d368377571c6f982fba6497f2aa13c6d1facc40660963da62f5c379726",
- "sha256:4f60460e9f1eb632584c9685bccea152f4ac2130e299784dbaf9fae9f49891b3",
- "sha256:5743a5ab42ae40caa8421b320ebf3a998f89c85cdc8376d6b2e00bd12bd1b587",
- "sha256:85fb7608121fd5621cc4377a8961d0b32ccf84a7285b4f1d21988b2eae2868e8",
- "sha256:9698110e36e2df951c7c36b6729e96429c9c32b3331989ef19976592c5f3c77a",
- "sha256:9d397bf41caad3f489e10774667310d73cb9c4258e9aed94b9ec734b34b495fd",
- "sha256:b579f8acbf2bdd9ea200b1d5dea36abd93cabf56cf626ab9c744a432e15c815f",
- "sha256:b865b01a2e7f96db0c5d12cfea590f98d8c5ba64ad222300d93ce6ff9138bcad",
- "sha256:bf34e368e8dd976423396555078def5cfc3039ebc6fc06d1ae2c5a65eebbcde4",
- "sha256:c6938967f8528b3668622a9ed3b31d145fab161a32f5891ea7b84f6b790be05b",
- "sha256:d1c2676e3d840852a2de7c7d5d76407c772927addff8d742b9808fe0afccebdf",
- "sha256:d7124f52f3bd259f510651450e18e0fd081ed82f3c08541dffc7b94b883aa981",
- "sha256:d900d949b707778696fdf01036f58c9876a0d8bfe116e8d220cfd4b15f14e741",
- "sha256:ebfd274dcd5133e0afae738e6d9da4323c3eb021b3e13052d8cbd0e457b1256e",
- "sha256:ed361bb83436f117f9917d282a456f9e5009ea12fd6de8742d1a4752c3017e93",
- "sha256:f5144c75445ae3ca2057faac03fda5a902eff196702b0a24daf1d6ce0650514b"
- ],
- "index": "pypi",
- "version": "==1.6.0"
- },
- "mccabe": {
- "hashes": [
- "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",
- "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
- ],
- "version": "==0.6.1"
- },
- "mypy": {
- "hashes": [
- "sha256:00cb1964a7476e871d6108341ac9c1a857d6bd20bf5877f4773ac5e9d92cd3cd",
- "sha256:127de5a9b817a03a98c5ae8a0c46a20dc44442af6dcfa2ae7f96cb519b312efa",
- "sha256:1f3976a945ad7f0a0727aafdc5651c2d3278e3c88dee94e2bf75cd3386b7b2f4",
- "sha256:2f8c098f12b402c19b735aec724cc9105cc1a9eea405d08814eb4b14a6fb1a41",
- "sha256:4ef13b619a289aa025f2273e05e755f8049bb4eaba6d703a425de37d495d178d",
- "sha256:5d142f219bf8c7894dfa79ebfb7d352c4c63a325e75f10dfb4c3db9417dcd135",
- "sha256:62eb5dd4ea86bda8ce386f26684f7f26e4bfe6283c9f2b6ca6d17faf704dcfad",
- "sha256:64c36eb0936d0bfb7d8da49f92c18e312ad2e3ed46e5548ae4ca997b0d33bd59",
- "sha256:75eed74d2faf2759f79c5f56f17388defd2fc994222312ec54ee921e37b31ad4",
- "sha256:974bebe3699b9b46278a7f076635d219183da26e1a675c1f8243a69221758273",
- "sha256:a5e5bb12b7982b179af513dddb06fca12285f0316d74f3964078acbfcf4c68f2",
- "sha256:d31291df31bafb997952dc0a17ebb2737f802c754aed31dd155a8bfe75112c57",
- "sha256:d3b4941de44341227ece1caaf5b08b23e42ad4eeb8b603219afb11e9d4cfb437",
- "sha256:eadb865126da4e3c4c95bdb47fe1bb087a3e3ea14d39a3b13224b8a4d9f9a102"
- ],
- "index": "pypi",
- "version": "==0.780"
- },
- "mypy-extensions": {
- "hashes": [
- "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d",
- "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"
- ],
- "version": "==0.4.3"
- },
- "packaging": {
- "hashes": [
- "sha256:5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5",
- "sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a"
- ],
- "index": "pypi",
- "version": "==20.9"
- },
- "pluggy": {
- "hashes": [
- "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0",
- "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"
- ],
- "index": "pypi",
- "version": "==0.13.1"
- },
- "py": {
- "hashes": [
- "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3",
- "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"
- ],
- "index": "pypi",
- "version": "==1.10.0"
- },
- "pycodestyle": {
- "hashes": [
- "sha256:74abc4e221d393ea5ce1f129ea6903209940c1ecd29e002e8c6933c2b21026e0",
- "sha256:cbc619d09254895b0d12c2c691e237b2e91e9b2ecf5e84c26b35400f93dcfb83",
- "sha256:cbfca99bd594a10f674d0cd97a3d802a1fdef635d4361e1a2658de47ed261e3a"
- ],
- "version": "==2.4.0"
- },
- "pyflakes": {
- "hashes": [
- "sha256:9a7662ec724d0120012f6e29d6248ae3727d821bba522a0e6b356eff19126a49",
- "sha256:f661252913bc1dbe7fcfcbf0af0db3f42ab65aabd1a6ca68fe5d466bace94dae"
- ],
- "version": "==2.0.0"
- },
- "pygments": {
- "hashes": [
- "sha256:a18f47b506a429f6f4b9df81bb02beab9ca21d0a5fee38ed15aef65f0545519f",
- "sha256:d66e804411278594d764fc69ec36ec13d9ae9147193a1740cd34d272ca383b8e"
- ],
- "index": "pypi",
- "version": "==2.9.0"
- },
- "pylint": {
- "hashes": [
- "sha256:082a6d461b54f90eea49ca90fff4ee8b6e45e8029e5dbd72f6107ef84f3779c0",
- "sha256:a01cd675eccf6e25b3bdb42be184eb46aaf89187d612ba0fb5f93328ed6b0fd5"
- ],
- "index": "pypi",
- "version": "==2.8.0"
- },
- "pyparsing": {
- "hashes": [
- "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1",
- "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"
- ],
- "index": "pypi",
- "version": "==2.4.7"
- },
- "qemu": {
- "editable": true,
- "path": "."
- },
- "setuptools": {
- "hashes": [
- "sha256:22c7348c6d2976a52632c67f7ab0cdf40147db7789f9aed18734643fe9cf3373",
- "sha256:4ce92f1e1f8f01233ee9952c04f6b81d1e02939d6e1b488428154974a4d0783e"
- ],
- "markers": "python_version >= '3.6'",
- "version": "==59.6.0"
- },
- "six": {
- "hashes": [
- "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926",
- "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"
- ],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
- "version": "==1.16.0"
- },
- "toml": {
- "hashes": [
- "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b",
- "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"
- ],
- "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",
- "version": "==0.10.2"
- },
- "tox": {
- "hashes": [
- "sha256:c60692d92fe759f46c610ac04c03cf0169432d1ff8e981e8ae63e068d0954fc3",
- "sha256:f179cb4043d7dc1339425dd49ab1dd8c916246b0d9173143c1b0af7498a03ab0"
- ],
- "index": "pypi",
- "version": "==3.18.0"
- },
- "typed-ast": {
- "hashes": [
- "sha256:01ae5f73431d21eead5015997ab41afa53aa1fbe252f9da060be5dad2c730ace",
- "sha256:067a74454df670dcaa4e59349a2e5c81e567d8d65458d480a5b3dfecec08c5ff",
- "sha256:0fb71b8c643187d7492c1f8352f2c15b4c4af3f6338f21681d3681b3dc31a266",
- "sha256:1b3ead4a96c9101bef08f9f7d1217c096f31667617b58de957f690c92378b528",
- "sha256:2068531575a125b87a41802130fa7e29f26c09a2833fea68d9a40cf33902eba6",
- "sha256:209596a4ec71d990d71d5e0d312ac935d86930e6eecff6ccc7007fe54d703808",
- "sha256:2c726c276d09fc5c414693a2de063f521052d9ea7c240ce553316f70656c84d4",
- "sha256:398e44cd480f4d2b7ee8d98385ca104e35c81525dd98c519acff1b79bdaac363",
- "sha256:52b1eb8c83f178ab787f3a4283f68258525f8d70f778a2f6dd54d3b5e5fb4341",
- "sha256:5feca99c17af94057417d744607b82dd0a664fd5e4ca98061480fd8b14b18d04",
- "sha256:7538e495704e2ccda9b234b82423a4038f324f3a10c43bc088a1636180f11a41",
- "sha256:760ad187b1041a154f0e4d0f6aae3e40fdb51d6de16e5c99aedadd9246450e9e",
- "sha256:777a26c84bea6cd934422ac2e3b78863a37017618b6e5c08f92ef69853e765d3",
- "sha256:95431a26309a21874005845c21118c83991c63ea800dd44843e42a916aec5899",
- "sha256:9ad2c92ec681e02baf81fdfa056fe0d818645efa9af1f1cd5fd6f1bd2bdfd805",
- "sha256:9c6d1a54552b5330bc657b7ef0eae25d00ba7ffe85d9ea8ae6540d2197a3788c",
- "sha256:aee0c1256be6c07bd3e1263ff920c325b59849dc95392a05f258bb9b259cf39c",
- "sha256:af3d4a73793725138d6b334d9d247ce7e5f084d96284ed23f22ee626a7b88e39",
- "sha256:b36b4f3920103a25e1d5d024d155c504080959582b928e91cb608a65c3a49e1a",
- "sha256:b9574c6f03f685070d859e75c7f9eeca02d6933273b5e69572e5ff9d5e3931c3",
- "sha256:bff6ad71c81b3bba8fa35f0f1921fb24ff4476235a6e94a26ada2e54370e6da7",
- "sha256:c190f0899e9f9f8b6b7863debfb739abcb21a5c054f911ca3596d12b8a4c4c7f",
- "sha256:c907f561b1e83e93fad565bac5ba9c22d96a54e7ea0267c708bffe863cbe4075",
- "sha256:cae53c389825d3b46fb37538441f75d6aecc4174f615d048321b716df2757fb0",
- "sha256:dd4a21253f42b8d2b48410cb31fe501d32f8b9fbeb1f55063ad102fe9c425e40",
- "sha256:dde816ca9dac1d9c01dd504ea5967821606f02e510438120091b84e852367428",
- "sha256:f2362f3cb0f3172c42938946dbc5b7843c2a28aec307c49100c8b38764eb6927",
- "sha256:f328adcfebed9f11301eaedfa48e15bdece9b519fb27e6a8c01aa52a17ec31b3",
- "sha256:f8afcf15cc511ada719a88e013cec87c11aff7b91f019295eb4530f96fe5ef2f",
- "sha256:fb1bbeac803adea29cedd70781399c99138358c26d05fcbd23c13016b7f5ec65"
- ],
- "markers": "python_version < '3.8' and implementation_name == 'cpython'",
- "version": "==1.4.3"
- },
- "typing-extensions": {
- "hashes": [
- "sha256:0ac0f89795dd19de6b97debb0c6af1c70987fd80a2d62d1958f7e56fcc31b497",
- "sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342",
- "sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84"
- ],
- "index": "pypi",
- "version": "==3.10.0.0"
- },
- "urwid": {
- "hashes": [
- "sha256:588bee9c1cb208d0906a9f73c613d2bd32c3ed3702012f51efe318a3f2127eae"
- ],
- "index": "pypi",
- "version": "==2.1.2"
- },
- "urwid-readline": {
- "hashes": [
- "sha256:018020cbc864bb5ed87be17dc26b069eae2755cb29f3a9c569aac3bded1efaf4"
- ],
- "index": "pypi",
- "version": "==0.13"
- },
- "virtualenv": {
- "hashes": [
- "sha256:14fdf849f80dbb29a4eb6caa9875d476ee2a5cf76a5f5415fa2f1606010ab467",
- "sha256:2b0126166ea7c9c3661f5b8e06773d28f83322de7a3ff7d06f0aed18c9de6a76"
- ],
- "index": "pypi",
- "version": "==20.4.7"
- },
- "wrapt": {
- "hashes": [
- "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"
- ],
- "version": "==1.12.1"
- },
- "zipp": {
- "hashes": [
- "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76",
- "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098"
- ],
- "index": "pypi",
- "version": "==3.4.1"
- }
- }
-}
diff --git a/python/README.rst b/python/README.rst
index 9c1fcea..d62e715 100644
--- a/python/README.rst
+++ b/python/README.rst
@@ -77,9 +77,6 @@
- ``MANIFEST.in`` is read by python setuptools, it specifies additional files
that should be included by a source distribution.
- ``PACKAGE.rst`` is used as the README file that is visible on PyPI.org.
-- ``Pipfile`` is used by Pipenv to generate ``Pipfile.lock``.
-- ``Pipfile.lock`` is a set of pinned package dependencies that this package
- is tested under in our CI suite. It is used by ``make check-pipenv``.
- ``README.rst`` you are here!
- ``VERSION`` contains the PEP-440 compliant version used to describe
this package; it is referenced by ``setup.cfg``.
diff --git a/python/qemu/qmp/protocol.py b/python/qemu/qmp/protocol.py
index 6d3d739..22e6029 100644
--- a/python/qemu/qmp/protocol.py
+++ b/python/qemu/qmp/protocol.py
@@ -207,7 +207,7 @@
logger = logging.getLogger(__name__)
# Maximum allowable size of read buffer
- _limit = (64 * 1024)
+ _limit = 64 * 1024
# -------------------------
# Section: Public interface
diff --git a/python/qemu/qmp/qmp_client.py b/python/qemu/qmp/qmp_client.py
index b5772e7..9d73ae6 100644
--- a/python/qemu/qmp/qmp_client.py
+++ b/python/qemu/qmp/qmp_client.py
@@ -198,7 +198,7 @@
logger = logging.getLogger(__name__)
# Read buffer limit; 10MB like libvirt default
- _limit = (10 * 1024 * 1024)
+ _limit = 10 * 1024 * 1024
# Type alias for pending execute() result items
_PendingT = Union[Message, ExecInterruptedError]
diff --git a/python/qemu/utils/qemu_ga_client.py b/python/qemu/utils/qemu_ga_client.py
index 8c38a7a..d8411bb 100644
--- a/python/qemu/utils/qemu_ga_client.py
+++ b/python/qemu/utils/qemu_ga_client.py
@@ -155,7 +155,7 @@
def fsfreeze(self, cmd: str) -> object:
if cmd not in ['status', 'freeze', 'thaw']:
- raise Exception('Invalid command: ' + cmd)
+ raise ValueError('Invalid command: ' + cmd)
# Can be int (freeze, thaw) or GuestFsfreezeStatus (status)
return getattr(self.qga, 'fsfreeze' + '_' + cmd)()
@@ -167,7 +167,7 @@
def suspend(self, mode: str) -> None:
if mode not in ['disk', 'ram', 'hybrid']:
- raise Exception('Invalid mode: ' + mode)
+ raise ValueError('Invalid mode: ' + mode)
try:
getattr(self.qga, 'suspend' + '_' + mode)()
@@ -178,7 +178,7 @@
def shutdown(self, mode: str = 'powerdown') -> None:
if mode not in ['powerdown', 'halt', 'reboot']:
- raise Exception('Invalid mode: ' + mode)
+ raise ValueError('Invalid mode: ' + mode)
try:
self.qga.shutdown(mode=mode)
diff --git a/python/setup.cfg b/python/setup.cfg
index 5641815..9e923d9 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -33,9 +33,7 @@
* = py.typed
[options.extras_require]
-# For the devel group, When adding new dependencies or bumping the minimum
-# version, use e.g. "pipenv install --dev pylint==3.0.0".
-# Subsequently, edit 'Pipfile' to remove e.g. 'pylint = "==3.0.0'.
+# Remember to update tests/minreqs.txt if changing anything below:
devel =
avocado-framework >= 90.0
flake8 >= 3.6.0
diff --git a/python/tests/minreqs.txt b/python/tests/minreqs.txt
new file mode 100644
index 0000000..dfb8abb
--- /dev/null
+++ b/python/tests/minreqs.txt
@@ -0,0 +1,45 @@
+# This file lists the ***oldest possible dependencies*** needed to run
+# "make check" successfully under ***Python 3.6***. It is used primarily
+# by GitLab CI to ensure that our stated minimum versions in setup.cfg
+# are truthful and regularly validated.
+#
+# This file should not contain any dependencies that are not expressed
+# by the [devel] section of setup.cfg, except for transitive
+# dependencies which must be enumerated here explicitly to eliminate
+# dependency resolution ambiguity.
+#
+# When adding new dependencies, pin the very oldest non-yanked version
+# on PyPI that allows the test suite to pass.
+
+# Dependencies for the TUI addon (Required for successful linting)
+urwid==2.1.2
+urwid-readline==0.13
+Pygments==2.9.0
+
+# Dependencies for FUSE support for qom-fuse
+fusepy==2.0.4
+
+# Test-runners, utilities, etc.
+avocado-framework==90.0
+
+# Linters
+flake8==3.6.0
+isort==5.1.2
+mypy==0.780
+pylint==2.8.0
+
+# Transitive flake8 dependencies
+mccabe==0.6.0
+pycodestyle==2.4.0
+pyflakes==2.0.0
+
+# Transitive mypy dependencies
+mypy-extensions==0.4.3
+typed-ast==1.4.0
+typing-extensions==3.7.4
+
+# Transitive pylint dependencies
+astroid==2.5.4
+lazy-object-proxy==1.4.0
+toml==0.10.0
+wrapt==1.12.1
diff --git a/scripts/qapi/.flake8 b/scripts/qapi/.flake8
index 6b158c6..a873ff6 100644
--- a/scripts/qapi/.flake8
+++ b/scripts/qapi/.flake8
@@ -1,2 +1,3 @@
[flake8]
-extend-ignore = E722 # Prefer pylint's bare-except checks to flake8's
+# Prefer pylint's bare-except checks to flake8's
+extend-ignore = E722
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 5a1782b..ca01ea6 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -33,7 +33,6 @@
import re
from typing import (
- Collection,
Dict,
Iterable,
List,
@@ -44,18 +43,10 @@
from .common import c_name
from .error import QAPISemError
-from .parser import QAPIDoc
+from .parser import QAPIExpression
from .source import QAPISourceInfo
-# Deserialized JSON objects as returned by the parser.
-# The values of this mapping are not necessary to exhaustively type
-# here (and also not practical as long as mypy lacks recursive
-# types), because the purpose of this module is to interrogate that
-# type.
-_JSONObject = Dict[str, object]
-
-
# See check_name_str(), below.
valid_name = re.compile(r'(__[a-z0-9.-]+_)?'
r'(x-)?'
@@ -192,11 +183,11 @@
info, "%s name should not end in 'List'" % meta)
-def check_keys(value: _JSONObject,
+def check_keys(value: Dict[str, object],
info: QAPISourceInfo,
source: str,
- required: Collection[str],
- optional: Collection[str]) -> None:
+ required: List[str],
+ optional: List[str]) -> None:
"""
Ensure that a dict has a specific set of keys.
@@ -229,12 +220,11 @@
pprint(unknown), pprint(allowed)))
-def check_flags(expr: _JSONObject, info: QAPISourceInfo) -> None:
+def check_flags(expr: QAPIExpression) -> None:
"""
Ensure flag members (if present) have valid values.
:param expr: The expression to validate.
- :param info: QAPI schema source file information.
:raise QAPISemError:
When certain flags have an invalid value, or when
@@ -243,21 +233,22 @@
for key in ('gen', 'success-response'):
if key in expr and expr[key] is not False:
raise QAPISemError(
- info, "flag '%s' may only use false value" % key)
+ expr.info, "flag '%s' may only use false value" % key)
for key in ('boxed', 'allow-oob', 'allow-preconfig', 'coroutine'):
if key in expr and expr[key] is not True:
raise QAPISemError(
- info, "flag '%s' may only use true value" % key)
+ expr.info, "flag '%s' may only use true value" % key)
if 'allow-oob' in expr and 'coroutine' in expr:
# This is not necessarily a fundamental incompatibility, but
# we don't have a use case and the desired semantics isn't
# obvious. The simplest solution is to forbid it until we get
# a use case for it.
- raise QAPISemError(info, "flags 'allow-oob' and 'coroutine' "
- "are incompatible")
+ raise QAPISemError(
+ expr.info, "flags 'allow-oob' and 'coroutine' are incompatible")
-def check_if(expr: _JSONObject, info: QAPISourceInfo, source: str) -> None:
+def check_if(expr: Dict[str, object],
+ info: QAPISourceInfo, source: str) -> None:
"""
Validate the ``if`` member of an object.
@@ -447,12 +438,11 @@
check_if(feat, info, source)
-def check_enum(expr: _JSONObject, info: QAPISourceInfo) -> None:
+def check_enum(expr: QAPIExpression) -> None:
"""
Normalize and validate this expression as an ``enum`` definition.
:param expr: The expression to validate.
- :param info: QAPI schema source file information.
:raise QAPISemError: When ``expr`` is not a valid ``enum``.
:return: None, ``expr`` is normalized in-place as needed.
@@ -460,6 +450,7 @@
name = expr['enum']
members = expr['data']
prefix = expr.get('prefix')
+ info = expr.info
if not isinstance(members, list):
raise QAPISemError(info, "'data' must be an array")
@@ -486,12 +477,11 @@
check_features(member.get('features'), info)
-def check_struct(expr: _JSONObject, info: QAPISourceInfo) -> None:
+def check_struct(expr: QAPIExpression) -> None:
"""
Normalize and validate this expression as a ``struct`` definition.
:param expr: The expression to validate.
- :param info: QAPI schema source file information.
:raise QAPISemError: When ``expr`` is not a valid ``struct``.
:return: None, ``expr`` is normalized in-place as needed.
@@ -499,16 +489,15 @@
name = cast(str, expr['struct']) # Checked in check_exprs
members = expr['data']
- check_type(members, info, "'data'", allow_dict=name)
- check_type(expr.get('base'), info, "'base'")
+ check_type(members, expr.info, "'data'", allow_dict=name)
+ check_type(expr.get('base'), expr.info, "'base'")
-def check_union(expr: _JSONObject, info: QAPISourceInfo) -> None:
+def check_union(expr: QAPIExpression) -> None:
"""
Normalize and validate this expression as a ``union`` definition.
:param expr: The expression to validate.
- :param info: QAPI schema source file information.
:raise QAPISemError: when ``expr`` is not a valid ``union``.
:return: None, ``expr`` is normalized in-place as needed.
@@ -517,6 +506,7 @@
base = expr['base']
discriminator = expr['discriminator']
members = expr['data']
+ info = expr.info
check_type(base, info, "'base'", allow_dict=name)
check_name_is_str(discriminator, info, "'discriminator'")
@@ -531,17 +521,17 @@
check_type(value['type'], info, source, allow_array=not base)
-def check_alternate(expr: _JSONObject, info: QAPISourceInfo) -> None:
+def check_alternate(expr: QAPIExpression) -> None:
"""
Normalize and validate this expression as an ``alternate`` definition.
:param expr: The expression to validate.
- :param info: QAPI schema source file information.
:raise QAPISemError: When ``expr`` is not a valid ``alternate``.
:return: None, ``expr`` is normalized in-place as needed.
"""
members = expr['data']
+ info = expr.info
if not members:
raise QAPISemError(info, "'data' must not be empty")
@@ -557,12 +547,11 @@
check_type(value['type'], info, source, allow_array=True)
-def check_command(expr: _JSONObject, info: QAPISourceInfo) -> None:
+def check_command(expr: QAPIExpression) -> None:
"""
Normalize and validate this expression as a ``command`` definition.
:param expr: The expression to validate.
- :param info: QAPI schema source file information.
:raise QAPISemError: When ``expr`` is not a valid ``command``.
:return: None, ``expr`` is normalized in-place as needed.
@@ -572,17 +561,16 @@
boxed = expr.get('boxed', False)
if boxed and args is None:
- raise QAPISemError(info, "'boxed': true requires 'data'")
- check_type(args, info, "'data'", allow_dict=not boxed)
- check_type(rets, info, "'returns'", allow_array=True)
+ raise QAPISemError(expr.info, "'boxed': true requires 'data'")
+ check_type(args, expr.info, "'data'", allow_dict=not boxed)
+ check_type(rets, expr.info, "'returns'", allow_array=True)
-def check_event(expr: _JSONObject, info: QAPISourceInfo) -> None:
+def check_event(expr: QAPIExpression) -> None:
"""
Normalize and validate this expression as an ``event`` definition.
:param expr: The expression to validate.
- :param info: QAPI schema source file information.
:raise QAPISemError: When ``expr`` is not a valid ``event``.
:return: None, ``expr`` is normalized in-place as needed.
@@ -591,11 +579,11 @@
boxed = expr.get('boxed', False)
if boxed and args is None:
- raise QAPISemError(info, "'boxed': true requires 'data'")
- check_type(args, info, "'data'", allow_dict=not boxed)
+ raise QAPISemError(expr.info, "'boxed': true requires 'data'")
+ check_type(args, expr.info, "'data'", allow_dict=not boxed)
-def check_exprs(exprs: List[_JSONObject]) -> List[_JSONObject]:
+def check_exprs(exprs: List[QAPIExpression]) -> List[QAPIExpression]:
"""
Validate and normalize a list of parsed QAPI schema expressions.
@@ -607,21 +595,9 @@
:raise QAPISemError: When any expression fails validation.
:return: The same list of expressions (now modified).
"""
- for expr_elem in exprs:
- # Expression
- assert isinstance(expr_elem['expr'], dict)
- for key in expr_elem['expr'].keys():
- assert isinstance(key, str)
- expr: _JSONObject = expr_elem['expr']
-
- # QAPISourceInfo
- assert isinstance(expr_elem['info'], QAPISourceInfo)
- info: QAPISourceInfo = expr_elem['info']
-
- # Optional[QAPIDoc]
- tmp = expr_elem.get('doc')
- assert tmp is None or isinstance(tmp, QAPIDoc)
- doc: Optional[QAPIDoc] = tmp
+ for expr in exprs:
+ info = expr.info
+ doc = expr.doc
if 'include' in expr:
continue
@@ -653,24 +629,24 @@
if meta == 'enum':
check_keys(expr, info, meta,
['enum', 'data'], ['if', 'features', 'prefix'])
- check_enum(expr, info)
+ check_enum(expr)
elif meta == 'union':
check_keys(expr, info, meta,
['union', 'base', 'discriminator', 'data'],
['if', 'features'])
normalize_members(expr.get('base'))
normalize_members(expr['data'])
- check_union(expr, info)
+ check_union(expr)
elif meta == 'alternate':
check_keys(expr, info, meta,
['alternate', 'data'], ['if', 'features'])
normalize_members(expr['data'])
- check_alternate(expr, info)
+ check_alternate(expr)
elif meta == 'struct':
check_keys(expr, info, meta,
['struct', 'data'], ['base', 'if', 'features'])
normalize_members(expr['data'])
- check_struct(expr, info)
+ check_struct(expr)
elif meta == 'command':
check_keys(expr, info, meta,
['command'],
@@ -678,17 +654,17 @@
'gen', 'success-response', 'allow-oob',
'allow-preconfig', 'coroutine'])
normalize_members(expr.get('data'))
- check_command(expr, info)
+ check_command(expr)
elif meta == 'event':
check_keys(expr, info, meta,
['event'], ['data', 'boxed', 'if', 'features'])
normalize_members(expr.get('data'))
- check_event(expr, info)
+ check_event(expr)
else:
assert False, 'unexpected meta type'
check_if(expr, info, meta)
check_features(expr.get('features'), info)
- check_flags(expr, info)
+ check_flags(expr)
return exprs
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 1b006cd..878f90b 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -21,6 +21,7 @@
TYPE_CHECKING,
Dict,
List,
+ Mapping,
Optional,
Set,
Union,
@@ -37,15 +38,19 @@
from .schema import QAPISchemaFeature, QAPISchemaMember
-#: Represents a single Top Level QAPI schema expression.
-TopLevelExpr = Dict[str, object]
-
# Return value alias for get_expr().
_ExprValue = Union[List[object], Dict[str, object], str, bool]
-# FIXME: Consolidate and centralize definitions for TopLevelExpr,
-# _ExprValue, _JSONValue, and _JSONObject; currently scattered across
-# several modules.
+
+class QAPIExpression(Dict[str, object]):
+ # pylint: disable=too-few-public-methods
+ def __init__(self,
+ data: Mapping[str, object],
+ info: QAPISourceInfo,
+ doc: Optional['QAPIDoc'] = None):
+ super().__init__(data)
+ self.info = info
+ self.doc: Optional['QAPIDoc'] = doc
class QAPIParseError(QAPISourceError):
@@ -100,7 +105,7 @@
self.line_pos = 0
# Parser output:
- self.exprs: List[Dict[str, object]] = []
+ self.exprs: List[QAPIExpression] = []
self.docs: List[QAPIDoc] = []
# Showtime!
@@ -147,8 +152,7 @@
"value of 'include' must be a string")
incl_fname = os.path.join(os.path.dirname(self._fname),
include)
- self.exprs.append({'expr': {'include': incl_fname},
- 'info': info})
+ self._add_expr(OrderedDict({'include': incl_fname}), info)
exprs_include = self._include(include, info, incl_fname,
self._included)
if exprs_include:
@@ -165,17 +169,18 @@
for name, value in pragma.items():
self._pragma(name, value, info)
else:
- expr_elem = {'expr': expr,
- 'info': info}
- if cur_doc:
- if not cur_doc.symbol:
- raise QAPISemError(
- cur_doc.info, "definition documentation required")
- expr_elem['doc'] = cur_doc
- self.exprs.append(expr_elem)
+ if cur_doc and not cur_doc.symbol:
+ raise QAPISemError(
+ cur_doc.info, "definition documentation required")
+ self._add_expr(expr, info, cur_doc)
cur_doc = None
self.reject_expr_doc(cur_doc)
+ def _add_expr(self, expr: Mapping[str, object],
+ info: QAPISourceInfo,
+ doc: Optional['QAPIDoc'] = None) -> None:
+ self.exprs.append(QAPIExpression(expr, info, doc))
+
@staticmethod
def reject_expr_doc(doc: Optional['QAPIDoc']) -> None:
if doc and doc.symbol:
@@ -784,7 +789,7 @@
% feature.name)
self.features[feature.name].connect(feature)
- def check_expr(self, expr: TopLevelExpr) -> None:
+ def check_expr(self, expr: QAPIExpression) -> None:
if self.has_section('Returns') and 'command' not in expr:
raise QAPISemError(self.info,
"'Returns:' is only valid for commands")
diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc
index a724628..90546df 100644
--- a/scripts/qapi/pylintrc
+++ b/scripts/qapi/pylintrc
@@ -23,6 +23,7 @@
too-many-statements,
too-many-instance-attributes,
consider-using-f-string,
+ useless-option-value,
[REPORTS]
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index cd86611..207e4d7 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -17,7 +17,7 @@
from collections import OrderedDict
import os
import re
-from typing import Optional
+from typing import List, Optional
from .common import (
POINTER_SUFFIX,
@@ -29,7 +29,7 @@
)
from .error import QAPIError, QAPISemError, QAPISourceError
from .expr import check_exprs
-from .parser import QAPISchemaParser
+from .parser import QAPIExpression, QAPISchemaParser
class QAPISchemaIfCond:
@@ -964,10 +964,11 @@
name = self._module_name(fname)
return self._module_dict[name]
- def _def_include(self, expr, info, doc):
+ def _def_include(self, expr: QAPIExpression):
include = expr['include']
- assert doc is None
- self._def_entity(QAPISchemaInclude(self._make_module(include), info))
+ assert expr.doc is None
+ self._def_entity(
+ QAPISchemaInclude(self._make_module(include), expr.info))
def _def_builtin_type(self, name, json_type, c_type):
self._def_entity(QAPISchemaBuiltinType(name, json_type, c_type))
@@ -1045,14 +1046,15 @@
name, info, None, ifcond, None, None, members, None))
return name
- def _def_enum_type(self, expr, info, doc):
+ def _def_enum_type(self, expr: QAPIExpression):
name = expr['enum']
data = expr['data']
prefix = expr.get('prefix')
ifcond = QAPISchemaIfCond(expr.get('if'))
+ info = expr.info
features = self._make_features(expr.get('features'), info)
self._def_entity(QAPISchemaEnumType(
- name, info, doc, ifcond, features,
+ name, info, expr.doc, ifcond, features,
self._make_enum_members(data, info), prefix))
def _make_member(self, name, typ, ifcond, features, info):
@@ -1072,14 +1074,15 @@
value.get('features'), info)
for (key, value) in data.items()]
- def _def_struct_type(self, expr, info, doc):
+ def _def_struct_type(self, expr: QAPIExpression):
name = expr['struct']
base = expr.get('base')
data = expr['data']
+ info = expr.info
ifcond = QAPISchemaIfCond(expr.get('if'))
features = self._make_features(expr.get('features'), info)
self._def_entity(QAPISchemaObjectType(
- name, info, doc, ifcond, features, base,
+ name, info, expr.doc, ifcond, features, base,
self._make_members(data, info),
None))
@@ -1089,11 +1092,13 @@
typ = self._make_array_type(typ[0], info)
return QAPISchemaVariant(case, info, typ, ifcond)
- def _def_union_type(self, expr, info, doc):
+ def _def_union_type(self, expr: QAPIExpression):
name = expr['union']
base = expr['base']
tag_name = expr['discriminator']
data = expr['data']
+ assert isinstance(data, dict)
+ info = expr.info
ifcond = QAPISchemaIfCond(expr.get('if'))
features = self._make_features(expr.get('features'), info)
if isinstance(base, dict):
@@ -1105,17 +1110,19 @@
QAPISchemaIfCond(value.get('if')),
info)
for (key, value) in data.items()]
- members = []
+ members: List[QAPISchemaObjectTypeMember] = []
self._def_entity(
- QAPISchemaObjectType(name, info, doc, ifcond, features,
+ QAPISchemaObjectType(name, info, expr.doc, ifcond, features,
base, members,
QAPISchemaVariants(
tag_name, info, None, variants)))
- def _def_alternate_type(self, expr, info, doc):
+ def _def_alternate_type(self, expr: QAPIExpression):
name = expr['alternate']
data = expr['data']
+ assert isinstance(data, dict)
ifcond = QAPISchemaIfCond(expr.get('if'))
+ info = expr.info
features = self._make_features(expr.get('features'), info)
variants = [
self._make_variant(key, value['type'],
@@ -1124,11 +1131,11 @@
for (key, value) in data.items()]
tag_member = QAPISchemaObjectTypeMember('type', info, 'QType', False)
self._def_entity(
- QAPISchemaAlternateType(name, info, doc, ifcond, features,
- QAPISchemaVariants(
- None, info, tag_member, variants)))
+ QAPISchemaAlternateType(
+ name, info, expr.doc, ifcond, features,
+ QAPISchemaVariants(None, info, tag_member, variants)))
- def _def_command(self, expr, info, doc):
+ def _def_command(self, expr: QAPIExpression):
name = expr['command']
data = expr.get('data')
rets = expr.get('returns')
@@ -1139,6 +1146,7 @@
allow_preconfig = expr.get('allow-preconfig', False)
coroutine = expr.get('coroutine', False)
ifcond = QAPISchemaIfCond(expr.get('if'))
+ info = expr.info
features = self._make_features(expr.get('features'), info)
if isinstance(data, OrderedDict):
data = self._make_implicit_object_type(
@@ -1147,44 +1155,42 @@
if isinstance(rets, list):
assert len(rets) == 1
rets = self._make_array_type(rets[0], info)
- self._def_entity(QAPISchemaCommand(name, info, doc, ifcond, features,
- data, rets,
+ self._def_entity(QAPISchemaCommand(name, info, expr.doc, ifcond,
+ features, data, rets,
gen, success_response,
boxed, allow_oob, allow_preconfig,
coroutine))
- def _def_event(self, expr, info, doc):
+ def _def_event(self, expr: QAPIExpression):
name = expr['event']
data = expr.get('data')
boxed = expr.get('boxed', False)
ifcond = QAPISchemaIfCond(expr.get('if'))
+ info = expr.info
features = self._make_features(expr.get('features'), info)
if isinstance(data, OrderedDict):
data = self._make_implicit_object_type(
name, info, ifcond,
'arg', self._make_members(data, info))
- self._def_entity(QAPISchemaEvent(name, info, doc, ifcond, features,
- data, boxed))
+ self._def_entity(QAPISchemaEvent(name, info, expr.doc, ifcond,
+ features, data, boxed))
def _def_exprs(self, exprs):
- for expr_elem in exprs:
- expr = expr_elem['expr']
- info = expr_elem['info']
- doc = expr_elem.get('doc')
+ for expr in exprs:
if 'enum' in expr:
- self._def_enum_type(expr, info, doc)
+ self._def_enum_type(expr)
elif 'struct' in expr:
- self._def_struct_type(expr, info, doc)
+ self._def_struct_type(expr)
elif 'union' in expr:
- self._def_union_type(expr, info, doc)
+ self._def_union_type(expr)
elif 'alternate' in expr:
- self._def_alternate_type(expr, info, doc)
+ self._def_alternate_type(expr)
elif 'command' in expr:
- self._def_command(expr, info, doc)
+ self._def_command(expr)
elif 'event' in expr:
- self._def_event(expr, info, doc)
+ self._def_event(expr)
elif 'include' in expr:
- self._def_include(expr, info, doc)
+ self._def_include(expr)
else:
assert False
diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
index c3a2cf6..7869712 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -121,7 +121,9 @@
return gdb_get_reg32(mem_buf, env->regs[gpr_map32[n]]);
}
} else if (n >= IDX_FP_REGS && n < IDX_FP_REGS + 8) {
- floatx80 *fp = (floatx80 *) &env->fpregs[n - IDX_FP_REGS];
+ int st_index = n - IDX_FP_REGS;
+ int r_index = (st_index + env->fpstt) % 8;
+ floatx80 *fp = &env->fpregs[r_index].d;
int len = gdb_get_reg64(mem_buf, cpu_to_le64(fp->low));
len += gdb_get_reg16(mem_buf, cpu_to_le16(fp->high));
return len;
diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc
index 0d7c6e8..e61ae9a 100644
--- a/target/i386/tcg/emit.c.inc
+++ b/target/i386/tcg/emit.c.inc
@@ -1037,6 +1037,8 @@
#ifdef TARGET_X86_64
case MO_32:
/* If TL is 64-bit just do everything in 64-bit arithmetic. */
+ tcg_gen_ext32u_tl(s->T0, s->T0);
+ tcg_gen_ext32u_tl(s->T1, s->T1);
tcg_gen_add_i64(s->T0, s->T0, s->T1);
tcg_gen_add_i64(s->T0, s->T0, carry_in);
tcg_gen_shri_i64(carry_out, s->T0, 32);
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
index 817681f..a2d2f5c 100644
--- a/target/microblaze/cpu.c
+++ b/target/microblaze/cpu.c
@@ -28,6 +28,7 @@
#include "qemu/module.h"
#include "hw/qdev-properties.h"
#include "exec/exec-all.h"
+#include "exec/gdbstub.h"
#include "fpu/softfloat-helpers.h"
static const struct {
@@ -294,6 +295,9 @@
CPUMBState *env = &cpu->env;
cpu_set_cpustate_pointers(cpu);
+ gdb_register_coprocessor(CPU(cpu), mb_cpu_gdb_read_stack_protect,
+ mb_cpu_gdb_write_stack_protect, 2,
+ "microblaze-stack-protect.xml", 0);
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
@@ -422,7 +426,8 @@
cc->sysemu_ops = &mb_sysemu_ops;
#endif
device_class_set_props(dc, mb_properties);
- cc->gdb_num_core_regs = 32 + 27;
+ cc->gdb_num_core_regs = 32 + 25;
+ cc->gdb_core_xml_file = "microblaze-core.xml";
cc->disas_set_info = mb_disas_set_info;
cc->tcg_ops = &mb_tcg_ops;
diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h
index 1e84dd8..e541fbb 100644
--- a/target/microblaze/cpu.h
+++ b/target/microblaze/cpu.h
@@ -367,6 +367,8 @@
MemTxAttrs *attrs);
int mb_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
int mb_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+int mb_cpu_gdb_read_stack_protect(CPUArchState *cpu, GByteArray *buf, int reg);
+int mb_cpu_gdb_write_stack_protect(CPUArchState *cpu, uint8_t *buf, int reg);
static inline uint32_t mb_cpu_read_msr(const CPUMBState *env)
{
diff --git a/target/microblaze/gdbstub.c b/target/microblaze/gdbstub.c
index 2e6e070..8143fca 100644
--- a/target/microblaze/gdbstub.c
+++ b/target/microblaze/gdbstub.c
@@ -39,8 +39,11 @@
GDB_PVR0 = 32 + 6,
GDB_PVR11 = 32 + 17,
GDB_EDR = 32 + 18,
- GDB_SLR = 32 + 25,
- GDB_SHR = 32 + 26,
+};
+
+enum {
+ GDB_SP_SHL,
+ GDB_SP_SHR,
};
int mb_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
@@ -83,12 +86,6 @@
case GDB_EDR:
val = env->edr;
break;
- case GDB_SLR:
- val = env->slr;
- break;
- case GDB_SHR:
- val = env->shr;
- break;
default:
/* Other SRegs aren't modeled, so report a value of 0 */
val = 0;
@@ -97,6 +94,23 @@
return gdb_get_reg32(mem_buf, val);
}
+int mb_cpu_gdb_read_stack_protect(CPUMBState *env, GByteArray *mem_buf, int n)
+{
+ uint32_t val;
+
+ switch (n) {
+ case GDB_SP_SHL:
+ val = env->slr;
+ break;
+ case GDB_SP_SHR:
+ val = env->shr;
+ break;
+ default:
+ return 0;
+ }
+ return gdb_get_reg32(mem_buf, val);
+}
+
int mb_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
@@ -135,12 +149,21 @@
case GDB_EDR:
env->edr = tmp;
break;
- case GDB_SLR:
- env->slr = tmp;
+ }
+ return 4;
+}
+
+int mb_cpu_gdb_write_stack_protect(CPUMBState *env, uint8_t *mem_buf, int n)
+{
+ switch (n) {
+ case GDB_SP_SHL:
+ env->slr = ldl_p(mem_buf);
break;
- case GDB_SHR:
- env->shr = tmp;
+ case GDB_SP_SHR:
+ env->shr = ldl_p(mem_buf);
break;
+ default:
+ return 0;
}
return 4;
}
diff --git a/tests/docker/dockerfiles/python.docker b/tests/docker/dockerfiles/python.docker
index 56d8841..175c10a 100644
--- a/tests/docker/dockerfiles/python.docker
+++ b/tests/docker/dockerfiles/python.docker
@@ -7,7 +7,6 @@
ENV PACKAGES \
gcc \
make \
- pipenv \
python3 \
python3-pip \
python3-tox \
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 94aeb3f..3e82c63 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -720,7 +720,7 @@
signal.setitimer(signal.ITIMER_REAL, 0)
return False
def timeout(self, signum, frame):
- raise Exception(self.errmsg)
+ raise TimeoutError(self.errmsg)
def file_pattern(name):
return "{0}-{1}".format(os.getpid(), name)
@@ -804,7 +804,7 @@
elif imgproto == 'ssh':
return "ssh://%s@127.0.0.1:22%s" % (os.environ.get('USER'), path)
else:
- raise Exception("Protocol %s not supported" % (imgproto))
+ raise ValueError("Protocol %s not supported" % (imgproto))
class VM(qtest.QEMUQtestMachine):
'''A QEMU VM'''
diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
index fc9c4b4..dda55fa 100755
--- a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
+++ b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
@@ -84,7 +84,7 @@
e['vm'] = 'SRC'
for e in self.vm_b_events:
e['vm'] = 'DST'
- events = (self.vm_a_events + self.vm_b_events)
+ events = self.vm_a_events + self.vm_b_events
events = [(e['timestamp']['seconds'],
e['timestamp']['microseconds'],
e['vm'],
diff --git a/tests/tcg/x86_64/Makefile.target b/tests/tcg/x86_64/Makefile.target
index 4eac782..e64aab1 100644
--- a/tests/tcg/x86_64/Makefile.target
+++ b/tests/tcg/x86_64/Makefile.target
@@ -12,11 +12,14 @@
X86_64_TESTS += vsyscall
X86_64_TESTS += noexec
X86_64_TESTS += cmpxchg
+X86_64_TESTS += adox
TESTS=$(MULTIARCH_TESTS) $(X86_64_TESTS) test-x86_64
else
TESTS=$(MULTIARCH_TESTS)
endif
+adox: CFLAGS=-O2
+
run-test-i386-ssse3: QEMU_OPTS += -cpu max
run-plugin-test-i386-ssse3-%: QEMU_OPTS += -cpu max
diff --git a/tests/tcg/x86_64/adox.c b/tests/tcg/x86_64/adox.c
new file mode 100644
index 0000000..36be644
--- /dev/null
+++ b/tests/tcg/x86_64/adox.c
@@ -0,0 +1,69 @@
+/* See if ADOX give expected results */
+
+#include <assert.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+static uint64_t adoxq(bool *c_out, uint64_t a, uint64_t b, bool c)
+{
+ asm ("addl $0x7fffffff, %k1\n\t"
+ "adoxq %2, %0\n\t"
+ "seto %b1"
+ : "+r"(a), "=&r"(c) : "r"(b), "1"((int)c));
+ *c_out = c;
+ return a;
+}
+
+static uint64_t adoxl(bool *c_out, uint64_t a, uint64_t b, bool c)
+{
+ asm ("addl $0x7fffffff, %k1\n\t"
+ "adoxl %k2, %k0\n\t"
+ "seto %b1"
+ : "+r"(a), "=&r"(c) : "r"(b), "1"((int)c));
+ *c_out = c;
+ return a;
+}
+
+int main()
+{
+ uint64_t r;
+ bool c;
+
+ r = adoxq(&c, 0, 0, 0);
+ assert(r == 0);
+ assert(c == 0);
+
+ r = adoxl(&c, 0, 0, 0);
+ assert(r == 0);
+ assert(c == 0);
+
+ r = adoxl(&c, 0x100000000, 0, 0);
+ assert(r == 0);
+ assert(c == 0);
+
+ r = adoxq(&c, 0, 0, 1);
+ assert(r == 1);
+ assert(c == 0);
+
+ r = adoxl(&c, 0, 0, 1);
+ assert(r == 1);
+ assert(c == 0);
+
+ r = adoxq(&c, -1, -1, 0);
+ assert(r == -2);
+ assert(c == 1);
+
+ r = adoxl(&c, -1, -1, 0);
+ assert(r == 0xfffffffe);
+ assert(c == 1);
+
+ r = adoxq(&c, -1, -1, 1);
+ assert(r == -1);
+ assert(c == 1);
+
+ r = adoxl(&c, -1, -1, 1);
+ assert(r == 0xffffffff);
+ assert(c == 1);
+
+ return 0;
+}
diff --git a/util/cacheflush.c b/util/cacheflush.c
index 2c2c73e..06c2333 100644
--- a/util/cacheflush.c
+++ b/util/cacheflush.c
@@ -121,8 +121,12 @@
static bool have_coherent_icache;
#endif
-#if defined(__aarch64__) && !defined(CONFIG_DARWIN)
-/* Apple does not expose CTR_EL0, so we must use system interfaces. */
+#if defined(__aarch64__) && !defined(CONFIG_DARWIN) && !defined(CONFIG_WIN32)
+/*
+ * Apple does not expose CTR_EL0, so we must use system interfaces.
+ * Windows neither, but we use a generic implementation of flush_idcache_range
+ * in this case.
+ */
static uint64_t save_ctr_el0;
static void arch_cache_info(int *isize, int *dsize)
{
@@ -225,7 +229,11 @@
/* Caches are coherent and do not require flushing; symbol inline. */
-#elif defined(__aarch64__)
+#elif defined(__aarch64__) && !defined(CONFIG_WIN32)
+/*
+ * For Windows, we use generic implementation of flush_idcache_range, that
+ * performs a call to FlushInstructionCache, through __builtin___clear_cache.
+ */
#ifdef CONFIG_DARWIN
/* Apple does not expose CTR_EL0, so we must use system interfaces. */
diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c
index 2dd1069..93d2505 100644
--- a/util/qemu-thread-posix.c
+++ b/util/qemu-thread-posix.c
@@ -18,6 +18,10 @@
#include "qemu/tsan.h"
#include "qemu/bitmap.h"
+#ifdef CONFIG_PTHREAD_SET_NAME_NP
+#include <pthread_np.h>
+#endif
+
static bool name_threads;
void qemu_thread_naming(bool enable)
@@ -25,7 +29,8 @@
name_threads = enable;
#if !defined CONFIG_PTHREAD_SETNAME_NP_W_TID && \
- !defined CONFIG_PTHREAD_SETNAME_NP_WO_TID
+ !defined CONFIG_PTHREAD_SETNAME_NP_WO_TID && \
+ !defined CONFIG_PTHREAD_SET_NAME_NP
/* This is a debugging option, not fatal */
if (enable) {
fprintf(stderr, "qemu: thread naming not supported on this host\n");
@@ -480,6 +485,8 @@
pthread_setname_np(pthread_self(), qemu_thread_args->name);
# elif defined(CONFIG_PTHREAD_SETNAME_NP_WO_TID)
pthread_setname_np(qemu_thread_args->name);
+# elif defined(CONFIG_PTHREAD_SET_NAME_NP)
+ pthread_set_name_np(pthread_self(), qemu_thread_args->name);
# endif
}
QEMU_TSAN_ANNOTATE_THREAD_NAME(qemu_thread_args->name);