aboutsummaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)AuthorFilesLines
2018-07-06Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell1-5/+4
Bug fixes. # gpg: Signature made Fri 06 Jul 2018 17:40:06 BST # gpg: using RSA key BFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: checkpatch: handle token pasting better ioapic: remove useless lower bounds check pr-manager-helper: fix memory leak on event qemu-char: check errno together with ret < 0 i386: fix '-cpu ?' output for host cpu type qtest: Use cpu address space instead of system memory pr-helper: Rework socket path handling pr-helper: avoid error on PR IN command with zero request size Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-06checkpatch: handle token pasting betterPaolo Bonzini1-5/+4
The mechanism to find possible type tokens can sometimes be confused and go into an infinite loop. This happens for example in QEMU for a line that looks like uint## BITS ##_t S = _S, T = _T; \ uint## BITS ##_t as, at, xs, xt, xd; \ Because the token pasting operator does not have a space before _t, it does not match $notPermitted. However, (?x) is turned on in the regular expression for modifiers, and thus ##_t matches the empty string. As a result, annotate_values goes in an infinite loop. The solution is simply to remove token pasting operators from the string before looking for modifiers. In the example above, the string uintBITS_t will be evaluated as a candidate modifier. This is not optimal, but it works as long as people do not write things like a##s##m, and it fits nicely into sub possible. For a similar reason, \# should be rejected always, even if it is not at end of line or followed by whitespace. The same patch was sent to the Linux kernel mailing list. Reported-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-07-05Merge remote-tracking branch ↵Peter Maydell2-1/+28
'remotes/stsquad/tags/pull-code-coverage-and-build-tweaks-050718-3' into staging Code coverage and other build tweaks - revert 208ecb3e (and drop filter for mingw, tweak for check-tcg) - some travis speed-ups - modernise code coverage support - docker image cleanups - clean-up binfmt_misc docker infrastructure - add debian-powerpc-user-cross image for ppc32 build # gpg: Signature made Thu 05 Jul 2018 17:00:02 BST # gpg: using RSA key FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-code-coverage-and-build-tweaks-050718-3: docker: add linux-user powered cross builder for QEMU docker: add special rule for deboostrapped images docker: add special handling for FROM:debian-%-user targets docker: debian-bootstrap.pre allow customising of variant/url docker: drop QEMU build-dep from bootstrap docker: Do not run tests in 'intermediate' images docker: Clean the MXE base image docker: ubuntu: Use SDL2 docker: ubuntu: Update the package list before installing new ones linux-user: add gcov support to preexit_cleanup linux-user: introduce preexit_cleanup build-system: add coverage-report target build-system: add clean-coverage target travis: add gcovr summary for GCOV build docker: add gcovr to travis image .gitignore: add .gcov files build-system: remove per-test GCOV reporting travis: test out-of-tree builds travis: do not waste time cloning unused submodules Revert "Makefile: Rename TARGET_DIRS to TARGET_LIST" Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-05travis: add gcovr summary for GCOV buildAlex Bennée1-0/+27
This gives a more useful summary, sorted by descending % coverage, after the tests have run. The final numbers will give an idea if our coverage is getting better or worse. To keep the width sane we need to post process the file that the old gcovr tool generates. This is done with a mix of sed, awk and column in the scripts/coverage-summary.sh script. As quite a lot of lines don't get covered at all we filter out all the 0% lines. If the file doesn't appear it is not being exercised. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-05Revert "Makefile: Rename TARGET_DIRS to TARGET_LIST"Alex Bennée1-1/+1
This reverts commit 208ecb3e1acc8d55dab49fdf721a86d513691688. This was causing problems by making DEF_TARGET_LIST pointless and having to jump through hoops to build on mingw with a dully enabled config. This includes a change to fix the per-guest TCG test probe which was added after 208ecb3 and used TARGET_LIST. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Cc: Paolo Bonzini <pbonzini@redhat.com>
2018-07-05coverity-model: Fix replay_get_byte()Markus Armbruster1-6/+2
Coverity 2018.06 chokes on replay_get_byte(): $ cov-make-library -of scripts/coverity-model.xmldb scripts/coverity-model.c output file: scripts/coverity-model.xmldb Compiling scripts/coverity-model.c with command /opt/cov-sa-2018.06/bin/cov-emit --dir /tmp/cov-armbru/930a6fb31e5f464fc1a53354b2deb66b/cov-make-library-emit -w --no_error_recovery --emit_header_functions --no_implicit_decl --preinclude /opt/cov-sa-2018.06/library/decls.h --c scripts/coverity-model.c "scripts/coverity-model.c", line 110: error #20: identifier "replay_file" is undefined if (replay_file) { ^ Emit for file '/work/armbru/qemu/scripts/coverity-model.c' complete. [ERROR] 1 error detected in the compilation of "scripts/coverity-model.c". ERROR: cov-emit returned with code 1 Broken in commit 04a0afe5285. Fix by dumbing down. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180626085642.4973-1-armbru@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2018-07-05Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2018-07-03' into ↵Peter Maydell7-145/+347
staging QAPI patches for 2018-07-03 # gpg: Signature made Tue 03 Jul 2018 21:52:55 BST # gpg: using RSA key 3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2018-07-03: qapi: add conditions to SPICE type/commands/events on the schema qapi: add conditions to VNC type/commands/events on the schema qapi: add 'If:' section to generated documentation qapi-types: add #if conditions to types & visitors qapi/events: add #if conditions to events qapi/commands: add #if conditions to commands qapi-introspect: add preprocessor conditions to generated QLit qapi-introspect: modify to_qlit() to append ',' on level > 0 qapi: add #if/#endif helpers qapi: mcgen() shouldn't indent # lines qapi: add 'ifcond' to visitor methods qapi: leave the ifcond attribute undefined until check() qapi: pass 'if' condition into QAPISchemaEntity objects qapi: add 'if' to top-level expressions Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-04Merge remote-tracking branch ↵Peter Maydell1-23/+41
'remotes/vivier2/tags/linux-user-for-3.0-pull-request' into staging Some strace cleanups Minor fixes for setsockopt() and netlink Manage 'F' flag with qemu-binfmt-conf.sh # gpg: Signature made Tue 03 Jul 2018 17:34:20 BST # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" # gpg: aka "Laurent Vivier <laurent@vivier.eu>" # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-3.0-pull-request: linux-user/strace: Improve recvmsg() output linux-user/strace: Improve capget()/capset() output linux-user: update do_setsockopt() linux-user: add netlink CARRIER_UP_COUNT/CARRIER_DOWN_COUNT qemu-binfmt-conf.sh: allow to provide a suffix to the interpreter name qemu-binfmt-conf.sh: add persistent (F) flags qemu-binfmt-conf.sh: cleanup --credential Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-03qapi: add 'If:' section to generated documentationMarc-André Lureau1-10/+12
The documentation is generated only once, and doesn't know C pre-conditions. Add 'If:' sections for top-level entities. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-13-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03qapi-types: add #if conditions to types & visitorsMarkus Armbruster2-33/+48
Types & visitors are coupled and must be handled together to avoid temporary build regression. Wrap generated types/visitor code with #if/#endif using the context helpers. Derived from a patch by Marc-André. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-12-marcandre.lureau@redhat.com>
2018-07-03qapi/events: add #if conditions to eventsMarc-André Lureau1-2/+4
Wrap generated code with #if/#endif using an 'ifcontext' on QAPIGenCSnippet objects. This makes a conditional event's qapi_event_send_FOO() compile-time conditional, but its enum QAPIEvent member remains unconditional for now. A follow up patch "qapi-event: add 'if' condition to implicit event enum" will improve this. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-11-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03qapi/commands: add #if conditions to commandsMarc-André Lureau1-8/+16
Wrap generated code with #if/#endif using an 'ifcontext' on QAPIGenCSnippet objects. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180703155648.11933-10-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Line breaks tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03qapi-introspect: add preprocessor conditions to generated QLitMarc-André Lureau1-10/+21
This commit adds 'ifcond' conditions to top-level QLit objects. Future work will add them to object and enum type members, i.e. within QLit objects. Extend the QLit generator to_qlit() to accept (@obj, @cond) tuples in addition to just @obj. The tuple causes the QLit generated for objects for @obj with #if/#endif conditions for @cond. See generated tests/test-qmp-introspect.c. Example diff after this patch: --- before 2018-01-08 11:55:24.757083654 +0100 +++ tests/test-qmp-introspect.c 2018-01-08 13:08:44.477641629 +0100 @@ -51,6 +51,8 @@ { "name", QLIT_QSTR("EVENT_F"), }, {} })), +#if defined(TEST_IF_CMD) +#if defined(TEST_IF_STRUCT) QLIT_QDICT(((QLitDictEntry[]) { { "arg-type", QLIT_QSTR("5"), }, { "meta-type", QLIT_QSTR("command"), }, @@ -58,12 +60,16 @@ { "ret-type", QLIT_QSTR("0"), }, {} })), +#endif /* defined(TEST_IF_STRUCT) */ +#endif /* defined(TEST_IF_CMD) */ Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-9-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03qapi-introspect: modify to_qlit() to append ',' on level > 0Marc-André Lureau1-1/+3
The following patch is going to break list entries with #if/#endif, so they should have the trailing ',' as suffix. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-8-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03qapi: add #if/#endif helpersMarc-André Lureau1-4/+94
Add helpers to wrap generated code with #if/#endif lines. A later patch wants to use QAPIGen for generating C snippets rather than full C files with copyright headers etc. Splice in class QAPIGenCCode between QAPIGen and QAPIGenC. Add a 'with' statement context manager that will be used to wrap generator visitor methods. The manager will check if code was generated before adding #if/#endif lines on QAPIGenCSnippet objects. Used in the following patches. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180703155648.11933-7-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03qapi: mcgen() shouldn't indent # linesMarc-André Lureau1-2/+2
Skip preprocessor lines when adding indentation, since that would likely result in invalid code. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-6-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03qapi: add 'ifcond' to visitor methodsMarc-André Lureau7-35/+38
Modify the test visitor to check correct passing of values. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-5-marcandre.lureau@redhat.com> [Accidental change to roms/seabios dropped] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03qapi: leave the ifcond attribute undefined until check()Marc-André Lureau1-4/+17
We commonly initialize attributes to None in .init(), then set their real value in .check(). Accessing the attribute before .check() yields None. If we're lucky, the code that accesses the attribute prematurely chokes on None. It won't for .ifcond, because None is a legitimate value. Leave the ifcond attribute undefined until check(). Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-4-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03qapi: pass 'if' condition into QAPISchemaEntity objectsMarc-André Lureau1-32/+65
Built-in objects remain unconditional. Explicitly defined objects use the condition specified in the schema. Implicitly defined objects inherit their condition from their users. For most of them, there is exactly one user, so the condition to use is obvious. The exception is wrapped types generated for simple union variants, which can be shared by any number of simple unions. The tight condition would be the disjunction of the conditions of these simple unions. For now, use the wrapped type's condition instead. Much simpler and good enough for now. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-3-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03qapi: add 'if' to top-level expressionsMarc-André Lureau1-6/+29
Accept 'if' key in top-level elements, accepted as string or list of string type. The following patches will modify the test visitor to check the value is correctly saved, and generate #if/#endif code (as a single #if/endif line or a series for a list). Example of 'if' key: { 'struct': 'TestIfStruct', 'data': { 'foo': 'int' }, 'if': 'defined(TEST_IF_STRUCT)' } The generated code is for now *unconditional*. Later patches generate the conditionals. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-2-marcandre.lureau@redhat.com> [Commit message and Documentation improved] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-07-03Merge remote-tracking branch 'remotes/shorne/tags/pull-or-20180703' into stagingPeter Maydell1-3/+7
OpenRISC cleanups and Fixes for QEMU 3.0 Mostly patches from Richard Henderson fixing multiple things: * Fix singlestepping in GDB. * Use more TB linking. * Fixes to exit TB after updating SPRs to enable registering of state changes. * Significant optimizations and refactors to the TLB * Split out disassembly from translation. * Add qemu-or1k to qemu-binfmt-conf.sh. * Implement signal handling for linux-user. Then there are a few fixups from me: * Fix delay slot detections to match hardware, this was masking a bug in the linus kernel. * Fix stores to the PIC mask register # gpg: Signature made Tue 03 Jul 2018 14:44:10 BST # gpg: using RSA key C3B31C2D5E6627E4 # gpg: Good signature from "Stafford Horne <shorne@gmail.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: D9C4 7354 AEF8 6C10 3A25 EFF1 C3B3 1C2D 5E66 27E4 * remotes/shorne/tags/pull-or-20180703: (25 commits) target/openrisc: Fix writes to interrupt mask register target/openrisc: Fix delay slot exception flag to match spec linux-user: Fix struct sigaltstack for openrisc linux-user: Implement signals for openrisc target/openrisc: Add support in scripts/qemu-binfmt-conf.sh target/openrisc: Reorg tlb lookup target/openrisc: Increase the TLB size target/openrisc: Stub out handle_mmu_fault for softmmu target/openrisc: Use identical sizes for ITLB and DTLB target/openrisc: Fix cpu_mmu_index target/openrisc: Fix tlb flushing in mtspr target/openrisc: Reduce tlb to a single dimension target/openrisc: Merge mmu_helper.c into mmu.c target/openrisc: Remove indirect function calls for mmu target/openrisc: Merge tlb allocation into CPUOpenRISCState target/openrisc: Form the spr index from tcg target/openrisc: Exit the TB after l.mtspr target/openrisc: Split out is_user target/openrisc: Link more translation blocks target/openrisc: Fix singlestep_enabled ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-03target/openrisc: Add support in scripts/qemu-binfmt-conf.shRichard Henderson1-3/+7
Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-07-02qemu-binfmt-conf.sh: allow to provide a suffix to the interpreter nameLaurent Vivier1-17/+24
some distros provide a qemu-CPU-static binary beside the qemu-CPU one. This change allows to use it by providing "--qemu-suffix -static" to the script. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180627205317.10343-4-laurent@vivier.eu>
2018-07-02qemu-binfmt-conf.sh: add persistent (F) flagsLaurent Vivier1-1/+13
Since kernel commit 948b701a607f (binfmt_misc: add persistent opened binary handler for containers) kernel allows to load the interpreter at the configuration time. In case of chroot, it allows to have the interpreter in the host root filesystem and not to copy it to the chroot filesystem. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180627205317.10343-3-laurent@vivier.eu>
2018-07-02qemu-binfmt-conf.sh: cleanup --credentialLaurent Vivier1-10/+9
move credential value to its own variable to be able to manage more flags Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20180627205317.10343-2-laurent@vivier.eu>
2018-07-02checkpatch: Recognize IEC binary prefix definitionsPhilippe Mathieu-Daudé1-0/+1
Do not match the IEC binary prefix as camelcase typedefs. This fixes: ERROR: "foo * bar" should be "foo *bar" #310: FILE: hw/ppc/ppc440_uc.c:564: + size = 8 * MiB * sh; total: 1 errors, 0 warnings, 433 lines checked Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180625124238.25339-5-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-06-29trace: Fix format string for the struct timeval members casted to size_tPhilippe Mathieu-Daudé1-1/+1
This fixes when using GCC with -Wformat-signedness: migration/trace.h: In function ‘_nocheck__trace_dirty_bitmap_load_success’: migration/trace.h:6368:24: error: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 3 has type ‘long unsigned int’ [-Werror=format=] qemu_log("%d@%zd.%06zd:dirty_bitmap_load_success " "" "\n", ~~^ %ld migration/trace.h:6370:18: (size_t)_now.tv_sec, (size_t)_now.tv_usec ~~~~~~~~~~~~~~~~~~~ migration/trace.h:6368:30: error: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 4 has type ‘long unsigned int’ [-Werror=format=] qemu_log("%d@%zd.%06zd:dirty_bitmap_load_success " "" "\n", ~~~~^ %06ld migration/trace.h:6370:39: (size_t)_now.tv_sec, (size_t)_now.tv_usec ~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-06-29simpletrace: Convert name from mapping record to strEduardo Habkost1-1/+1
The rest of the code assumes that idtoname is a (int -> str) dictionary, so convert the data accordingly. This is necessary to make the script work with Python 3 (where reads from a binary file return 'bytes' objects, not 'str'). Fixes the following error: $ python3 ./scripts/simpletrace.py trace-events-all trace-27445 b'object_class_dynamic_cast_assert' event is logged but is not \ declared in the trace events file, try using trace-events-all instead. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-id: 20180619194549.15584-1-ehabkost@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-06-27trace: forbid floating point typesStefan Hajnoczi1-2/+0
Only one existing trace event uses a floating point type. Unfortunately float and double cannot be supported since SystemTap does not have floating point types. Remove float and double from the whitelist and document this limitation. Update the migrate_transferred trace event to use uint64_t instead of double. Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-id: 20180621150254.4922-1-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-06-22Partially revert "python: futurize -f libfuturize.fixes.fix_absolute_import"Eduardo Habkost8-16/+8
Since commit 068cf7a44cd4d65c05aa877dbebced295be5ce44, qmp-shell is broken: $ ./scripts/qmp/qmp-shell Traceback (most recent call last): File "./scripts/qmp/qmp-shell", line 70, in <module> from . import qmp ValueError: Attempted relative import in non-package Relative imports don't work on scripts that are executed directly, so revert the change on the scripts inside scripts/qmp. Fixes: 068cf7a44cd4d65c05aa877dbebced295be5ce44 Reported-by: John Snow <jsnow@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180621175451.7948-1-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-22qapi/introspect: Eliminate pointless variable in .visit_end()Markus Armbruster1-4/+1
Commit 1a9a507b2e3 "qapi-introspect: Hide type names" added local variable @jsons to improve sorting, but also removed the sorting. It was part of a big series that went to v8, and it made sense until v2 or so... Commit 7d0f982bfbb replaced @jsons by @qlits, preserving the uselessness. Get rid of it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180620124742.16979-1-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-06-22qapi: Open files with encoding='utf-8'Markus Armbruster1-3/+14
Python 2 happily reads UTF-8 files in text mode, but Python 3 requires either UTF-8 locale or an explicit encoding passed to open(). Commit d4e5ec877ca fixed this by setting the en_US.UTF-8 locale. Falls apart when the locale isn't be available. Matthias Maier and Arfrever Frehtes Taifersar Arahesis proposed to use binary mode instead, with manual conversion from bytes to str. Works, but opening with an explicit encoding is simpler, so do that. Since Python 2's open() doesn't support the encoding parameter, we need to suppress it with a version check. Reported-by: Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com> Reported-by: Matthias Maier <tamiko@43-1.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180618175958.29073-2-armbru@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2018-06-22qapi: allow empty branches in flat unionsAnton Nefedov3-12/+24
It often happens that just a few discriminator values imply extra data in a flat union. Existing checks did not make possible to leave other values uncovered. Such cases had to be worked around by either stating a dummy (empty) type or introducing another (subset) discriminator enumeration. Both options create redundant entities in qapi files for little profit. With this patch it is not necessary anymore to add designated union fields for every possible value of a discriminator enumeration. Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Message-Id: <1529311206-76847-2-git-send-email-anton.nefedov@virtuozzo.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-06-22qapi/events: generate event enum in main moduleMarc-André Lureau1-2/+3
The event generator produces an enum, and put it in the last visited module. It fits better in the main module, since it's the set of all visited events, from all modules. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180321115211.17937-3-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-06-22qapi/visit: remove useless prefix argumentMarc-André Lureau1-1/+1
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180321115211.17937-2-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-06-15scripts/qemu.py: introduce set_console() methodCleber Rosa1-1/+96
The set_console() method is intended to ease higher level use cases that require a console device. The amount of intelligence is limited on purpose, requiring either the device type explicitly, or the existence of a machine (pattern) definition. Because of the console device type selection criteria (by machine type), users should also be able to define that. It'll then be used for both '-machine' and for the console device type selection. Users of the set_console() method will certainly be interested in accessing the console device, and for that a console_socket property has been added. Signed-off-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20180530184156.15634-5-crosa@redhat.com> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-15scripts/qemu.py: allow adding to the list of extra argumentsCleber Rosa1-0/+6
Tests will often need to add extra arguments to QEMU command line arguments. Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20180530184156.15634-3-crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-14Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-06-13' into ↵Peter Maydell1-0/+12
staging Miscellaneous patches for 2018-06-13 # gpg: Signature made Wed 13 Jun 2018 13:51:51 BST # gpg: using RSA key 3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-misc-2018-06-13: Purge uses of banned g_assert_FOO() coverity-model: replay data is considered trusted Revert "Makefile: add target to print generated files" Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-06-13coverity-model: replay data is considered trustedPaolo Bonzini1-0/+12
Replay data is not considered a possible attack vector; add a model that does not use getc so that "tainted data" warnings are suppressed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20180514141218.28438-1-pbonzini@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Whitespace tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-06-12Merge remote-tracking branch ↵Peter Maydell1-9/+9
'remotes/vivier2/tags/linux-user-for-3.0-pull-request' into staging Fixes in syscall numbers, disable the build of binaries not needed for linux-user, update of qemu-binfmt-conf.sh and cleanup around is_error() # gpg: Signature made Tue 12 Jun 2018 11:57:18 BST # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" # gpg: aka "Laurent Vivier <laurent@vivier.eu>" # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-3.0-pull-request: linux-user/sparc64: Add inotify_rm_watch and tee syscalls linux-user/microblaze: Fix typo in accept4 syscall linux-user/hppa: Fix typo in mknodat syscall linux-user/alpha: Fix epoll syscalls qemu-binfmt-conf.sh: ignore the OS/ABI field linux-user: disable qemu-bridge-helper and socket_scm_helper build linux-user: Use is_error() to avoid warnings and make the code clearer linux-user: Export use is_error(), use it to avoid warnings Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-06-11qemu-binfmt-conf.sh: ignore the OS/ABI fieldLaurent Vivier1-9/+9
Most of the binaries have a value of "UNIX - System V" for the OS/ABI. But cc1 has a value of "UNIX - GNU", and if we don't update the binfmt mask to ignore the OS/ABI field, gcc fails to execute it: gcc: error trying to exec '/usr/lib/gcc/m68k-linux-gnu/7/cc1': execv: Exec format error Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20180605194725.8585-1-laurent@vivier.eu>
2018-06-08python: Remove scripts/ordereddict.pyEduardo Habkost2-132/+1
Python 2.7 (the minimum Python version we require) provides collections.OrderedDict on the standard library, so we don't need to carry our own implementation. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608175252.25110-3-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-08python: Remove scripts/argparse.pyEduardo Habkost1-2406/+0
Python 2.7 (the minimum Python version we require) already provides the argparse module on the standard library. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608175252.25110-2-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-08python: futurize -f lib2to3.fixes.fix_numliteralsEduardo Habkost1-3/+3
Convert octal literals into the new syntax. This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f lib2to3.fixes.fix_numliterals $py Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608122952.2009-11-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-08python: futurize -f lib2to3.fixes.fix_exceptEduardo Habkost1-1/+1
Convert "except X, T" to "except X as T". This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f lib2to3.fixes.fix_except $py Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608122952.2009-10-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-08python: futurize -f lib2to3.fixes.fix_tuple_paramsEduardo Habkost1-1/+1
Remove implicit tuple parameter unpacking. This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f lib2to3.fixes.fix_tuple_params $py Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608122952.2009-8-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-08python: futurize -f lib2to3.fixes.fix_standarderrorEduardo Habkost1-3/+3
Rename StandardError to Exception. This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f lib2to3.fixes.fix_standarderror $py Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608122952.2009-6-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-08python: futurize -f lib2to3.fixes.fix_has_keyEduardo Habkost7-8/+8
Change "dict.has_key(key)" to "key in dict" This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f lib2to3.fixes.fix_has_key $py Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608122952.2009-5-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-08python: futurize -f libfuturize.fixes.fix_next_callEduardo Habkost2-4/+4
Change obj.next() calls to next(obj). This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f libfuturize.fixes.fix_next_call $py Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608122952.2009-4-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-06-08python: futurize -f libfuturize.fixes.fix_absolute_importEduardo Habkost8-8/+16
Make implicit relative imports explicit and add "from __future__ import absolute_import" at the top of each relevant module. This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f libfuturize.fixes.fix_absolute_import $py Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608122952.2009-3-ehabkost@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>