summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2013-05-29tests: set MALLOC_PERTURB_ to expose memory bugsStefan Hajnoczi2-2/+6
glibc wipes malloc(3) memory when the MALLOC_PERTURB_ environment variable is set. The value of the environment variable determines the bit pattern used to wipe memory. For more information, see http://udrepper.livejournal.com/11429.html. Set MALLOC_PERTURB_ for gtester and qemu-iotests. Note we pick a random value from 1 to 255 to expose more bugs. If you need to reproduce a crash use 'show environment' in gdb to extract the MALLOC_PERTURB_ value from a core dump. Both make check and qemu-iotests pass with MALLOC_PERTURB_ enabled. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1369661331-28041-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-24qemu-iotests: Try creating huge qcow2 imageKevin Wolf4-1/+70
It's supposed to fail gracefully instead of segfaulting. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-24qcow2.py: Subcommand for changing header fieldsKevin Wolf1-0/+17
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-23qapi: add native list coverage for QMP input visitor testsMichael Roth1-0/+338
This exercises schema-generated visitors for native list types and does some sanity checking on validity of deserialized data. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-05-23qapi: add native list coverage for QMP output visitor testsMichael Roth1-0/+332
This exercises schema-generated visitors for native list types and does some sanity checking on validity of serialized data. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-05-23qapi: add native list coverage for visitor serialization testsMichael Roth1-18/+433
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-05-23qapi: fix visitor serialization tests for numbers/doublesMichael Roth1-17/+8
We never actually stored the stringified double values into the strings before we did the comparisons. This left number/double values completely uncovered in test-visitor-serialization tests. Fixing this exposed a bug in our handling of large whole number values in QEMU's JSON parser which is now fixed. Simplify the code while we're at it by dropping the calc_float_string_storage() craziness in favor of GStrings. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-05-23qapi: add QMP input test for large integersMichael Roth1-0/+20
Large integers previously got capped to LLONG_MAX/LLONG_MIN so we could store them as int64_t. This could lead to silent errors occuring. Now, we use a double to handle these cases. Add a test to confirm that QMPInputVisitor handles this as expected if we're expected an integer value: errors for out of range integer values that got promoted to doubles in this fashion. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-05-22Merge remote-tracking branch 'mjt/trivial-patches' into stagingAnthony Liguori1-1/+0
# By Christophe Lyon (1) and others # Via Michael Tokarev * mjt/trivial-patches: target-moxie: replace target_phys_addr_t with hwaddr Rename hexdump to avoid FreeBSD libutil conflict remove some double-includes translate: remove redundantly included qemu/timer.h Remove twice include of qemu-common.h fix /proc/self/maps output Message-id: 51977B44.1000302@msgid.tls.msk.ru Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-19target-mips: fix EXTPDP and setting up pos field in the DSPControl regPetar Jovanovic1-0/+18
This change makes sure that modifications of pos field in the DSPControl register do not trash other bits in the register. This bug can be triggered with the additional test case in mips32-dsp/extpdp.c in this commit. In addition to this, this change corrects incorrect calculation of the mask for EXTPDP. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-05-18remove some double-includesMichael Tokarev1-1/+0
Some source files #include the same header more than once for no good reason. Remove second #includes in such cases. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-17target-mips: fix incorrect behaviour for EXTPPetar Jovanovic1-0/+18
The mask for EXTP instruction when size=31 has not been correctly calculated. The test (mips32-dsp/extp.c) has been extended to include the case that triggers the issue. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-05-15Merge remote-tracking branch 'luiz/queue/qmp' into stagingAnthony Liguori1-2/+7
# By Michael Roth (1) and Zhangleiqiang (1) # Via Luiz Capitulino * luiz/queue/qmp: qapi: fix leak in unit tests qmp: fix handling of cmd with Equals in qmp-shell Message-id: 1368625179-27962-1-git-send-email-lcapitulino@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-15ide-test: Fix endianness problemsKevin Wolf1-5/+27
The test case passes on big endian hosts now (tested on ppc64) Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1368622839-7084-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-15qapi: fix leak in unit testsMichael Roth1-2/+7
qmp_output_get_qobject() increments the qobject's reference count. Since we currently pass this straight into qobject_to_json() so we can feed the data into a QMP input visitor, we never actually free the underlying qobject when qmp_output_visitor_cleanup() is called. This causes leaks on all of the QMP serialization tests. Fix this by holding a pointer to the qobject and decref'ing it before returning from qmp_deserialize(). Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-05-08Merge remote-tracking branch 'kwolf/for-anthony' into stagingAnthony Liguori9-7/+453
# By Kevin Wolf (7) and Fam Zheng (3) # Via Kevin Wolf * kwolf/for-anthony: qemu-iotests: fix 017 018 for vmdk qemu-iotests: exclude vmdk and qcow from 043 qemu-iotests: exclude vmdk for test 042 qtest/ide-test: Test short and long PRDTs qtest/ide-test: Add simple DMA read/write test case qtest: Add IDE test case libqos/pci: Enable bus mastering ide: Reset BMIDEA bit when the bus master is stopped de_DE.po: Add missing leading spaces ahci: Don't allow creating slave drives Message-id: 1368023344-29731-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-08target-mips: fix incorrect behaviour for INSVPetar Jovanovic1-0/+13
Corner case for INSV instruction when size=32 has not been correctly implemented. The mask for size should be one bit wider, and preparing the filter variable should be aware of this case too. The test for INSV has been extended to include the case that triggers the bug. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-05-08qemu-iotests: fix 017 018 for vmdkFam Zheng4-4/+8
017 and 018 use /bin/mv to move base img from t.IMGFMG to t.IMGFMT.base after filling data, this is not enough for vmdk, when t.IMGFMT is only a description text file who points to t-{flat,s001,f001,...}.IMGFMT as data extent, so testing such subformats alway fails on them. This patch use the trick of temprorily changing TEST_IMG to avoid using /bin/mv. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-08qemu-iotests: exclude vmdk and qcow from 043Fam Zheng1-1/+1
043 tests recursive backing file by changing backing file. VMDK has not implemented this yet, and qcow1 probably never will. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-08qemu-iotests: exclude vmdk for test 042Fam Zheng1-1/+1
Zero sized disk is not supported by qemu vmdk driver, exclude vmdk from the test script. As tested on vmware-vdiskmanager and vmware workstation, zero sized disk is not supported by vmware, either. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-08qtest/ide-test: Test short and long PRDTsKevin Wolf1-0/+54
This tests the behaviour of the DMA engine when the given PRDT contains physical region descriptors for either more or less bytes than the IDE request is for. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-08qtest/ide-test: Add simple DMA read/write test caseKevin Wolf1-0/+221
This tests that single sectors can be successfully written and correctly read back. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-08qtest: Add IDE test caseKevin Wolf2-0/+167
This adds a simple IDE test case and starts by verifying that IDENTIFY can be successfully used and return the correct serial number, version and the WCE flag is set for cache=writeback. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-08libqos/pci: Enable bus masteringKevin Wolf1-1/+1
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-05-03libqos: Relocate I2C filesAndreas Färber5-5/+6
Commit c4efe1cada311b9dc0df5beb71c4227ff3414aa1 (qtest: add libqos including PCI support) created a libqos/ subdirectory but left the existing I2C libqos files libi2c*.[hc] in tests/. Clean this up. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1367502986-15104-1-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-03Merge remote-tracking branch 'stefanha/block' into stagingAnthony Liguori1-0/+3
# By Fam Zheng (8) and others # Via Stefan Hajnoczi * stefanha/block: qemu-iotests: Filter out 'adapter_type' nbd: support large NBD requests nbd: use g_slice_new() instead of a freelist qemu-iotests: Filter out vmdk creation options vmdk: add bdrv_co_write_zeroes vmdk: store fields of VmdkMetaData in cpu endian vmdk: change magic number to macro vmdk: Add option to create zeroed-grain image vmdk: add support for “zeroed‐grain” GTE vmdk: named return code. blockdev: Replace "undefined error" in qmp_block_resize block: add read-only support to VHDX image format. block: initial VHDX driver support framework - supports open and probe block: vhdx header for the QEMU support of VHDX images qemu: add castagnoli crc32c checksum algorithm
2013-05-03qemu-iotests: Filter out 'adapter_type'Fam Zheng1-0/+1
Filter out vmdk creation option 'adapter_type' for vmdk. So that tests with an explicit './check -o adapter_type=XXX' will not fail. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-05-03target-mips: fix calculation of overflow for SHLL.PH and SHLL.QBPetar Jovanovic2-3/+53
This change corrects and simplifies how discard is calculated for shift left logical vector instructions. It is used to detect overflow and set bit 22 in the DSPControl register. The existing tests (shll_ph.c, shll_qb.c) are extended with the corner cases that expose incorrectness in the previous implementation. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-05-03qemu-iotests: Filter out vmdk creation optionsFam Zheng1-0/+2
Cover new image creation options for vmdk, so we can use '-o zeroed_grain=XXX' and '-o subformat=XXX' to run the tests successfully. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-30libqtest: only call fclose() on open filesJesse Larrew1-1/+1
libqtest.c can segfault when calling fclose() if the pidfile wasn't opened successfully. This patch fixes the issue. Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1367250772-17928-1-git-send-email-jlarrew@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-29libqos: Convert fw_cfg values to host endiannessAndreas Färber1-3/+4
The fw_cfg ABI is Little Endian, so byte-swap the generically read byte array to host endianness. This unbreaks the fw_cfg tests on ppc. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1367167547-19931-1-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-26block: Disable driver-specific options for 1.5Kevin Wolf1-1/+1
We don't want to commit to the API yet before everything is worked out. Disable it for the 1.5 release. This commit is meant to be reverted after the 1.5 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-04-22qemu-iotests: add 053 unaligned compressed image size testStefan Hajnoczi3-0/+91
Test that qemu-img convert -c works when input image length is not a multiple of the cluster size. Previously an error message would be produced: qemu-img: error while compressing sector 0: Input/output error Now that qcow2 and qcow handle this case the test passes successfully. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-04-22block: Fail gracefully when using a format driver on protocol levelKevin Wolf2-0/+17
Specifying the wrong driver could fail an assertion: $ qemu-system-x86_64 -drive file.driver=qcow2,file=x qemu-system-x86_64: block.c:721: bdrv_open_common: Assertion `file != ((void *)0)' failed. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-04-22qemu-iotests: Fix _filter_qemuKevin Wolf1-1/+1
$QEMU_PROG happens to be 'qemu' in my setup, so this sed command replaces a bit too much. Restrict it to the start of the line and to when it's followed by a colon, i.e. the form used by error messages. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-17fw_cfg: add qtest test caseAnthony Liguori2-0/+143
This validates some basic characteristics of fw_cfg. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366123521-4330-8-git-send-email-aliguori@us.ibm.com
2013-04-17i440fx-test: add test for PAM functionalityAnthony Liguori1-1/+138
This tests PAM settings for the i440fx. This test does a lot of byte MMIO which is fairly slow with qtest today. But the test does complete in under 2 seconds. We don't fully emulate PAM largely because of limitations with KVM so we #if 0 that part of the test case. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366123521-4330-7-git-send-email-aliguori@us.ibm.com
2013-04-17i440fx-test: add test to compare default register valuesAnthony Liguori2-0/+150
This test compares all of the default register values against the spec. It turns out we deviate in quite a few places. These places are really only visible to the BIOS though which is why this hasn't created any problems. The deviation actually happens in the core PCI layer so I suspect it's not a simple fix if we really care to fix it. For now, just disable the affected checks. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366123521-4330-6-git-send-email-aliguori@us.ibm.com
2013-04-17libqos: add malloc supportAnthony Liguori4-0/+130
This is a very simple allocator for the PC platform. It should be possible to add backends for other platforms. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366123521-4330-5-git-send-email-aliguori@us.ibm.com
2013-04-17libqos: add fw_cfg supportAnthony Liguori5-2/+147
fw_cfg is needed to get the top of memory which is necessary for doing PCI allocation and allocating RAM for DMA. Add a PC version of fw_cfg and enough abstraction to support other platforms. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366123521-4330-4-git-send-email-aliguori@us.ibm.com
2013-04-17qtest: add libqos including PCI supportAnthony Liguori5-1/+494
This includes basic PCI support for the PC platform. Enough abstraction should be present to support non-PC platforms too. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366123521-4330-3-git-send-email-aliguori@us.ibm.com
2013-04-17qtest: don't use system command to avoid double forkAnthony Liguori1-7/+4
Currently we waitpid on the child process we spawn off that does nothing more than system() another process. While this does not appear to be incorrect, it's wasteful and confusing so get rid of it. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366123521-4330-2-git-send-email-aliguori@us.ibm.com
2013-04-15target-mips: fix mipsdsp_mul_q15_q15 and tests for MAQ_SA_W_PHL/PHRPetar Jovanovic2-18/+18
The operands for MAQ_SA_W.PHL/MAQ_SA_W.PHR must in specified format. Otherwise, the results are unpredictable. Once the operands were corrected in the tests (part of this change), a bug in mipsdsp_mul_q15_q15 became visible. This change corrects the tests for MAQ_SA_W.PHL/MAQ_SA_W.PHR and fixes sign-related issue in mipsdsp_mul_q15_q15. It also removes unnecessary comment. Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
2013-04-15iotests: Add 'check -ssh' option to test Secure Shell block device.Richard W.M. Jones2-0/+8
Note in order to run these tests on ssh, you must be running a local ssh daemon, and that daemon must accept loopback connections, and ssh-agent has to be set up to allow logins on the local daemon. In other words, the following command should just work without demanding any passphrase: ssh localhost Signed-off-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-15qemu-iotests: filter QEMU_PROG in 051.outStefan Hajnoczi3-37/+43
Filter the name of the QEMU executable so the output can be diffed no matter what QEMU_PROG is (e.g. qemu-system-x86_64). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-15qemu-iotests: Add test for -drive optionsKevin Wolf3-0/+311
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-15qemu-iotests: A few more bdrv_pread/pwrite testsKevin Wolf2-0/+39
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-13qjson: to_json() case QTYPE_QSTRING is buggy, rewriteMarkus Armbruster1-116/+100
Known bugs in to_json(): * A start byte for a three-byte sequence followed by less than two continuation bytes is split into one-byte sequences. * Start bytes for sequences longer than three bytes get misinterpreted as start bytes for three-byte sequences. Continuation bytes beyond byte three become one-byte sequences. This means all characters outside the BMP are decoded incorrectly. * One-byte sequences with the MSB are put into the JSON string verbatim when char is unsigned, producing invalid UTF-8. When char is signed, they're replaced by "\\uFFFF" instead. This includes \xFE, \xFF, and stray continuation bytes. * Overlong sequences are happily accepted, unless screwed up by the bugs above. * Likewise, sequences encoding surrogate code points or noncharacters. * Unlike other control characters, ASCII DEL is not escaped. Except in overlong encodings. My rewrite fixes them as follows: * Malformed UTF-8 sequences are replaced. Except the overlong encoding \xC0\x80 of U+0000 is still accepted. Permits embedding NUL characters in C strings. This trick is known as "Modified UTF-8". * Sequences encoding code points beyond Unicode range are replaced. * Sequences encoding code points beyond the BMP produce a surrogate pair. * Sequences encoding surrogate code points are replaced. * Sequences encoding noncharacters are replaced. * ASCII DEL is now always escaped. The replacement character is U+FFFD. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-04-13check-qjson: Test noncharacters other than U+FFFE, U+FFFF in stringsMarkus Armbruster1-12/+84
Test cases cover the two noncharacters in the BMP. Add tests for the other 64 noncharacters. Three existing test cases involve noncharacters U+FFFF and U+10FFFF. Instead of deleting them as now duplicates, adjust them to use U+FFFC and U+10FFFFD. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-04-13check-qjson: Improve a few comments, delete bogus onesMarkus Armbruster1-9/+13
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>