qemu-iotests: add poke_file utility function
The new poke_file function sets bytes at an offset in a file given aprintf-style format string. It can be used to corrupt an image file fortest coverage of error paths.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>...
qemu-iotests: add empty test case for vmdk
Will add vmdk specific tests later here.
Signed-off-by: Fam Zheng <famz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vmdk: check granularity field in opening
Granularity is used to calculate the cluster size and allocate r/wbuffer. 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>...
vmdk: check l2 table size when opening
header.num_gtes_per_gte determines size for L2 table. Check for too bigvalue before using it. Limit to 512M entries (2GB per one L2 table).
qemu-iotests: filter QEMU version in monitor banner
Filter out the QEMU monitor version banner so that tests do not breakwhen the QEMU version number is changed.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Merge remote-tracking branch 'filippov/tags/20130729-xtensa' into staging
xtensa queue 2013-07-29
block: Disable driver-specific options for 1.6
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 commitis meant to be reverted after the 1.6 release.
The disabling of the driver-specific options is achieved by applying the...
target-mips: correct the values in the DSP tests
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 sametest binaries on Malta 74K board.
Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>...
qapi.py: Reject invalid characters in schema file
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.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qapi.py: Fix schema parser to check syntax systematically
Fixes at least the following parser bugs:
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
qapi.py: Fix diagnosing non-objects at a schema's top-level
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...
qapi.py: Permit comments starting anywhere on the line
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.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
tests: QAPI schema parser tests
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.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
tests: Use qapi-schema-test.json as schema parser test
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.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qapi.py: Restructure lexer and parser
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...
qapi.py: Decent syntax error reporting
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.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
tests/tcg/xtensa: Fix out-of-tree build
Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
target-xtensa: add extui unit test
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Merge branch 'trivial-patches' of git://git.corpit.ru/qemu
target-mips: fix mipsdsp_mul_q31_q31
Multiplication of two fractional word elements is not correct when signextension/promotion is needed. This change fixes it by adding correctcasts from unsigned to signed values.In addition, the tests (dpaq_sa_l_w.c and dpsq_sa_l_w.c) have been extended...
target-mips: fix mipsdsp_trunc16_sat16_round
This change corrects rounding and saturation of Q31 fractional value inmipsdsp_trunc16_sat16_round(). Overflow detection was incorrect for thecorner case for PRECRQ_RS.PH, and this test case is also part of the change....
target-mips: fix multiplication in mipsdsp_rndq15_mul_q15_q15
Multiplication of Q15 fractional halfword vectors was incorrect in theprevious implementation of mipsdsp_rndq15_mul_q15_q15. It failed to takeelement signs into account. This change fixes it, and it adds a test case...
misc: Use g_assert_not_reached for code which is expected to be unreachable
The macro g_assert_not_reached is a better self documenting replacementfor assert(0) or assert(false).
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Add tests for sync modes 'TOP' and 'NONE'
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 testfor invalid format.
Signed-off-by: Ian Main <imain@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev: Rename 'readonly' option to 'read-only'
Option name cleanup before it becomes a QMP API.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
qcow2: Use dashes instead of underscores in options
This is what QMP wants to use. The options haven't been enabled in anyrelease yet, so we're still free to change them.
qtest: add test for ISA I/O space endianness
This writes a register and reads its 1/2/4 byte parts. Maskingis 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...
pc-testdev: add I/O port to test memory.c auto split/combine
The ports at 0xe8..0xeb have impl.min/max_access_size == 1, sothat 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>...
tests: Add test-bitops.c with some sextract tests
Add some simple test cases for the new sextract32and 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...
boot-order-test: Better separate target-specific and generic parts
The initial version did just PC. I didn't bother to separate outgeneric 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....
boot-order-test: Code motion for better readability
Cc: Andreas Färber <afaerber@suse.de>Cc: Alexander Graf <agraf@suse.de>Cc: qemu-ppc@nongnu.orgSigned-off-by: Markus Armbruster <armbru@redhat.com>Message-id: 1372254743-15808-9-git-send-email-armbru@redhat.com...
boot-order-test: Add tests for PowerPC PREP
Cc: Andreas Färber <afaerber@suse.de>Cc: Alexander Graf <agraf@suse.de>Cc: qemu-ppc@nongnu.orgSigned-off-by: Markus Armbruster <armbru@redhat.com>Message-id: 1372254743-15808-10-git-send-email-armbru@redhat.com...
boot-order-test: Add tests for Sun4m
Cc: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Markus Armbruster <armbru@redhat.com>Message-id: 1372254743-15808-11-git-send-email-armbru@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
libqos: Generalize I/O-mapped fw_cfg
Provide a constructor that takes the base address in addition to thePC-specific one.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Message-id: 1372254743-15808-12-git-send-email-armbru@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
boot-order-test: Add tests for Sun4u
Cc: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Markus Armbruster <armbru@redhat.com>Message-id: 1372254743-15808-13-git-send-email-armbru@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
boot-order-test: New; covering just PC for now
Signed-off-by: Markus Armbruster <armbru@redhat.com>Message-id: 1372254743-15808-3-git-send-email-armbru@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
libqos: include dependencies
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...
libqos: Add support for memory-mapped fw_cfg
Signed-off-by: Markus Armbruster <armbru@redhat.com>Message-id: 1372254743-15808-5-git-send-email-armbru@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
boot-order-test: Add tests for PowerMacs
They set the boot device via fw_cfg, which is then translated to a bootpath 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>...
boot-order-test: Cover -boot once in ppc tests
Cc: Andreas Färber <afaerber@suse.de>Cc: Alexander Graf <agraf@suse.de>Cc: qemu-ppc@nongnu.orgSigned-off-by: Markus Armbruster <armbru@redhat.com>Message-id: 1372254743-15808-7-git-send-email-armbru@redhat.com...
libqtest: New qtest_end() to go with qtest_start()
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...
libqtest: Plug fd and memory leaks in qtest_quit()
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...
blockdev: add sync mode to drive-backup QMP command
The drive-backup command is similar to the drive-mirror command, exceptno guest data written after the command executes gets copied. Add async mode argument which determines whether the entire disk is copied,...
block: Don't parse protocol from file.filename
One of the major reasons for doing something new for -blockdev andblockdev-add was that the old block layer code parses filenames insteadof just taking them literally. So we should really leave it untouched...
qemu-iotests: Update 051 reference output
This has been broken by commit bd5c51ee.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
add a header file for atomic operations
We're already using them in several places, but __sync builtins are justtoo 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>
int128: optimize and add test cases
For add, the carry only requires checking one of the arguments.For sub and neg, we can similarly optimize computation of thecarry.
For ge, we can just do lexicographic order.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-iotests: extract wait_until_completed() into iotests.py
The 'drive-mirror' tests often issue 'block-job-complete' and wait forthe QMP completion event. Other types of block jobs also want to waitfor completion but they may not need to issue 'block-job-complete'....
qemu-iotests: add 055 drive-backup test case
Testing drive-backup is similar to image streaming and drive mirroring.This test case is based on 041.
Revert "block: Disable driver-specific options for 1.5"
This reverts commit 8ec7d390b0d50b5e5b4b1d8dba7ba40d64a70875.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
ide-test: fix failure for test_flush
bd07684aacfb61668ae2c25b7dd00b64f3d7c7f3 added a test to ensure BSYflag is set when a flush request is in flight. It does this by settinga 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....
ide-test: Add FLUSH CACHE test case
This checks in particular that BSY is set while the flush request is inflight.
ide-test: Add enum value for DEV
Get rid of the magic number.
cutils: Support 'P' and 'E' suffixes in strtosz()
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
qemu-iotests: make assert_no_active_block_jobs() common
Tests 030 and 041 both use query-block-jobs to check whether any blockjobs are active. Make this code common so that 'drive-backup' and othernew feature tests will be able to reuse it.
Suggested-by: Kevin Wolf <kwolf@redhat.com>...
qemu-iotests: make cancel_and_wait() common
The cancel_and_wait() function has been duplicated in 030 and 041. Moveit into iotests.py and let it return the event so tests can performadditional asserts.
Note that 041's cancel_and_wait(wait_ready=True) is replaced by...
qemu-iotests: make compare_images() common
The iotests.compare_images() function returns True if two image fileshave the identical data. Previously this was implemented by convertingimages to raw and then comparing their contents using Python. Since"qemu-img compare" is now available and is more efficient, switch to it....
qemu-iotests: make create_image() common
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>...
qemu-iotests: fix 054 cluster size help output
Commit f3f4d2c09b9cf46903ba38425ec46c44185162bd added a hint to increasethe cluster size when a large image cannot be created. Test 054 now hasoutdated output and fails because the golden output does not match....
qapi: pad GenericList value fields to 64 bits
With the introduction of native list types, we now have types such asint64List where the 'value' field is not a pointer, but the actual64-bit value.
On 32-bit architectures, this can lead to situations where 'next' field...
tests: set MALLOC_PERTURB_ to expose memory bugs
glibc wipes malloc(3) memory when the MALLOC_PERTURB_ environmentvariable is set. The value of the environment variable determines thebit pattern used to wipe memory. For more information, seehttp://udrepper.livejournal.com/11429.html....
qcow2.py: Subcommand for changing header fields
qemu-iotests: Try creating huge qcow2 image
It's supposed to fail gracefully instead of segfaulting.
qapi: add QMP input test for large integers
Large integers previously got capped to LLONG_MAX/LLONG_MIN so we couldstore 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...
qapi: fix visitor serialization tests for numbers/doubles
We never actually stored the stringified double values into the stringsbefore we did the comparisons. This left number/double values completelyuncovered in test-visitor-serialization tests.
Fixing this exposed a bug in our handling of large whole number values...
qapi: add native list coverage for visitor serialization tests
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>
qapi: add native list coverage for QMP output visitor tests
This exercises schema-generated visitors for native list types and doessome sanity checking on validity of serialized data.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>...
qapi: add native list coverage for QMP input visitor tests
This exercises schema-generated visitors for native list types and doessome sanity checking on validity of deserialized data.
Merge remote-tracking branch 'mjt/trivial-patches' into staging
target-mips: fix EXTPDP and setting up pos field in the DSPControl reg
This change makes sure that modifications of pos field in the DSPControlregister do not trash other bits in the register. This bug can be triggeredwith the additional test case in mips32-dsp/extpdp.c in this commit....
remove some double-includes
Some source files #include the same header more thanonce for no good reason. Remove second #includes insuch cases.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target-mips: fix incorrect behaviour for EXTP
The mask for EXTP instruction when size=31 has not been correctlycalculated.
The test (mips32-dsp/extp.c) has been extended to include the case thattriggers the issue.
Merge remote-tracking branch 'luiz/queue/qmp' into staging
Message-id: 1368625179-27962-1-git-send-email-lcapitulino@redhat.com...
ide-test: Fix endianness problems
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.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qapi: fix leak in unit tests
qmp_output_get_qobject() increments the qobject's reference count. Sincewe currently pass this straight into qobject_to_json() so we can feedthe data into a QMP input visitor, we never actually free the underlyingqobject when qmp_output_visitor_cleanup() is called. This causes leaks...
Merge remote-tracking branch 'kwolf/for-anthony' into staging
target-mips: fix incorrect behaviour for INSV
Corner case for INSV instruction when size=32 has not been correctlyimplemented. The mask for size should be one bit wider, and preparing thefilter variable should be aware of this case too.
The test for INSV has been extended to include the case that triggers the...
qemu-iotests: fix 017 018 for vmdk
017 and 018 use /bin/mv to move base img from t.IMGFMG to t.IMGFMT.baseafter filling data, this is not enough for vmdk, when t.IMGFMT is only adescription text file who points to t-{flat,s001,f001,...}.IMGFMT asdata extent, so testing such subformats alway fails on them....
libqos/pci: Enable bus mastering
qtest: Add IDE test case
This adds a simple IDE test case and starts by verifying that IDENTIFYcan be successfully used and return the correct serial number, versionand the WCE flag is set for cache=writeback.
qtest/ide-test: Add simple DMA read/write test case
This tests that single sectors can be successfully written and correctlyread back.
qtest/ide-test: Test short and long PRDTs
This tests the behaviour of the DMA engine when the given PRDT containsphysical region descriptors for either more or less bytes than theIDE request is for.
qemu-iotests: exclude vmdk for test 042
Zero sized disk is not supported by qemu vmdk driver, exclude vmdk fromthe test script.
As tested on vmware-vdiskmanager and vmware workstation, zero sized diskis not supported by vmware, either.
qemu-iotests: exclude vmdk and qcow from 043
043 tests recursive backing file by changing backing file. VMDK has notimplemented this yet, and qcow1 probably never will.
libqos: Relocate I2C files
Commit c4efe1cada311b9dc0df5beb71c4227ff3414aa1 (qtest: add libqosincluding PCI support) created a libqos/ subdirectory but left theexisting I2C libqos files libi2c*.[hc] in tests/. Clean this up.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
Merge remote-tracking branch 'stefanha/block' into staging
qemu-iotests: Filter out 'adapter_type'
Filter out vmdk creation option 'adapter_type' for vmdk. So that testswith an explicit './check -o adapter_type=XXX' will not fail.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
target-mips: fix calculation of overflow for SHLL.PH and SHLL.QB
This change corrects and simplifies how discard is calculated for shiftleft logical vector instructions. It is used to detect overflow and set bit22 in the DSPControl register.
The existing tests (shll_ph.c, shll_qb.c) are extended with the corner cases...
qemu-iotests: Filter out vmdk creation options
Cover new image creation options for vmdk, so we can use '-ozeroed_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>...
libqtest: only call fclose() on open files
libqtest.c can segfault when calling fclose() if the pidfile wasn'topened successfully. This patch fixes the issue.
Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>...
libqos: Convert fw_cfg values to host endianness
The fw_cfg ABI is Little Endian, so byte-swap the generically readbyte 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>...
block: Disable driver-specific options for 1.5
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 revertedafter the 1.5 release.
qemu-iotests: add 053 unaligned compressed image size test
Test that qemu-img convert -c works when input image length is not amultiple of the cluster size.
Previously an error message would be produced:
qemu-img: error while compressing sector 0: Input/output error...
block: Fail gracefully when using a format driver on protocol level
Specifying the wrong driver could fail an assertion:
$ qemu-system-x86_64 -drive file.driver=qcow2,file=xqemu-system-x86_64: block.c:721: bdrv_open_common: Assertion `file !=((void *)0)' failed....
qemu-iotests: Fix _filter_qemu
$QEMU_PROG happens to be 'qemu' in my setup, so this sed commandreplaces a bit too much. Restrict it to the start of the line and towhen it's followed by a colon, i.e. the form used by error messages.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
i440fx-test: add test for PAM functionality
This tests PAM settings for the i440fx. This test does a lot ofbyte MMIO which is fairly slow with qtest today. But the testdoes complete in under 2 seconds.
We don't fully emulate PAM largely because of limitations with...
fw_cfg: add qtest test case
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
i440fx-test: add test to compare default register values
This test compares all of the default register values against thespec. It turns out we deviate in quite a few places. Theseplaces are really only visible to the BIOS though which is whythis hasn't created any problems....
libqos: add fw_cfg support
fw_cfg is needed to get the top of memory which is necessary fordoing PCI allocation and allocating RAM for DMA.
Add a PC version of fw_cfg and enough abstraction to support otherplatforms.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
libqos: add malloc support
This is a very simple allocator for the PC platform. It shouldbe 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