summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2013-08-06vmdk: check l1 size before opening imageFam Zheng2-0/+14
L1 table size is calculated from capacity, granularity and l2 table size. If capacity is too big or later two are too small, the L1 table will be too big to allocate in memory. Limit it to a reasonable range. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-06vmdk: check l2 table size when openingFam Zheng2-0/+13
header.num_gtes_per_gte determines size for L2 table. Check for too big value before using it. Limit to 512M entries (2GB per one L2 table). Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-06vmdk: check granularity field in openingFam Zheng2-1/+13
Granularity is used to calculate the cluster size and allocate r/w buffer. Check the value from image before using it, so we don't abort() for unbounded memory allocation. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-06qemu-iotests: add empty test case for vmdkFam Zheng3-0/+54
Will add vmdk specific tests later here. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-06qemu-iotests: add poke_file utility functionStefan Hajnoczi1-0/+6
The new poke_file function sets bytes at an offset in a file given a printf-style format string. It can be used to corrupt an image file for test coverage of error paths. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-06qemu-iotests: filter QEMU version in monitor bannerStefan Hajnoczi2-33/+34
Filter out the QEMU monitor version banner so that tests do not break when the QEMU version number is changed. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-05Merge remote-tracking branch 'filippov/tags/20130729-xtensa' into stagingAnthony Liguori2-9/+38
xtensa queue 2013-07-29 * filippov/tags/20130729-xtensa: target-xtensa: check register window inline target-xtensa: don't generate dead code to access invalid SRs tests/tcg/xtensa: Fix out-of-tree build target-xtensa: avoid double-stopping at breakpoints target-xtensa: add fallthrough markers target-xtensa: add extui unit test Conflicts: configure Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-08-02block: Disable driver-specific options for 1.6Kevin Wolf1-1/+1
We don't want to commit to the API yet before everything is worked out. Like already for 1.5, disable it again for the 1.6 release. This commit is meant to be reverted after the 1.6 release. The disabling of the driver-specific options is achieved by applying the old checks while parsing the command line. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-07-30target-mips: correct the values in the DSP testsPetar Jovanovic5-33/+37
Five tests files for DSP instructions had wrong expected values in the tests. This change fixes this, and this has been cross-checked by running the same test binaries on Malta 74K board. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
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-29tests/tcg/xtensa: Fix out-of-tree buildAndreas Färber1-9/+11
Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2013-07-29target-xtensa: add extui unit testMax Filippov2-0/+27
Signed-off-by: Max Filippov <jcmvbkbc@gmail.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>