Commit Graph

101 Commits

Author SHA1 Message Date
Paolo Bonzini 5f7a74a1a6 tests: adjust gcov variables for directory movement
I had missed the introduction of the gcov-files-* variables.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-01-26 13:10:36 +00:00
Andreas Färber 6e9989034b tests: Add tmp105 qtest test case
Exercise all four commands of the TMP105, testing for an issue in the
I2C TX path.

The test case uses the N800's OMAP I2C and is the first for ARM.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-16 12:14:20 -06:00
Andreas Färber 2bf7b4572b libqtest: Prepare I2C libqos
This adds a simple I2C API and a driver implementation for omap_i2c.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-16 12:14:20 -06:00
Paolo Bonzini ff667e2e9b build: fold trace-obj-y into libqemuutil.a
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:51 +01:00
Paolo Bonzini 576d55068d build: move base QAPI files to libqemuutil.a
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:51 +01:00
Paolo Bonzini 59cacde8cd build: move QAPI definitions for QEMU out of qapi-obj-y
There is no reason why for example qemu-ga should include all the
definitions for the QEMU monitor.  However, there are a few
that are needed (qapi_free_SocketAddress, qapi_free_InetSocketAddress,
ErrorClass_lookup).  These should be moved to a separate "core"
.json schema that goes into libqemuutil.a.

For now, make this clearer by moving the qapi-*.o definitions out
of libqemuutil.a.  Once the above refactoring is done, qga-obj-y
should not include anymore qapi-types.o and qapi-visit.o.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:51 +01:00
Paolo Bonzini a372823a14 build: move qobject files to qobject/ and libqemuutil.a
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:50 +01:00
Paolo Bonzini f157ebba2d build: move files away from tools-obj-y, common-obj-y, user-obj-y
Split them between libqemuutil.a and, for those used by qemu-img/io/nbd,
block-obj-y.

Static libraries ensure that binaries such as qemu-ga do not include
unused modules.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:50 +01:00
Paolo Bonzini 8a090705b4 build: move util-obj-y to libqemuutil.a
Use a static library to eliminate repetition in the linking rules.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:50 +01:00
Paolo Bonzini e4b42e6ebc build: rename oslib-obj-y to util-obj-y
This prepares the creation of libqemuutil.a in the next patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 18:42:50 +01:00
Paolo Bonzini 5708fc6655 stubs: fully replace qemu-tool.c and qemu-user.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-01-12 17:19:08 +01:00
Blue Swirl 1d728c3946 tests: add gcov support
Add support for compiling for GCOV test coverage, enabled
with '--enable-gcov' during configure.

Test coverage will be reported after each test.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-01-06 08:15:08 +00:00
Paolo Bonzini 74c856e922 tests: add thread pool unit tests
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26 09:37:51 -06:00
Paolo Bonzini b2ea25d7ae tests: add AioContext unit tests
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-26 09:37:51 -06:00
Paolo Bonzini 2b84c2be00 tests: link in stubs
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-19 10:48:32 +01:00
Paolo Bonzini 136594f19a build: do not include main loop where it is not actually used
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30 09:30:52 +01:00
Paolo Bonzini 0191253cea janitor: move iovector functions out of cutils.c
This removes the dependency of cutils.c on iov.c, and lets us remove
iov.o from several builds.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30 09:18:42 +01:00
Paolo Bonzini 0ef3dd6c2d tests: do not include tools-obj-y
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23 22:38:41 +02:00
Corey Bryant adb696f3d8 block: Enable qemu_open/close to work with fd sets
When qemu_open is passed a filename of the "/dev/fdset/nnn"
format (where nnn is the fdset ID), an fd with matching access
mode flags will be searched for within the specified monitor
fd set.  If the fd is found, a dup of the fd will be returned
from qemu_open.

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-08-15 13:16:22 +02:00
Eduardo Habkost 14117c7ba1 tests: Makefile: include dependency files
Otherwise 'make check' won't recompile files that need to be recompiled
because of header changes.

To reproduce the bug, run:

 $ make check  # succeeds
 $ echo B0RKED > hw/mc146818rtc_regs.h
 $ make check  # is supposed to try to rebuild tests/rtc-test.o and fail

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-28 09:13:49 +00:00
Markus Armbruster 0e8a8c8f6d qtest: Add hard disk geometry test
So far covers only IDE and tests only CMOS contents.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-07-17 16:48:30 +02:00
Anthony Liguori 23797df3d9 Merge remote-tracking branch 'mjt/mjt-iov2' into staging
* mjt/mjt-iov2:
  rewrite iov_send_recv() and move it to iov.c
  cleanup qemu_co_sendv(), qemu_co_recvv() and friends
  export iov_send_recv() and use it in iov_send() and iov_recv()
  rename qemu_sendv to iov_send, change proto and move declarations to iov.h
  change qemu_iovec_to_buf() to match other to,from_buf functions
  consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent
  allow qemu_iovec_from_buffer() to specify offset from which to start copying
  consolidate qemu_iovec_memset{,_skip}() into single function and use existing iov_memset()
  rewrite iov_* functions
  change iov_* function prototypes to be more appropriate
  virtio-serial-bus: use correct lengths in control_out() message

Conflicts:
	tests/Makefile

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-07-09 12:35:06 -05:00
Michael Roth 2d49610539 qapi: Unit tests for visitor-based serialization
Currently we test our visitors individually, and seperately for input
vs. output. This is useful for validating internal representations
against the native C types and vice-versa, and other visitor-specific
testing, but it doesn't cover the potential use-case of using visitor
pairs for serialization/deserialization very well, and makes it
hard to easily extend the coverage for different C types / boundary
conditions.

To cover that we add a set of unit tests that takes a number of native C
values, passes them into an output visitor, extracts the values with an
input visitor, then compares the result to the original.

Plugging in new visitors to the test harness only requires a user to
implement the SerializeOps interface and add it to a list.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-08 16:11:14 +02:00
Michael Tokarev 2278a69e70 rewrite iov_* functions
This changes implementations of all iov_*
functions, completing the previous step.

All iov_* functions now ensure that this offset
argument is within the iovec (using assertion),
but lets to specify `bytes' value larger than
actual length of the iovec - in this case they
stops at the actual end of iovec.  It is also
suggested to use convinient `-1' value as `bytes'
to mean just this -- "up to the end".

There's one very minor semantic change here: new
requiriment is that `offset' points to inside of
iovec.  This is checked just at the end of functions
(assert()), it does not actually need to be enforced,
but using any of these functions with offset pointing
past the end of iovec is wrong anyway.

Note: the new code in iov.c uses arithmetic with
void pointers.  I thought this is not supported
everywhere and is a GCC extension (indeed, the C
standard does not define void arithmetic).  However,
the original code already use void arith in
iov_from_buf() function:
  (memcpy(..., buf + buf_off,...)
which apparently works well so far (it is this
way in qemu 1.0).  So I left it this way and used
it in other places.

While at it, add a unit-test file test-iov.c,
to check various corner cases with iov_from_buf(),
iov_to_buf() and iov_memset().

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-06-07 21:09:46 +04:00
Paolo Bonzini 4115852bb0 build: do not sprinkle around GENERATED_HEADERS dependencies
Keeping GENERATED_HEADERS dependencies up-to-date everywhere is complex.
We can simply make the Makefile depend on them, and they will be built
before all other targets.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 07:17:26 +02:00
Stefan Weil fba0c40bb7 tests: Add rtc-test (fix test regression)
Commit 93e9eb6808 added fdc-test,
but accidentally removed rtc-test because check-qtest-i386-y was
not enhanced but set twice.

This patch adds rtc-test again (and sorts both tests alphabetically).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-21 15:31:06 -05:00
Stefan Weil fd4567d9a6 tests: Fix linker failure for fdc-test
When QEMU was built with the simple trace backend, linking failed:

  LINK  tests/fdc-test
oslib-posix.o: In function `trace_qemu_memalign':
qemu/bin/debug/x86/./trace.h:31: undefined reference to `trace3'
oslib-posix.o: In function `trace_qemu_vmalloc':
qemu/bin/debug/x86/./trace.h:35: undefined reference to `trace2'
oslib-posix.o: In function `trace_qemu_vfree':
qemu/bin/debug/x86/./trace.h:39: undefined reference to `trace1'
collect2: error: ld returned 1 exit status
make: *** [tests/fdc-test] Fehler 1

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-05-19 15:53:28 +00:00
Kevin Wolf 6c806637fa tests/Makefile: Add missing $(EXESUF)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-05-10 11:01:59 +02:00
Kevin Wolf 93e9eb6808 qtest: Add floppy test
Let's start with testing media change.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-10 10:32:12 +02: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
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
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
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
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
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 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
Michael Walle d65f083146 lm32: opcode testsuite
This patch creates tests/lm32 directory and adds tests for every
LatticeMico32 opcode.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-03-07 13:42:37 +01:00
Paolo Bonzini f9728943ff do not pass bogus $(SRC_PATH) include paths to cc during configure
Non-existent -I paths are dropped silently by the compiler, but still
it is not polite to pass bogus options.  Configure-time tests do not
need any include files from the source path, so only include -I flags
at make time (when they're properly expanded).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-14 16:11:58 +00:00
Paolo Bonzini 2b2e59e6c9 rewrite i386 tests Makefile
1) compute path to i386 compiler from configure.  If it is found, run
the i386 tests.  I use macros so that this approach could be applied
for other arches as well.

2) provide an easily extensible way to add tests

Most tests fail, but at least "make test" does something meaningful.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-23 14:47:13 +00:00
Paolo Bonzini 48118b0205 fix test_path
path.c grew quite a few new dependencies (mostly via cutils.c),
include them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-23 14:47:06 +00:00