aboutsummaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2021-08-11fuzz: avoid building twice, when running on gitlabAlexander Bulekov
On oss-fuzz, we build twice, to put together a build that is portable to the runner containers. On gitlab ci, this is wasteful and contributes to timeouts on the build-oss-fuzz job. Avoid building twice on gitlab, at the remote cost of potentially missing some cases that break oss-fuzz builds. Signed-off-by: Alexander Bulekov <alxndr@bu.edu> Reviewed-by: Darren Kenny <darren.kenny@oracle.com> Message-Id: <20210809111621.54454-1-alxndr@bu.edu> Signed-off-by: Thomas Huth <thuth@redhat.com>
2021-07-30coverity-model: write models fully for non-array allocation functionsPaolo Bonzini
Coverity seems to have issues figuring out the properties of g_malloc0 and other non *_n functions. While this was "fixed" by removing the custom second argument to __coverity_mark_as_afm_allocated__, inline the code from the array-based allocation functions to avoid future issues. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-30coverity-model: constrain g_malloc/g_malloc0/g_realloc as never returning NULLPaolo Bonzini
g_malloc/g_malloc0/g_realloc only return NULL if the size is 0; we do not need to cover that in the model, and so far have expected __coverity_alloc__ to model a non-NULL return value. But that apparently does not work anymore, so add some extra conditionals that invoke __coverity_panic__ for NULL pointers. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-30coverity-model: clean up the models for array allocation functionsPaolo Bonzini
sz is only used in one place, so replace it with nmemb * size in that one place. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-30coverity-model: remove model for more allocation functionsPaolo Bonzini
These models are not needed anymore now that Coverity does not check anymore that the result is used with "g_free". Coverity understands GCC attributes and uses them to detect leaks. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-30coverity-model: make g_free a synonym of freePaolo Bonzini
Recently, Coverity has started complaining about using g_free() to free memory areas allocated by GLib functions not included in model.c, such as g_strfreev. This unfortunately goes against the GLib documentation, which suggests that g_malloc() should be matched with g_free() and plain malloc() with free(); since GLib 2.46 however g_malloc() is hardcoded to always use the system malloc implementation, and g_free is just "free" plus a tracepoint. Therefore, this should not cause any problem in practice. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-30coverity-model: update address_space_read/write modelsPaolo Bonzini
Use void * for consistency with the actual function; provide a model for MemoryRegionCache functions and for address_space_rw. These let Coverity understand the bounds of the data that various functions read and write even at very high levels of inlining (e.g. pci_dma_read). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-16Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-07-15' into ↵Peter Maydell
staging QAPI patches patches for 2021-07-15 # gpg: Signature made Thu 15 Jul 2021 13:30:14 BST # 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 * remotes/armbru/tags/pull-qapi-2021-07-15: qapi: Fix crash on missing enum member name Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-07-15qapi: Fix crash on missing enum member nameMarkus Armbruster
New test case enum-dict-no-name.json crashes: $ python3 scripts/qapi-gen.py tests/qapi-schema/enum-dict-no-name.json Traceback (most recent call last): [...] File "/work/armbru/qemu/scripts/qapi/expr.py", line 458, in check_enum member_name = member['name'] KeyError: 'name' Root cause: we try to retrieve member 'name' before we check for missing members. With that fixed, we get the expected error "'data' member misses key 'name'". Fixes: 0825f62c842f2c07c5471391c6d7fd3f4fe83732 Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210616072121.626431-1-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
2021-07-14hw/usb/ccid: remove references to NSSDaniel P. Berrangé
The NSS package was previously pre-requisite for building CCID related features, however, this became obsolete when the libcacard library was spun off to a separate project: commit 7b02f5447c64d1854468f758398c9f6fe9e5721f Author: Marc-André Lureau <marcandre.lureau@redhat.com> Date: Sun Aug 30 11:48:40 2015 +0200 libcacard: use the standalone project Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210623142245.307776-2-berrange@redhat.com> Message-Id: <20210709143005.1554-10-alex.bennee@linaro.org>
2021-07-14Jobs based on custom runners: docs and gitlab-runner setup playbookCleber Rosa
To have the jobs dispatched to custom runners, gitlab-runner must be installed, active as a service and properly configured. The variables file and playbook introduced here should help with those steps. The playbook introduced here covers the Linux distributions and has been primarily tested on OS/machines that the QEMU project has available to act as runners, namely: * Ubuntu 20.04 on aarch64 * Ubuntu 18.04 on s390x But, it should work on all other Linux distributions. Earlier versions were tested on FreeBSD too, so chances of success are high. Signed-off-by: Cleber Rosa <crosa@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Willian Rampazzo <willianr@redhat.com> Tested-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210630012619.115262-4-crosa@redhat.com> Message-Id: <20210709143005.1554-4-alex.bennee@linaro.org>
2021-07-14Jobs based on custom runners: build environment docs and playbookCleber Rosa
To run basic jobs on custom runners, the environment needs to be properly set up. The most common requirement is having the right packages installed. The playbook introduced here covers the QEMU's project s390x and aarch64 machines. At the time this is being proposed, those machines have already had this playbook applied to them. Signed-off-by: Cleber Rosa <crosa@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Willian Rampazzo <willianr@redhat.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20210630012619.115262-3-crosa@redhat.com> Message-Id: <20210709143005.1554-3-alex.bennee@linaro.org>
2021-07-13Merge remote-tracking branch ↵Peter Maydell
'remotes/vivier2/tags/linux-user-for-6.1-pull-request' into staging Linux-user pull request 20210713 Update headers to linux v5.13 cleanup errno target headers Fix race condition on fd translation table # gpg: Signature made Tue 13 Jul 2021 14:41:25 BST # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-6.1-pull-request: linux-user: update syscall.tbl to Linux v5.13 linux-user, mips: update syscall-args-o32.c.inc to Linux v5.13 linux-user: update syscall_nr.h to Linux v5.13 fd-trans: Fix race condition on reallocation of the translation table. linux-user/syscall: Remove ERRNO_TABLE_SIZE check linux-user: Simplify host <-> target errno conversion using macros linux-user/mips: Move errno definitions to 'target_errno_defs.h' linux-user/hppa: Move errno definitions to 'target_errno_defs.h' linux-user/alpha: Move errno definitions to 'target_errno_defs.h' linux-user: Extract target errno to 'target_errno_defs.h' linux-user/sparc: Rename target_errno.h -> target_errno_defs.h linux-user/syscall: Fix RF-kill errno (typo in ERFKILL) Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-07-13linux-user, mips: update syscall-args-o32.c.inc to Linux v5.13Laurent Vivier
Updated running scripts/update-mips-syscall-args.sh scripts/update-mips-syscall-args.sh has been updated to reflect file directory changes in strace repository. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20210708215756.268805-3-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-07-12qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful.Gerd Hoffmann
Setting SYSTEMTAP_TAPSET to some value other than /usr/share/systemtap/tapsets results in systemtap not finding the standard tapset library any more, which in turn breaks tracing because pid() and other standard systemtap functions are not available any more. So using SYSTEMTAP_TAPSET to point systemtap to the qemu probes will only work for the prefix=/usr installs because both qemu and system tapsets in the same directory then. All other prefixes are broken. Fix that by using the "-I $tapsetdir" command line switch instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20210601132414.432430-2-kraxel@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2021-07-09meson: Use input/output for entitlements targetAkihiko Odaki
input/output parameters respect dependencies. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210709012533.58262-1-akihiko.odaki@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-09modules: check if all dependencies can be satisfiedJose R. Ziviani
Verifies if all dependencies are correctly listed in the modinfo.c too and stop the builds if they're not. Signed-off-by: Jose R. Ziviani <jziviani@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jose R. Ziviani <jziviani@suse.de> Message-Id: <20210624103836.2382472-5-kraxel@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-09modules: generate modinfo.cGerd Hoffmann
Add script to generate C source with a small database containing the module meta-data. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jose R. Ziviani <jziviani@suse.de> Message-Id: <20210624103836.2382472-4-kraxel@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-09modules: collect module meta-dataGerd Hoffmann
Add script to collect the module meta-data from the source code, store the results in *.modinfo files. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jose R. Ziviani <jziviani@suse.de> Message-Id: <20210624103836.2382472-3-kraxel@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-06Set icon for QEMU binary on Mac OSJohn Arbuckle
Before switching the build system over to Meson, an icon was added to the QEMU binary on Mac OS. This patch adds back that feature; it piggybacks on the existing scripts/entitlement.sh, which already does in-place changes to the executable on Darwin. Signed-off-by: John Arbuckle <programmingkidx@gmail.com> Message-Id: <20210705195328.36442-1-programmingkidx@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-06coverity-scan: switch to vpath buildPaolo Bonzini
This is the patch that has been running on the coverity cronjob for a few weeks now. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-06coverity-scan: Remove lm32 / unicore32 targetsPhilippe Mathieu-Daudé
lm32 has been removed in commit 9d49bcf6992 ("Drop the deprecated lm32 target"), and unicore32 in 4369223902a ("Drop the deprecated unicore32 target"). Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20210619091342.3660495-2-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-06-25scripts/checkpatch: roll diff tweaking into checkpatch itselfAlex Bennée
Rather than relying on external tweaks lets just do it inside checkpatch's direct commitish handling which is QEMU specific code anyway. Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20210623102749.25686-4-alex.bennee@linaro.org>
2021-06-21Merge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' ↵Peter Maydell
into staging Python Pull request Moves QMP-related tools not used for build or automatic testing from scripts/ to python/qemu/qmp/ where they will be protected from bitrot by the check-python-* CI jobs. stub forwarders are left in the old locations for now. # gpg: Signature made Sat 19 Jun 2021 00:02:40 BST # gpg: using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E # gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full] # Primary key fingerprint: FAEB 9711 A12C F475 812F 18F2 88A9 064D 1835 61EB # Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76 CBD0 7DEF 8106 AAFC 390E * remotes/jsnow-gitlab/tags/python-pull-request: (72 commits) scripts/qmp-shell: add redirection shim python: add qmp-shell entry point scripts/qmp-shell: move to python/qemu/qmp/qmp_shell.py scripts/qmp-shell: add docstrings scripts/qmp-shell: make QMPShellError inherit QMPError scripts/qmp-shell: remove double-underscores scripts/qmp-shell: convert usage comment to docstring scripts/qmp-shell: Remove too-broad-exception scripts/qmp-shell: Fix empty-transaction invocation scripts/qmp-shell: remove TODO scripts/qmp-shell: use logging to show warnings scripts/qmp-shell: Use context manager instead of atexit python/qmp: return generic type from context manager scripts/qmp-shell: unprivatize 'pretty' property scripts/qmp-shell: Accept SocketAddrT instead of string scripts/qmp-shell: add mypy types python/qmp: add QMPObject type alias scripts/qmp-shell: initialize completer early scripts/qmp-shell: refactor QMPCompleter scripts/qmp-shell: Fix "FuzzyJSON" parser ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-06-21Merge remote-tracking branch ↵Peter Maydell
'remotes/ehabkost-gl/tags/x86-next-pull-request' into staging x86 queue, 2021-06-18 Features: * Add ratelimit for bus locks acquired in guest (Chenyi Qiang) Documentation: * SEV documentation updates (Tom Lendacky) * Add a table showing x86-64 ABI compatibility levels (Daniel P. Berrangé) Automated changes: * Update Linux headers to 5.13-rc4 (Eduardo Habkost) # gpg: Signature made Fri 18 Jun 2021 20:51:26 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost-gl/tags/x86-next-pull-request: scripts: helper to generate x86_64 CPU ABI compat info docs: add a table showing x86-64 ABI compatibility levels docs/interop/firmware.json: Add SEV-ES support docs: Add SEV-ES documentation to amd-memory-encryption.txt doc: Fix some mistakes in the SEV documentation i386: Add ratelimit for bus locks acquired in guest Update Linux headers to 5.13-rc4 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-06-18scripts/qmp-shell: add redirection shimJohn Snow
qmp-shell has a new home, add a redirect for a little while as the dust settles. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-43-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: move to python/qemu/qmp/qmp_shell.pyJohn Snow
The script will be unavailable for a commit or two, which will help preserve development history attached to the new file. A forwarder will be added shortly afterwards. With qmp_shell in the python qemu.qmp package, now it is fully type checked, linted, etc. via the Python CI. It will be quite a bit harder to accidentally break it again in the future. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-41-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: add docstringsJohn Snow
Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-40-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: make QMPShellError inherit QMPErrorJohn Snow
In preparation for moving qmp-shell into the qemu.qmp package, make QMPShellError inherit from QMPError so that all custom errors in this package all derive from QMPError. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-39-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: remove double-underscoresJohn Snow
They're not needed; single underscore is enough to express intent that these methods are "internal". double underscore is used as a weak name mangling, but that isn't beneficial for us here. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-38-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: convert usage comment to docstringJohn Snow
The nice usage comment should be a docstring instead of a comment, so that it's visible from other python tooling. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-37-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: Remove too-broad-exceptionJohn Snow
We are only anticipating QMPShellErrors here, for syntax we weren't able to understand. Other errors, if any, should be allowed to percolate upwards. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-36-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: Fix empty-transaction invocationJohn Snow
calling "transaction( )" is pointless, but valid. Rework the parser to allow this kind of invocation. This helps clean up exception handling later by removing accidental breakages of the parser that aren't explicitly forbidden. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-35-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: remove TODOJohn Snow
We still want to revamp qmp-shell again, but there's much more to the idea than the comment now intuits. Remove it. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-34-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: use logging to show warningsJohn Snow
A perfect candidate is non-fatal shell history messages. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-33-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: Use context manager instead of atexitJohn Snow
We can invoke the shell history writing when we leave the QMPShell scope instead of relying on atexit. Doing so may be preferable to avoid global state being registered from within a class instead of from the application logic directly. Use QMP's context manager to hook this history saving at close time, which gets invoked when we leave the context block. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-32-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: unprivatize 'pretty' propertyJohn Snow
Similar to verbose, there's no reason this needs to be hidden. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-30-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: Accept SocketAddrT instead of stringJohn Snow
Don't "extend" QEMUMonitorProtocol by changing the argument types. Move the string parsing just outside of the class instead. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-29-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: add mypy typesJohn Snow
As per my usual, this patch is annotations only. Any changes with side effects are done elsewhere. Note: pylint does not understand the subscripts for Collection in Python 3.6, so use the stronger Sequence type as a workaround. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-28-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: initialize completer earlyJohn Snow
Add an empty completer as a more type-safe placeholder instead of 'None'. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-26-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: refactor QMPCompleterJohn Snow
list is a generic type, but we expect to use strings directly. We could subclass list[str], but pylint does not presently understand that invocation. Change this class to envelop a list instead of *being* a list, for simpler mypy typing. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-25-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: Fix "FuzzyJSON" parserJohn Snow
I'm not sure when this regressed (Or maybe if it was ever working right to begin with?), but the Python AST requires you to change "Names" to "Constants" in order to truly convert `false` to `False`. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-24-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: move the REPL functionality into QMPShellJohn Snow
Instead of doing this in main, move it into the class itself. (This makes it easier to put into the qemu.qmp package later by removing as much as we can from the main() function.) Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-23-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: remove prompt argument from read_exec_commandJohn Snow
It's only ever used by one caller, we can just absorb that logic. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-22-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: move get_prompt() to prompt propertyJohn Snow
Small tidying; treat "prompt" like an immutable property instead of function/method/routine. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-21-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: Make verbose a public attributeJohn Snow
No real reason to hide this behind an underscore; make it part of the initializer and make it a regular RW attribute. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-20-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: Add pretty attribute to HMP shellJohn Snow
It's less useful, but it makes the initialization methods LSP consistent, which quiets a mypy complaint. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-19-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: use argparseJohn Snow
Use argparse instead of an open-coded CLI parser, for consistency with everything else. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-18-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: use isinstance() instead of type()John Snow
A bit more idiomatic, and quiets some linter warnings. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-17-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-18scripts/qmp-shell: remove if-raise-else patternsJohn Snow
Shushes pylint. I don't always mind these patterns personally, but I'm not as sure that I want to remove the warning from pylint's repertoire entirely. Oh well. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-16-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>