Commit graph

319 commits

Author SHA1 Message Date
Anthony Liguori 6454678423 Merge remote-tracking branch 'qmp/queue/qmp' into staging
* qmp/queue/qmp:
  qapi: g_hash_table_find() instead of GHashTableIter.
  qmp: make block job command naming consistent
2012-04-23 14:29:11 -05:00
Blue Swirl ce6bf17a97 qtest: fix memread and memwrite on 32 bit hosts
Use PRIx64 to print 64 bit values to avoid truncation
on 32 bit hosts.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-23 19:28:14 +00:00
Anthony Liguori 1f8bcac09a Merge remote-tracking branch 'kwolf/for-anthony' into staging
* kwolf/for-anthony: (38 commits)
  qemu-iotests: Fix test 031 for qcow2 v3 support
  qemu-iotests: Add -o and make v3 the default for qcow2
  qcow2: Zero write support
  qemu-iotests: Test backing file COW with zero clusters
  qemu-iotests: add a simple test for write_zeroes
  qcow2: Support for feature table header extension
  qcow2: Support reading zero clusters
  qcow2: Version 3 images
  qcow2: Ignore reserved bits in check_refcounts
  qcow2: Ignore reserved bits in refcount table entries
  qcow2: Simplify count_cow_clusters
  qcow2: Refactor qcow2_free_any_clusters
  qcow2: Ignore reserved bits in L1/L2 entries
  qcow2: Fail write_compressed when overwriting data
  qcow2: Ignore reserved bits in count_contiguous_clusters()
  qcow2: Ignore reserved bits in get_cluster_offset
  qcow2: Save disk size in snapshot header
  Specification for qcow2 version 3
  qcow2: Fix refcount block allocation during qcow2_alloc_cluster_at()
  iotests: Resolve test failures caused by hostname
  ...
2012-04-23 14:27:04 -05:00
Anthony Liguori 5469963394 Merge remote-tracking branch 'origin/master' into staging
* origin/master: (27 commits)
  target-arm: Move reset handling to arm_cpu_reset
  target-arm: Drop cpu_reset_model_id()
  target-arm: Move cache ID register setup to cpu specific init fns
  target-arm: Move OMAP cp15_i_{max,min} reset to cpu_state_reset
  target-arm: Move feature register setup to per-CPU init fns
  target-arm: Move iWMMXT wCID reset to cpu_state_reset
  target-arm: Drop JTAG_ID documentation
  target-arm: Move SCTLR reset value setup to per cpu init fns
  target-arm: Move CTR setup to per cpu init fns
  target-arm: Move MVFR* setup to per cpu init fns
  target-arm: Move FPSID config to cpu init fns
  target-arm: Move feature bit settings to CPU init fns
  target-arm: Add QOM subclasses for each ARM cpu implementation
  target-arm: remind to keep arm features in sync with linux-user/elfload.c
  tci: GETPC() macro must return an uintptr_t
  gdbstub: Synchronize CPU state unconditionally in gdb_set_cpu_pc
  softfloat: make USE_SOFTFLOAT_STRUCT_TYPES compile
  target-xtensa: add tests for LOOPNEZ and LOOPGTZ
  target-xtensa: fix LOOPNEZ/LOOPGTZ translation
  qtest: add m48t59 tests for Sparc
  ...
2012-04-23 11:49:59 -05:00
Stefan Hajnoczi db58f9c060 qmp: make block job command naming consistent
The block streaming and job commands used '_' instead of '-' for reasons
of compatibility with libvirt, which already included support for the
'_' naming.  However, the semantics of block_job_cancel have changed and
libvirt now needs to handle the new semantics.

Since the old semantics were never in a QEMU release we can still rename
the commands to use '-' instead of '_'.  Libvirt is also happy because
the new name can be used to distinguish QEMU binaries that support the
latest block-job-cancel semantics from those that include a downstream
block_job_cancel command.

Therefore, let's apply the QAPI/QMP naming rules to the block streaming
and job commands.  QEMU 1.1 will be the first release with these
commands so no upstream users can break.

Note that HMP commands are left with '_' because that is the convention
there.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-04-23 13:02:01 -03:00
Max Filippov 536a98d4d6 target-xtensa: add tests for LOOPNEZ and LOOPGTZ
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-21 13:24:50 +00:00
Blue Swirl f91837a7f1 qtest: add m48t59 tests for Sparc
Add simple m48t59 qtests, enable test only for Sparc32
and Sparc64. On PPC, the device is behind PCI bus.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-21 07:10:25 +00:00
Kevin Wolf 1042ec94b1 qemu-iotests: Fix test 031 for qcow2 v3 support
qcow2.py must be updated to work with version 3 images at all, the
output has changed since the feature table extension has been added, and
version 2 and version 3 images can't possibly have the same test output.

Change the test case to completely ignore IMGOPTS and run the test for
both compat=1.1 and compat=0.10 regardless of the ./check command line.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-20 15:57:30 +02:00
Kevin Wolf 8900436891 qemu-iotests: Add -o and make v3 the default for qcow2
This adds an -o option to qemu-iotests, which is an option string that
is passed through to qemu-img create -o... This allows testing different
subformat with a command like './check -qcow2 -o compat=0.10'.

For qcow2, if no compat option is specified, compat=1.1 is the new
default.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-20 15:57:30 +02:00
Kevin Wolf ab3a32ad5e qemu-iotests: Test backing file COW with zero clusters
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-20 15:57:30 +02:00
Paolo Bonzini ee3a315edf qemu-iotests: add a simple test for write_zeroes
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-20 15:57:30 +02:00
David Gibson fecccc4477 Add .gitignore for tests/
The new autotests in tests/ generate a number of files, both
executable and source, which are not caught by the existing .gitignore
files.  This patch adds a new .gitignore in tests/ which covers these.

[Changed 'rtc-test' to '*-test' so future tests do not need to be added
to .gitignore on a case-by-case basis.  Stefan]

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-04-20 13:23:27 +01:00
Andreas Färber 29926112a2 iotests: Resolve test failures caused by hostname
`hostname -s` may output an errror:
hostname: Name or service not known
This causes all tests to fail for `make check-block`.

Suppress such error messages, letting the tests succeed.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-20 12:58:50 +02:00
Blue Swirl 85215d419b qtest: add register fuzzing to RTC test
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-19 18:14:55 +00:00
Dong Xu Wang 8ff9ae00da iotests: fix error in 005
According comment, we should not read again, we will write.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-19 15:48:52 +02:00
Kevin Wolf aafcdcc9eb qemu-iotests: Test bdrv_close while AIO is in flight
If the BlockDriverState is closed/freed without draining the AIO
requests first, the request coroutines may work on invalid data and file
descriptors or have some dangling pointers that cause segfaults.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-04-19 15:48:52 +02:00
Kevin Wolf 7299550b25 qemu-iotests: Always filter cluster_size out in _make_test_img
Some image formats do have a cluster size, others don't, but there are
tests that work with both sets of images and currently we get failures
because the qemu-img create output doesn't mention the cluster size for
some formats.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-04-19 15:48:52 +02:00
Paolo Bonzini 2ad596079e tests: remove .SECONDARY special target
The special target should not be needed anymore, and caused (perhaps
due to a Make bug) a failure with "make -j2".  In any case, the
main makefile is a better place for such special targets rather
than an included makefile.

Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-14 16:19:50 +00:00
Max Filippov ad4ccc9370 target-xtensa: add test for IBREAK invalidation
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-14 15:25:39 +00:00
Max Filippov ec9fe93efe target-xtensa: add tests for LBEG/LEND invalidation
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-14 15:25:39 +00:00
Max Filippov 7d6b9f0a38 target-xtensa: improve unit tests debugging
- add testcase announcement;
- add global symbols for individual tests;
- add host-debug-* makefile target.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2012-04-14 03:48:08 +04:00
Stefan Weil 28d3d1658a qemu-iotests: Fix call syntax for qemu-io
qemu-io requires options first, then fixed parameters.

GNU getopt also allows options at the end, but POSIX getopt
doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
behaviour with GNU getopt, too.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05 15:10:06 +02:00
Stefan Weil 21af814887 qemu-iotests: Fix call syntax for qemu-img
qemu-img requires first options, then file name, then size.

GNU getopt also allows options at the end, but POSIX getopt
doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
behaviour with GNU getopt, too.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05 15:08:22 +02:00
Kevin Wolf f394f1feb9 qemu-iotests: Test unknown qcow2 header extensions
The immportant thing here is that header extensions don't get silently
dropped when the header is rewritten, e.g. during a rebase.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05 14:54:41 +02:00
Kevin Wolf 6e19b3c4e0 qemu-iotests: qcow2.py
This adds a tool that is meant to inspect and edit qcow2 files in a
low-level way, that wouldn't be possible with qemu-img/io, for example
by adding yet unknown extensions or flags. This way we can test whether
qemu deals properly with future backwards compatible extensions.

For now, let's start with the image header and header extensions.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-05 14:54:41 +02:00
Michael Walle 927b241d66 tests: fix out-of-tree building for lm32 target
Signed-off-by: Michael Walle <michael@walle.cc>
2012-03-31 19:56:03 +02:00
Blue Swirl 02b3efcb75 qtest: avoid a warning with RTC test
Avoid this warning on OpenBSD:
  CC    tests/rtc-test.o
/src/qemu/tests/rtc-test.c: In function 'check_time':
/src/qemu/tests/rtc-test.c:171: warning: format '%ld' expects type 'long int', but argument 2 has type 'time_t'
/src/qemu/tests/rtc-test.c:173: warning: format '%ld' expects type 'long int', but argument 2 has type 'time_t'

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-30 18:58:46 +00:00
Blue Swirl d2a16f74f2 qtest: fix out of tree build
Trace objects are also needed if tracing is enabled.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-30 17:39:33 +00:00
Anthony Liguori d1aaf543a7 qtest: add rtc-test test-case
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-30 08:14:12 -05:00
Anthony Liguori 49ee359077 qtest: add C version of test infrastructure
This also includes a qtest wrapper script to make it easier to launch qtest
tests directly.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-30 08:14:11 -05:00
Paolo Bonzini b93b63f574 test makefile overhaul
This introduces new test reporting infrastructure based on
gtester and gtester-report.

Also, all existing tests are moved to tests/, and tests/Makefile
is reorganized to factor out the commonalities in the rules.

Signed-off-by: Anthony Liguori <aliguori@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-30 08:14:11 -05:00
Paolo Bonzini e38ac9621c qapi: add strict mode to input visitor
While QMP in general is designed so that it is possible to ignore
unknown arguments, in the case of the QMP server it is better to
reject them to detect bad clients.  In fact, we're already doing
this at the top level in the argument checker.  To extend this to
complex structures, add a mode to the input visitor where it checks
for unvisited keys and raises an error if it finds one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-03-27 09:15:13 -03:00
Michael Roth 2db5b068ac test: add test-qmp-commands to make check
All the deps are here but the test was never added to the list of tests
for make check

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-26 11:28:38 +01:00
Michael Roth 3ac805d922 test: remove qemu-ga reference
This was added by mistake a while back.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-26 11:28:37 +01:00
Kevin Wolf b8c6f29eb8 Add 'make check-block'
Runs the full qemu-iotests suite for various image formats.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Kevin Wolf 8959449bb9 make check: Add qemu-iotests subset
Run the 'quick' group from qemu-iotests during 'make check'.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Kevin Wolf 3811f63acd qemu-iotests: Mark some tests as quick
This creates a new test group 'quick' for some test case that take at
most a couple of seconds each, so that the group can be run during a
quick 'make check'

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Blue Swirl b3e54c689c Merge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa
* 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa:
  target-xtensa: add breakpoint tests
  target-xtensa: add DEBUG_SECTION to overlay tool
  target-xtensa: add DBREAK data breakpoints
  exec: let cpu_watchpoint_insert accept larger watchpoints
  exec: fix check_watchpoint exiting cpu_loop
  exec: add missing breaks to the watch_mem_write
  target-xtensa: add ICOUNT SR and debug exception
  target-xtensa: implement instruction breakpoints
  target-xtensa: add DEBUGCAUSE SR and configuration
  target-xtensa: fetch 3rd opcode byte only when needed
  target-xtensa: implement info tlb monitor command
  target-xtensa: define TLB_TEMPLATE for MMU-less cores
2012-03-03 17:53:41 +00:00
Kevin Wolf 6ce2d77abe qemu-iotests: Test rebase with short backing file
This tests that qemu-img rebase doesn't assume that the backing file has
the same size as the image, but considers that it can be smaller.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-02-29 15:48:44 +01:00
Kevin Wolf 92ab69b61f qemu-iotests: 026: Reduce output changes for cache=none qcow2
qemu-iotests supports the -nocache option which makes the tests run with
cache=none. For blkdebug tests with qcow2 this means that we may see
test results that differ from cache=writethrough. This patch makes the
diff a bit smaller and therefore easier to review.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-02-29 15:48:44 +01:00
Kevin Wolf a06d5cc20b qemu-iotests: Filter out DOS line endings
This one makes it possible to run qemu-iotests on a Windows build using Wine
and get somewhat meaningful results.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-02-29 15:48:44 +01:00
Stefan Hajnoczi 37ce63eb23 test: add image streaming tests
This patch adds a test suite for the image streaming feature.  It
exercises the 'block_stream', 'block_job_cancel', 'block_job_set_speed',
and 'query-block-jobs' QMP commands.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-29 15:48:44 +01:00
Stefan Hajnoczi f345cfd019 qemu-iotests: add iotests Python module
Block layer tests that involve QMP commands rather than qemu-img or
qemu-io are not well-suited for shell scripting.  This patch adds a
Python module which allows tests to be written in Python instead.

The basic API is:

  VM          - class for launching and interacting with a VM
  QMPTestCase - abstract base class for tests that use QMP
  qemu_img()  - wrapper function for invoking qemu-img
  qemu_io()   - wrapper function for invoking qemu-io
  imgfmt      - the image format under test (e.g. qcow2, qed)
  test_dir    - scratch directory path for temporary files
  main()      - entry point for running tests

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-29 15:48:44 +01:00
Stefan Hajnoczi 049255b60c qemu-iotests: export TEST_DIR for non-bash tests
Since qemu-iotests may need to create large image files it is possible
to specify the test directory.  The TEST_DIR variable needs to be
exported so non-bash tests can make use of it.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-29 15:48:44 +01:00
Kevin Wolf d06cddf517 Merge qemu-iotests into for-anthony 2012-02-23 10:35:24 +01:00
Lucas Meneghel Rodrigues d305fd5dd8 qemu-iotests: common.config: Allow use of arbitrary qemu* paths
Since we might want to test arbitrary qemu, qemu-img and
qemu-io paths, allow users to specify environment variable
values for QEMU_PROG, QEMU_IMG_PROG and QEMU_IO_PROG so
the testsuite will use those values rather than find them
on PATH. Obviously, if such env variables are not set
prior to script execution, normal detection mechanism
takes place.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:47 +01:00
Lucas Meneghel Rodrigues df4b627efe qemu-iotests: check: print relevant path information
Print the paths of the programs under test
(qemu, qemu-img and qemu-io).

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:47 +01:00
Kevin Wolf 8455e4ee66 qemu-iotests: test loading internal snapshots
Test loading internal snapshots where the L1 table of the snapshot
is smaller than the current L1 table.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:47 +01:00
Kevin Wolf bfe8524862 qemu-iotests: Update filter for default cluster size
Until recently, qemu-img create displayed cluster_size=0 for the default
cluster size. It is changed to display the real cluster size now, which results
in the cluster size not being filtered out any more.

If the cluster size is specified explicitly in CLUSTER_SIZE, keep the output,
and if using the default, filter it out. This mostly restores the old behaviour
of the test cases; test 015 must be fixed to use CLUSTER_SIZE instead of using
extra_img_options for it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:47 +01:00
Stefan Hajnoczi 25bb8a365a qemu-iotests: add qed support to 025 image resize test
QED now supports the truncate (aka resize) operation for growing images.
Update test 025 so it runs for QED.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:47 +01:00
Josh Durgin 92eeab5bf5 qemu-iotests: Update rbd support
rbd implements bdrv_truncate, so test 025 will work.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:47 +01:00
Mitnick Lyu 5e654e08ff qemu-iotests: common.config: Fix no $TEST_DIR directory
mkdir $TEST_DIR on common.config first run

Signed-off-by: Mitnick Lyu <mitnick.lyu@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:47 +01:00
Christoph Hellwig 5177c51245 qemu-iotests: only run 016 for file and sheepdog protocols
016 writes past EOF which isn't support by most protocols, so limit
it to file and sheepdog, which explicitly support it.

Pointed out by Josh Durgin <josh.durgin@dreamhost.com>.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:47 +01:00
Stefan Hajnoczi dd0c35d69b qemu-iotests: Use zero-based offsets for IO patterns
The io_pattern style functions have the following loop:

  for i in `seq 1 $count`; do
      echo ... $(( start + i * step )) ...
  done

Offsets are 1-based so start=1024, step=512, count=4 yields:
1536, 2048, 2560, 3072

Normally we expect:
1024, 1536, 2048, 2560

Most tests ignore this detail, which means that they perform I/O to a
slightly different range than expected by the test author.

Later on things got less innocent and tests started trying to compensate
for the 1-based indexing.  This included negative start values in test
024 and my own attempt with count-1 in test 028!

The end result is that tests that use io_pattern are hard to reason
about and don't work the way you'd expect.  It's time to clean this mess
up.

This patch switches io_pattern to 0-based offsets.  This requires
adjusting the golden outputs since I/O ranges are now shifted and output
differs.

Verifying these output diffs is easy, however.  Each diff hunk moves one
I/O from beyond the end of the pattern range to the beginning.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:46 +01:00
MORITA Kazutaka 9cdfa1b34e qemu-iotests: add support for rbd and sheepdog protocols
This patch introduces tests for protocols other than file, and
initially supports rbd and sheepdog.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:46 +01:00
Stefan Hajnoczi 62284d1776 qemu-iotests: filter IMGFMT correctly in 019
Test 019 can be run with qcow2 and qed image formats.  Replace the
specific image format value with "IMGFMT" so the golden output does not
hardcode qcow2 or qed.

This patch also includes a typo fix for "occurrences".

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:46 +01:00
Stefan Weil 657c166f8e qemu-iotests: README: Fix spelling
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:46 +01:00
Stefan Hajnoczi f5a4bbd913 qemu-iotests: add support for qed format
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-23 10:29:46 +01:00
Christoph Hellwig 2684871af5 qemu-iotests: filter TEST_DIR correctly in 019
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-23 10:29:38 +01:00
Kevin Wolf 581e7d530b qemu-iotests: fix 019 golden output
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Kevin Wolf 727822f5b7 qemu-iotests: update expected results after qemu-img changes
The error message for leaked clusters has changed. qemu-iotests needs to be
updated to pass 026 again.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Stefan Hajnoczi 8268b7675c qemu-iotests: add read/write from smaller backing image test
Some image formats support backing images that are smaller than the
image file.  This patch adds a test that verifies that reads and writes
beyond the end of backing image work.

Unallocated reads beyond the end of the backing file should produce
zeroes.

Writes beyond the end of the backing file should copy-on-write using
zeroes.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Stefan Hajnoczi 89d22bc306 qemu-iotests: add sub-cluster allocating write test for sparse image formats
Image formats that grow the image file on demand and are organized into
clusters must handle sub-cluster allocating writes.  Such writes touch
a portion of a previously unallocated data cluster.  After the image
file is grown with the written data, reads of that cluster should work
as expected:

1. Sectors before the written region are zero.
2. The written region is present and the data is uncorrupted.
3. Sectors after the written region are zero.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Kevin Wolf 2547caa169 qemu-iotests: improve test for qemu-img convert with backing file
Additionally to testing the qemu-img convert -B option, also test
-o backing_file.

Also, the old test acidentlly used a pattern of zeros for most of the writes,
so that the allocation test didn't really work out. This is fixed by using an
explicit pattern.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Kevin Wolf 72bb202583 qemu-iotests: consider more cases in parsing qemu-io output
I got a bug report with test output diffs like this:

-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+4 KiB, 1 ops; 0.0000 sec (inf EiB/sec and inf ops/sec)

This patch extends the regular expression to consider terabytes, petabytes and
exabytes, and to allow inf as value for the throughput.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Kevin Wolf 52280eac0d qemu-iotests: qcow2 error path tests
This adds test cases for qcow2 error paths (using blkdebug)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Kevin Wolf d586bc63c1 qemu-iotests: improve rebase test
The old test didn't consider cases in which the COW files contains some
unallocated clusters and after them allocated ones again.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Stefan Hajnoczi 596f4f961c qemu-iotests: test bdrv_truncate
This patch adds an image resize grow test to ensure that existing data
is not lost during grow and new space is zeroed.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Stefan Hajnoczi 908eaf6802 qemu-iotests: explicitly use bash interpreter
The tests use bash language features like 'let', which aren't supported
by /bin/sh on systems that use a conservative shell like dash.  This
patch changes the interpreter to /bin/bash.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Kevin Wolf 939e16407b qemu-iotests: test qemu-img rebase
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:03 +01:00
Kevin Wolf ac5e2b201b qemu-iotests: test larger clusters sizes on qcow2
This patch adds test case 023 which tests some more cluster sizes. For
anythinger larger than 4k clusters we can't use requests that are l2_size or
more (128k for 1k clusters, 2 MB for 4k clusters, 512 MB for 64k clusters).
Therefore one of the common.pattern cases is changed and needs new expected
results for some old test cases.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Kevin Wolf 3da9c8fb02 qemu-iotests: 019: Make cluster size dynamic
Change the offsets for test requests according to CLUSTER_SIZE.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Kevin Wolf 8fc1024cee qemu-iotests: align test requests according to cluster size
Change the io_test and io_test2 functions to take the cluster size of the image
and the number of test requests to issue. Tests are changed to specify a
cluster size (usually 4k), but expected test results stay the same for now
(apart from qemu-img printing the cluster size now).

Based on a patch written by Christoph Hellwig.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Stefan Weil 3b5fe6e60c qemu-iotests: add support for vdi format "static" option
VDI supports an image option 'static'.
Ignore "static=off" from qemu-img output.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Kevin Wolf f00851a10f qemu-iotests: fix expected result for 019 after qemu-io change
The output of the alloc command in qemu-io has changed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Kevin Wolf e90292125c qemu-iotests: test bdrv_load/save_vmstate
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Kevin Wolf 9c9afe576f qemu-iotests: common.pattern: allow spaces in io() operation
We need to be able to pass "write -b" as an operation to the pattern testing
functions. Unfortunately, this contains a space character...

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Christoph Hellwig 713d76e82c qemu-iotests: test invalid pattern argument handling in qemu-io
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
2012-02-22 16:17:02 +01:00
Christoph Hellwig e8c212d682 qemu-iotests: replace FSF postal addresses with www.gnu.org links
Blue Swirl notices that we were using the old FSF post address in the
license boilerplates.  Replace both the old and new address with links
to the gnu.org licenses homepage as suggested by Ben Pfaff.

Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Kevin Wolf ed4dc684b2 qemu-iotests: test commiting changes to backing file
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Kevin Wolf 9128ae5e61 qemu-iotests: test qemu-img convert with backing file for the output image
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Kevin Wolf 1670140005 qemu-iotests: test merge of backing file when converting
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Kevin Wolf 2557d8655d qemu-iotests: simple backing file test
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Christoph Hellwig 4bacf0576f qemu-iotests: test I/O after EOF for growable files
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviwed-by: Kevin Wolf <kwolf@redhat.com>
2012-02-22 16:17:02 +01:00
Stefan Weil c83f64d498 qemu-iotests: fix pattern for write test
The write pattern value 0axb is invalid and evaluates to 0,
so the read check (which uses a correct value of 0xab) will fail.

This failure will only be detected with a separate patch for
qemu-io. Without it, qemu-io cannot interpret hex values
and always uses a pattern value of 0.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:02 +01:00
Christoph Hellwig e76a8e893d qemu-iotests: make a few more tests generic
Pretend that a non-implemented check is always successful and thus allow
various tests that were qcow2-specific before to be generic.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
2012-02-22 16:17:01 +01:00
Christoph Hellwig e021915abd qemu-iotests: remove test image after 015 is done
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:01 +01:00
Christoph Hellwig b67f306864 qemu-iotests: add support for the vdi image format
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:01 +01:00
Kevin Wolf 3778057d60 qemu-iotests: add test for refcount table growth and snapshots
015: Combined test to grow the refcount table and test snapshots.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-22 16:17:01 +01:00
Christoph Hellwig 5d9c577dd1 qemu-iotests: skip test 005 for vpc format images
The vpc format doesn't support large enough image size for this test.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-22 16:16:59 +01:00
Christoph Hellwig 6bf19c94a0 qemu-iotests: Initial import into the public repository.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-22 16:15:22 +01:00
Paolo Bonzini 2d7799f2cc qapi: add tests for string-based visitors
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-21 10:21:05 +01:00
Max Filippov e7dfa64def target-xtensa: add breakpoint tests
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2012-02-20 20:07:12 +04:00
Stefan Weil 3c941c613a tests: Silence gtester in Makefile
This prettifies make output a little by avoiding a very long line.
As gtester prints the checks when they are run, no information is lost.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-01-19 08:14:33 +00:00
Edgar E. Iglesias bee5a5fb11 cris: Update paths to match the move of tests/cris
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2012-01-13 11:09:56 +01:00
Anthony Liguori ad65aa882c test: eliminate libcheck tests and have make check use gtester
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-12 10:34:11 -06:00
Anthony Liguori dbfe06c62c build: split unit test builds to a separate makefile fragment
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-12 10:05:37 -06:00
Anthony Liguori c09015dd04 tests: mv tests/* -> tests/tcg
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-12 10:03:28 -06:00
Chen Wei-Ren e4aeadcb56 tests/qruncom.c: Remove libqemu.a example
Remove libqemu example since libqemu.a is not available anymore.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-09 10:10:03 +00:00
Chen Wei-Ren e7764a4658 tests/Makefile: Remove qruncom target
Remove qruncom target from the Makefile file.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-09 10:09:51 +00:00