summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2013-09-27qemu-iotests: Preallocated zero clusters in 061Max Reitz2-0/+20
Add a test case for zero cluster expansion on an image completely filled with preallocated zero clusters to test 061. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-27qemu-iotests: Quote $TEST_IMG* and $TEST_DIR usageJeff Cody49-337/+337
A lot of image filename and paths are used unquoted. Quote these to make sure that directories / filenames with spaces are not problematic. Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-27qemu-iotests: Add basic ability to use binary sample imagesJeff Cody3-0/+35
For image formats that are not "QEMU native", but supported for compatibility, it is useful to verify that an image created with the 'gold standard' native tool can be read / written to successfully by QEMU. In addition to testing non-native images, this could also be useful to test against image files created by older versions of QEMU. This provides a directory to store small sample images, for use by scripts in tests/qemu-iotests. Image files should be compressed with bzip2. To use a sample image from a bash script, the _use_sample_img function will copy and decompress the image into $TEST_DIR, and set $TEST_IMG to be the decompressed sample image copy. To cleanup, call _cleanup_test_img as normal. Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-26qemu-iotests: fix qmp.py search pathFam Zheng1-1/+1
QMP/qmp.py is renamed to scripts/qmp/qmp.py, fix the search path in iotests.py. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-25qemu-iotests: add monolithicFlat creation test to 059Fam Zheng2-0/+12
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-25qemu-iotests: fix test case 059Fam Zheng1-3/+3
Since commit "block: Error parameter for open functions", error output is more verbose. Update test case output file to follow the change. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-25qemu-iotests: Do not execute 052 with -nocacheMax Reitz1-0/+1
Test 052 uses qemu-io -s which will result in bdrv_open trying to create a temporary snapshot file in /tmp. However, since O_DIRECT and tmpfs do not work well together, disable this test for -nocache. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-25qemu-iotests: add test for backing file overridingFam Zheng2-1/+27
Test that backing.file.filename option can be parsed and override the backing file from image (backing file reflected with "info block"). Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-23Merge remote-tracking branch 'stefanha/block' into stagingAnthony Liguori1-6/+39
# By Stefan Hajnoczi (4) and others # Via Stefan Hajnoczi * stefanha/block: virtio-blk: do not relay a previous driver's WCE configuration to the current blockdev: do not default cache.no-flush to true block: don't lose data from last incomplete sector qcow2: Correct snapshots size for overlap check coroutine: fix /perf/nesting coroutine benchmark coroutine: add qemu_coroutine_yield benchmark qemu-timer: do not take the lock in timer_pending qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe qemu-timer: drop outdated signal safety comments osdep: warn if open(O_DIRECT) on fails with EINVAL libcacard: link against qemu-error.o for error_report() Message-id: 1379698931-946-1-git-send-email-stefanha@redhat.com
2013-09-20tests/.gitignore: ignore test-throttleFam Zheng1-0/+1
Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-09-19coroutine: fix /perf/nesting coroutine benchmarkGabriel Kerneis1-6/+6
The /perf/nesting benchmark is broken because the counters are not reset after each iteration. Therefore, nesting is done only on the first iteration, and skipped on every other. This patch fixes the issue, and reduces the number of iterations to make it possible to run the benchmark in a reasonable amount of time. Signed-off-by: Gabriel Kerneis <gabriel@kerneis.info> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-09-19coroutine: add qemu_coroutine_yield benchmarkGabriel Kerneis1-0/+33
Current coroutine performance benchmarks test only coroutine creation, either directly or in a nested way. This patch adds a benchmark to evaluate the performance of qemu_coroutine_yield. Signed-off-by: Gabriel Kerneis <gabriel@kerneis.info> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-09-13qemu-iotests: Fix test 038Max Reitz2-6/+7
Test 038 uses asynchronous I/O, resulting (potentially) in a different output for every run (regarding the order of the I/O accesses). This can be fixed by simply sorting the I/O access messages, since their order is irrelevant anyway (for this asynchonous I/O). Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-12qemu-iotests: Cleanup test image in test number 007Bharata B Rao1-1/+1
qemu-iotests number 007 doesn't do test image cleanup. This will affect those protocols that expect a clean state before every test. Hence ensure that test image is cleaned up in this test. Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-12qemu-iotests: Adjustments due to error propagationMax Reitz6-40/+24
When opening/creating images, propagating errors instead of immediately emitting them on occurrence results in errors generally being printed on a single line rather than being split up into multiple ones. This in turn requires adjustments to some test results. Also, test 060 used a sed to filter out the test image directory and format by removing everything from the affected line after a certain keyword; this now also removes the error message itself, which can be fixed by using _filter_testdir and _filter_imgfmt. Finally, _make_test_img in common.rc did not filter out the test image directory etc. from stderr. This has been fixed through a redirection of stderr to stdout (which is already done in _check_test_img and _img_info). Signed-off-by: Max Reitz <mreitz@redhat.com>
2013-09-12qemu-iotests: add 057 internal snapshot for block device test caseWenchao Xia3-0/+265
Create in transaction and deletion in single command will be tested. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-12qemu-iotests: New test case in 061Max Reitz2-0/+55
Add one test case for zero cluster expansion on qcow2 version downgrade in shared L2 tables (i.e., L2 tables with a refcount > 1) and one for zero expansion on backed clusters in shared L2 tables. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-12qemu-iotests: add tests for runtime fd passing via SCM rightsWenchao Xia2-3/+52
This case will test whether the monitor can receive fd at runtime. To verify better, additional monitor is created to see if qemu can handler two monitor instances correctly. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-12qemu-iotests: add infrastructure of fd passing via SCMWenchao Xia2-0/+24
This patch make use of the compiled scm helper program to transfer fd via unix socket at runtime. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-12qemu-iotests: add unix socket help programWenchao Xia2-1/+137
This program can do a sendmsg call to transfer fd with unix socket, which is not supported in python2. The built binary will not be deleted in clean, but it is a existing issue in ./tests, which should be solved in another patch. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-12qemu-iotest: qcow2 image option amendmentMax Reitz3-0/+528
Add tests for qemu-img amend on qcow2 image files. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-06qemu-iotests: Fixed test case 026Kevin Wolf3-17/+649
The reference output for test case 026 hasn't been updated in a long time and it's one of the "known failing" cases. This patch updates the reference output so that unintentional changes can be reliably detected again. The problem with this test case is that it produces different output depending on whether -nocache is used or not. The solution of this patch is to actually have two different reference outputs. If nnn.out.nocache exists, it is used as the reference output for -nocache; otherwise, nnn.out stays valid for both cases. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-09-06qemu-iotests: Whitespace cleanupKevin Wolf6-400/+400
These scripts used to have a four characters indentation, with eight consecutive spaces converted into a tab. Convert everything into spaces. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-09-06aio / timers: fix build of test/test-aio.c on non-linux platformsAlex Bligh1-2/+9
tests/test-aio.c used pipe2 which is Linux only. Use qemu_pipe and qemu_set_nonblock for portabillity. Addition of O_CLOEXEC is a harmless bonus. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-09-06add qemu-img convert -n option (skip target volume creation)Alexandre Derumier3-0/+108
Add a -n option to skip volume creation on qemu-img convert. This is useful for targets such as rbd / ceph, where the target volume may already exist; we cannot always rely on qemu-img convert to create the image, as dependent on the output format, there may be parameters which are not possible to specify through the qemu-img convert command line. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Alexandre Derumier <aderumier@odiso.com> Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-09-06qemu-iotests: Adjust test result 039Max Reitz1-3/+1
The moved OFLAG_COPIED check in qcow2_check_refcounts results in a different output from test 039 (mismatches are now found after the general refcount check (as far as any remain)). This patch adjusts the expected test result accordingly. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-09-06throttle: Add units testsBenoît Canet2-0/+483
Signed-off-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-09-03Merge remote-tracking branch 'kwolf/for-anthony' into stagingAnthony Liguori8-9/+238
# By Max Reitz (11) and others # Via Kevin Wolf * kwolf/for-anthony: (26 commits) qemu-iotests: Overlapping cluster allocations qcow2_check: Mark image consistent qcow2-refcount: Repair shared refcount blocks qcow2-refcount: Repair OFLAG_COPIED errors qcow2-refcount: Move OFLAG_COPIED checks qcow2: Employ metadata overlap checks qcow2: Metadata overlap checks qcow2: Add corrupt bit qemu-iotests: Snapshotting zero clusters qcow2-refcount: Snapshot update for zero clusters option: Add assigned flag to QEMUOptionParameter gluster: Abort on AIO completion failure block: Remove old raw driver switch raw block driver from "raw.o" to "raw_bsd.o" raw_bsd: register bdrv_raw raw_bsd: add raw_create_options raw_bsd: introduce "special members" raw_bsd: add raw_create() raw_bsd: emit debug events in bdrv_co_readv() and bdrv_co_writev() add skeleton for BSD licensed "raw" BlockDriver ... Message-id: 1378111792-20436-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-09-02qemu-iotests: Overlapping cluster allocationsMax Reitz3-0/+156
A new test on corrupted images with overlapping cluster allocations. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-09-01aio / timers: use g_usleep() not sleep()Alex Bligh1-3/+3
sleep() apparently doesn't exist under mingw. Use g_usleep for portability. Signed-off-by: Alex Bligh <alex@alex.org.uk> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-08-30qcow2: Add corrupt bitMax Reitz2-7/+7
This adds an incompatible bit indicating corruption to qcow2. Any image with this bit set may not be written to unless for repairing (and subsequently clearing the bit if the repair has been successful). Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-30qemu-iotests: Snapshotting zero clustersMax Reitz3-0/+74
This test creates an image with unallocated zero clusters, then creates a snapshot. Afterwards, there should be neither any errors nor leaks. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-30qemu-iotests: Update reference output for 051Kevin Wolf1-1/+0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-30Revert "block: Disable driver-specific options for 1.6"Kevin Wolf1-1/+1
This reverts commit 8afaefb8919dc8746a57c450a758717c516c7b0a. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-08-26Merge remote-tracking branch 'stefanha/block' into stagingAnthony Liguori3-12/+147
# By Alex Bligh (32) and others # Via Stefan Hajnoczi * stefanha/block: (42 commits) win32-aio: drop win32_aio_flush_cb() aio-win32: replace incorrect AioHandler->opaque usage with ->e aio / timers: remove dummy_io_handler_flush from tests/test-aio.c aio / timers: Remove legacy interface aio / timers: Switch entire codebase to the new timer API aio / timers: Add scripts/switch-timer-api aio / timers: Add test harness for AioContext timers aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API aio / timers: Convert rtc_clock to be a QEMUClockType aio / timers: Remove main_loop_timerlist aio / timers: Rearrange timer.h & make legacy functions call non-legacy aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms aio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline aio / timers: Remove alarm timers aio / timers: Add documentation and new format calls aio / timers: Use all timerlists in icount warp calculations aio / timers: Introduce new API timer_new and friends aio / timers: On timer modification, qemu_notify or aio_notify aio / timers: Convert mainloop to use timeout aio / timers: Convert aio_poll to use AioContext timers' deadline ... Message-id: 1377202298-22896-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-08-22aio / timers: remove dummy_io_handler_flush from tests/test-aio.cAlex Bligh1-7/+2
Remove dummy_io_handler_flush from tests/test-aio.c as it does nothing now. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: Switch entire codebase to the new timer APIAlex Bligh1-12/+12
This is an autogenerated patch using scripts/switch-timer-api. Switch the entire code base to using the new timer API. Note this patch may introduce some line length issues. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: Add test harness for AioContext timersAlex Bligh1-0/+134
Add a test harness for AioContext timers. The g_source equivalent is unsatisfactory as it suffers from false wakeups. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22aio / timers: Add QEMUTimerListGroup to AioContextAlex Bligh2-0/+6
Add a QEMUTimerListGroup each AioContext (meaning a QEMUTimerList associated with each clock is added) and delete it when the AioContext is freed. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-20OptsVisitor: introduce unit tests, with test cases for range flatteningLaszlo Ersek4-3/+299
According to commit 4f193e34 ("tests: Use qapi-schema-test.json as schema parser test") the "tests/qapi-schema/qapi-schema-test.out" file must be updated as well. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-08-20Merge remote-tracking branch 'stefanha/block-next' into stagingAnthony Liguori2-52/+54
# By Stefan Hajnoczi # Via Stefan Hajnoczi * stefanha/block-next: aio: drop io_flush argument tests: drop event_active_cb() thread-pool: drop thread_pool_active() dataplane/virtio-blk: drop flush_true() and flush_io() block/ssh: drop return_true() block/sheepdog: drop have_co_req() and aio_flush_request() block/rbd: drop qemu_rbd_aio_flush_cb() block/nbd: drop nbd_have_request() block/linux-aio: drop qemu_laio_completion_cb() block/iscsi: drop iscsi_process_flush() block/gluster: drop qemu_gluster_aio_flush_cb() block/curl: drop curl_aio_flush() aio: stop using .io_flush() tests: adjust test-thread-pool to new aio_poll() semantics tests: adjust test-aio to new aio_poll() semantics dataplane/virtio-blk: check exit conditions before aio_poll() block: stop relying on io_flush() in bdrv_drain_all() block: ensure bdrv_drain_all() works during bdrv_delete() Message-id: 1376921877-9576-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-08-19aio: drop io_flush argumentStefan Hajnoczi1-20/+20
The .io_flush() handler no longer exists and has no users. Drop the io_flush argument to aio_set_fd_handler() and related functions. The AioFlushEventNotifierHandler and AioFlushHandler typedefs are no longer used and are dropped too. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-19tests: drop event_active_cb()Stefan Hajnoczi1-14/+8
Drop the io_flush argument to aio_set_event_notifier(). Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-19aio: stop using .io_flush()Stefan Hajnoczi1-5/+5
Now that aio_poll() users check their termination condition themselves, it is no longer necessary to call .io_flush() handlers. The behavior of aio_poll() changes as follows: 1. .io_flush() is no longer invoked and file descriptors are *always* monitored. Previously returning 0 from .io_flush() would skip this file descriptor. Due to this change it is essential to check that requests are pending before calling qemu_aio_wait(). Failure to do so means we block, for example, waiting for an idle iSCSI socket to become readable when there are no requests. Currently all qemu_aio_wait()/aio_poll() callers check before calling. 2. aio_poll() now returns true if progress was made (BH or fd handlers executed) and false otherwise. Previously it would return true whenever 'busy', which means that .io_flush() returned true. The 'busy' concept no longer exists so just progress is returned. Due to this change we need to update tests/test-aio.c which asserts aio_poll() return values. Note that QEMU doesn't actually rely on these return values so only tests/test-aio.c cares. Note that ctx->notifier, the EventNotifier fd used for aio_notify(), is now handled as a special case. This is a little ugly but maintains aio_poll() semantics, i.e. aio_notify() does not count as 'progress' and aio_poll() avoids blocking when the user has not set any fd handlers yet. Patches after this remove .io_flush() handler code until we can finally drop the io_flush arguments to aio_set_fd_handler() and friends. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-19tests: adjust test-thread-pool to new aio_poll() semanticsStefan Hajnoczi1-12/+12
aio_poll(ctx, true) will soon block when fd handlers have been set. Previously aio_poll() would return early if all .io_flush() returned false. This means we need to check the equivalent of the .io_flush() condition *before* calling aio_poll(ctx, true) to avoid deadlock. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-19tests: adjust test-aio to new aio_poll() semanticsStefan Hajnoczi1-9/+17
aio_poll(ctx, true) will soon block if any fd handlers have been set. Previously it would only block when .io_flush() returned true. This means that callers must check their wait condition *before* aio_poll() to avoid deadlock. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-16qdev: Set globals in instance_post_init functionEduardo Habkost1-0/+73
This way, properties registered in the instance_init function of child classes will be handled properly by qdev_prop_set_globals(), too. Includes a unit test for the new functionality. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-08-16tests: Unit tests for qdev global properties handlingEduardo Habkost3-0/+115
This tests the qdev global-properties handling code. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
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>