summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2013-07-29qapi.py: Permit comments starting anywhere on the lineMarkus Armbruster3-2/+4
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1374939721-7876-10-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29qapi.py: Fix diagnosing non-objects at a schema's top-levelMarkus Armbruster2-2/+2
Report syntax error instead of crashing. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1374939721-7876-8-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29qapi.py: Fix schema parser to check syntax systematicallyMarkus Armbruster17-22/+12
Fixes at least the following parser bugs: * accepts any token in place of a colon * treats comma as optional * crashes when closing braces or brackets are missing Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1374939721-7876-7-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29qapi.py: Reject invalid characters in schema fileMarkus Armbruster6-8/+4
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1374939721-7876-6-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29qapi.py: Decent syntax error reportingMarkus Armbruster2-1/+3
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1374939721-7876-5-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29qapi.py: Restructure lexer and parserMarkus Armbruster5-7/+5
The parser has a rather unorthodox structure: Until EOF: Read a section: Generator function get_expr() yields one section after the other, as a string. An unindented, non-empty line that isn't a comment starts a new section. Lexing: Split section into a list of tokens (strings), with help of generator function tokenize(). Parsing: Parse the first expression from the list of tokens, with parse(), throw away any remaining tokens. In parse_schema(): record value of an enum, union or struct key (if any) in the appropriate global table, append expression to the list of expressions. Return list of expressions. Known issues: (1) Indentation is significant, unlike in real JSON. (2) Neither lexer nor parser have any idea of source positions. Error reporting is hard, let's go shopping. (3) The one error we bother to detect, we "report" via raise. (4) The lexer silently ignores invalid characters. (5) If everything in a section gets ignored, the parser crashes. (6) The lexer treats a string containing a structural character exactly like the structural character. (7) Tokens trailing the first expression in a section are silently ignored. (8) The parser accepts any token in place of a colon. (9) The parser treats comma as optional. (10) parse() crashes on unexpected EOF. (11) parse_schema() crashes when a section's expression isn't a JSON object. Replace this piece of original art by a thoroughly unoriginal design. Takes care of (1), (2), (5), (6) and (7), and lays the groundwork for addressing the others. Generated source files remain unchanged. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1374939721-7876-4-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29tests: Use qapi-schema-test.json as schema parser testMarkus Armbruster5-4/+77
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1374939721-7876-3-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29tests: QAPI schema parser testsMarkus Armbruster58-2/+120
The parser handles erroneous input badly. To be improved shortly. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1374939721-7876-2-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29Merge branch 'trivial-patches' of git://git.corpit.ru/qemuAurelien Jarno3-7/+7
* 'trivial-patches' of git://git.corpit.ru/qemu: target-mips: Remove assignment to a variable which is never used misc: Use g_assert_not_reached for code which is expected to be unreachable qemu-options: mention C-a h in the -nographic doc misc: Fix new typos in comments and strings linux-user: correct argument number for sys_mremap and sys_splice PPC: dbdma: macio: Fix format specifiers (build regression) watchdog: Remove break after exit exec: Remove env from list of poisoned names hw/9pfs: Fix potential memory leak and avoid reuse of freed memory timer: make timers_state static aes: Remove unused code (NDEBUG, u16)
2013-07-29target-mips: fix mipsdsp_mul_q31_q31Petar Jovanovic2-10/+58
Multiplication of two fractional word elements is not correct when sign extension/promotion is needed. This change fixes it by adding correct casts from unsigned to signed values. In addition, the tests (dpaq_sa_l_w.c and dpsq_sa_l_w.c) have been extended to trigger the current issue. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-07-29target-mips: fix mipsdsp_trunc16_sat16_roundPetar Jovanovic1-4/+20
This change corrects rounding and saturation of Q31 fractional value in mipsdsp_trunc16_sat16_round(). Overflow detection was incorrect for the corner case for PRECRQ_RS.PH, and this test case is also part of the change. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-07-28target-mips: fix multiplication in mipsdsp_rndq15_mul_q15_q15Petar Jovanovic1-1/+18
Multiplication of Q15 fractional halfword vectors was incorrect in the previous implementation of mipsdsp_rndq15_mul_q15_q15. It failed to take element signs into account. This change fixes it, and it adds a test case for it. The change also removes unnecessary cast in the function mipsdsp_mul_q15_q15_overflowflag21(). Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-07-27misc: Use g_assert_not_reached for code which is expected to be unreachableStefan Weil3-7/+7
The macro g_assert_not_reached is a better self documenting replacement for assert(0) or assert(false). Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-07-26Add tests for sync modes 'TOP' and 'NONE'Ian Main6-2/+113
This patch adds tests for sync modes top and none. Test for 'TOP' is separated out as it requires a backing file. Also added a test for invalid format. Signed-off-by: Ian Main <imain@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-07-26blockdev: Rename 'readonly' option to 'read-only'Kevin Wolf1-1/+1
Option name cleanup before it becomes a QMP API. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-07-26qcow2: Use dashes instead of underscores in optionsKevin Wolf2-22/+22
This is what QMP wants to use. The options haven't been enabled in any release yet, so we're still free to change them. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-07-25pc-testdev: add I/O port to test memory.c auto split/combinePaolo Bonzini1-0/+102
The ports at 0xe8..0xeb have impl.min/max_access_size == 1, so that memory accesses are split and combined by the memory core. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1374501278-31549-29-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-25qtest: add test for ISA I/O space endiannessPaolo Bonzini2-2/+226
This writes a register and reads its 1/2/4 byte parts. Masking is done in the device model. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1374501278-31549-25-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-22tests: Add test-bitops.c with some sextract testsPeter Maydell2-0/+77
Add some simple test cases for the new sextract32 and sextract64 functions. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Message-id: 1372419632-5521-3-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18boot-order-test: Add tests for Sun4uMarkus Armbruster1-0/+14
Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-13-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18libqos: Generalize I/O-mapped fw_cfgMarkus Armbruster7-63/+35
Provide a constructor that takes the base address in addition to the PC-specific one. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-12-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18boot-order-test: Add tests for Sun4mMarkus Armbruster1-0/+14
Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-11-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18boot-order-test: Add tests for PowerPC PREPMarkus Armbruster1-0/+25
Cc: Andreas Färber <afaerber@suse.de> Cc: Alexander Graf <agraf@suse.de> Cc: qemu-ppc@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-10-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18boot-order-test: Code motion for better readabilityMarkus Armbruster1-22/+22
Cc: Andreas Färber <afaerber@suse.de> Cc: Alexander Graf <agraf@suse.de> Cc: qemu-ppc@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-9-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18boot-order-test: Better separate target-specific and generic partsMarkus Armbruster1-57/+91
The initial version did just PC. I didn't bother to separate out generic parts, because I don't like to abstract from a single case. Now we have two cases, PC and PowerMac, and I'm about to add more. Time to do it right. To ease review, this commit changes the code in-place, and the next commit reorders it for better readability. Cc: Andreas Färber <afaerber@suse.de> Cc: Alexander Graf <agraf@suse.de> Cc: qemu-ppc@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-8-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18boot-order-test: Cover -boot once in ppc testsMarkus Armbruster1-0/+1
Cc: Andreas Färber <afaerber@suse.de> Cc: Alexander Graf <agraf@suse.de> Cc: qemu-ppc@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-7-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18boot-order-test: Add tests for PowerMacsAndreas Färber2-2/+52
They set the boot device via fw_cfg, which is then translated to a boot path of "hd" or "cd" in OpenBIOS. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-6-git-send-email-armbru@redhat.com Cc: Alexander Graf <agraf@suse.de> Cc: qemu-ppc@nongnu.org Converted to libqos/fw_cfg on Anthony's request. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18libqos: Add support for memory-mapped fw_cfgMarkus Armbruster2-0/+32
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-5-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18libqos: include dependenciesAnthony Liguori1-0/+1
Otherwise rebuilds can fail when libqos is modified. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-4-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18boot-order-test: New; covering just PC for nowMarkus Armbruster2-0/+75
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372254743-15808-3-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18libqtest: New qtest_end() to go with qtest_start()Markus Armbruster4-6/+18
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1371711329-9144-3-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-18libqtest: Plug fd and memory leaks in qtest_quit()Markus Armbruster1-0/+4
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Message-id: 1371711329-9144-2-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-15qemu-iotests: Update 051 reference outputKevin Wolf2-33/+76
This has been broken by commit bd5c51ee. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-07-15block: Don't parse protocol from file.filenameKevin Wolf2-0/+26
One of the major reasons for doing something new for -blockdev and blockdev-add was that the old block layer code parses filenames instead of just taking them literally. So we should really leave it untouched when it's passing using the new interfaces (like -drive file.filename=...). This allows opening relative file names that contain a colon. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2013-07-15blockdev: add sync mode to drive-backup QMP commandStefan Hajnoczi1-15/+21
The drive-backup command is similar to the drive-mirror command, except no guest data written after the command executes gets copied. Add a sync mode argument which determines whether the entire disk is copied, just allocated clusters, or only clusters being written to by the guest. Currently only sync mode 'full' is supported - it copies the entire disk. For read-only point-in-time snapshots we may only need sync mode 'none' since the target can be a qcow2 file using the guest's disk as its backing file (no need to copy the entire disk). Finally, sync mode 'top' is useful if we wish to preserve the backing chain. Note that this patch just adds the sync mode argument to drive-backup. It does not implement sync modes 'top' or 'none'. This patch is necessary so we can add a drive-backup HMP command that behaves like the existing drive-mirror HMP command and takes a sync mode. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-07-04add a header file for atomic operationsPaolo Bonzini1-4/+4
We're already using them in several places, but __sync builtins are just too ugly to type, and do not provide seqcst load/store operations. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-07-02int128: optimize and add test casesPaolo Bonzini2-1/+217
For add, the carry only requires checking one of the arguments. For sub and neg, we can similarly optimize computation of the carry. For ge, we can just do lexicographic order. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-06-28qemu-iotests: add 055 drive-backup test caseStefan Hajnoczi3-0/+288
Testing drive-backup is similar to image streaming and drive mirroring. This test case is based on 041. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-06-28qemu-iotests: extract wait_until_completed() into iotests.pyStefan Hajnoczi2-12/+17
The 'drive-mirror' tests often issue 'block-job-complete' and wait for the QMP completion event. Other types of block jobs also want to wait for completion but they may not need to issue 'block-job-complete'. Extract wait_until_completed() from 041 and put it into iotests.py. Return the QMP event object so the caller can make additional assertions, if necessary. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-06-24Revert "block: Disable driver-specific options for 1.5"Kevin Wolf1-1/+1
This reverts commit 8ec7d390b0d50b5e5b4b1d8dba7ba40d64a70875. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-14ide-test: fix failure for test_flushMichael Roth1-1/+4
bd07684aacfb61668ae2c25b7dd00b64f3d7c7f3 added a test to ensure BSY flag is set when a flush request is in flight. It does this by setting a blkdebug breakpoint on flush_to_os before issuing a CMD_FLUSH_CACHE. It then resumes CMD_FLUSH_CACHE operation and checks that BSY is unset. The actual unsetting of BSY does not occur until ide_flush_cb gets called in a bh, however, so in some cases this check will race with the actual completion. Fix this by polling the ide status register until BSY flag gets unset before we do our final sanity checks. According to f68ec8379e88502b4841a110c070e9b118d3151c this is in line with how a guest would determine whether or not the device is still busy. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-06ide-test: Add FLUSH CACHE test caseKevin Wolf1-0/+40
This checks in particular that BSY is set while the flush request is in flight. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06ide-test: Add enum value for DEVKevin Wolf1-1/+2
Get rid of the magic number. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06cutils: Support 'P' and 'E' suffixes in strtosz()Kevin Wolf1-4/+4
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-04qemu-iotests: make create_image() commonStefan Hajnoczi3-40/+27
Both 030 and 041 use create_image(). Move it to iotests.py. Also drop ImageStreamingTestCase since the class now has no methods. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-06-04qemu-iotests: make compare_images() commonStefan Hajnoczi2-31/+15
The iotests.compare_images() function returns True if two image files have the identical data. Previously this was implemented by converting images to raw and then comparing their contents using Python. Since "qemu-img compare" is now available and is more efficient, switch to it. This function will be reused by the 'drive-backup' test case. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-06-04qemu-iotests: make cancel_and_wait() commonStefan Hajnoczi3-53/+38
The cancel_and_wait() function has been duplicated in 030 and 041. Move it into iotests.py and let it return the event so tests can perform additional asserts. Note that 041's cancel_and_wait(wait_ready=True) is replaced by wait_ready_and_cancel(), which uses the new wait_ready() and cancel_and_wait() underneath. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-06-04qemu-iotests: make assert_no_active_block_jobs() commonStefan Hajnoczi3-61/+57
Tests 030 and 041 both use query-block-jobs to check whether any block jobs are active. Make this code common so that 'drive-backup' and other new feature tests will be able to reuse it. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-06-04qemu-iotests: fix 054 cluster size help outputStefan Hajnoczi1-1/+1
Commit f3f4d2c09b9cf46903ba38425ec46c44185162bd added a hint to increase the cluster size when a large image cannot be created. Test 054 now has outdated output and fails because the golden output does not match. This patch updates the 054 golden output. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-30qapi: pad GenericList value fields to 64 bitsMichael Roth1-1/+4
With the introduction of native list types, we now have types such as int64List where the 'value' field is not a pointer, but the actual 64-bit value. On 32-bit architectures, this can lead to situations where 'next' field offset in GenericList does not correspond to the 'next' field in the types that we cast to GenericList when using the visit_next_list() interface, causing issues when we attempt to traverse linked list structures of these types. To fix this, pad the 'value' field of GenericList and other schema-defined/native *List types out to 64-bits. This is less memory-efficient for 32-bit architectures, but allows us to continue to rely on list-handling interfaces that target GenericList to simply visitor implementations. In the future we can improve efficiency by defaulting to using native C array backends to handle list of non-pointer types, which would be more memory efficient in itself and allow us to roll back this change. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>