summaryrefslogtreecommitdiff
path: root/tests/libqtest.h
AgeCommit message (Collapse)AuthorFilesLines
2014-03-13qtest: Fix crash if SIGABRT during qtest_init()Stefan Hajnoczi1-3/+1
If an assertion fails during qtest_init() the SIGABRT handler is invoked. This is the correct behavior since we need to kill the QEMU process to avoid leaking it when the test dies. The global_qtest pointer used by the SIGABRT handler is currently only assigned after qtest_init() returns. This results in a segfault if an assertion failure occurs during qtest_init(). Move global_qtest assignment inside qtest_init(). Not pretty but let's face it - the signal handler depends on global state. Reported-by: Marcel Apfelbaum <marcel.a@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Tested-by: Marcel Apfelbaum <marcel.a@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13libqtest: Avoid inline varargs functionsPeter Maydell1-18/+2
Older versions of gcc (eg 4.6) can't handle varargs functions declared inline for anything other than completely trivial uses, and complain: tests/qom-test.c: In function 'qmp': tests/libqtest.h:359:60: sorry, unimplemented: function 'qmp' can never be inlined because it uses variable argument lists Avoid this problem by putting the functions into libqtest.c instead of using inline definitions in libqtest.h. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de>
2013-11-07libqtest: add qmp(fmt, ...) -> QDict* functionStefan Hajnoczi1-0/+37
Add a qtest qmp() function that returns the response object. This allows test cases to verify the result or to check for error responses. It also allows waiting for QMP events. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de>
2013-11-07libqtest: rename qmp() to qmp_discard_response()Stefan Hajnoczi1-10/+10
Existing qmp() callers do not expect a response object. In order to implement real QMP test cases it will be necessary to inspect the response object. Rename qmp() to qmp_discard_response(). Later patches will introduce a qmp() function that returns the response object and tests that use it. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de>
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-07-18libqtest: New qtest_end() to go with qtest_start()Markus Armbruster1-0/+12
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 Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-18qtest: Add MMIO supportAndreas Färber1-0/+186
Introduce [qtest_]{read,write}[bwlq]() libqtest functions and corresponding QTest protocol commands to replace local versions in libi2c-omap.c. Also convert m48t59-test's cmos_{read,write}_mmio() to {read,write}b(). Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1361051043-27944-4-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-18libqtest: Introduce qtest_qmpv() and convert remaining macroAndreas Färber1-1/+19
In order to convert qmp() macro to an inline function, expose a qtest_qmpv() function, reused by qtest_qmp(). We can't apply GCC_FMT_ATTR() since fdc-test is using zero-length format strings, which would result in warnings treated as errors. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1361051043-27944-3-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-18libqtest: Convert macros to functions and clean up documentationAndreas Färber1-50/+110
libqtest.h provides a number of shortcut macros to avoid tests feeding it the QTestState they operate on. Most of these can easily be turned into static inline functions, so let's do that for clarity. This avoids getting off-by-one error messages when passing wrong args. Some macros had a val argument but documented @value argument. Fix this. While touching things, enforce gtk-doc markup for return values and for referencing types. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1361051043-27944-2-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-11libqtest: Fix documentation copy&paste errorsAndreas Färber1-6/+0
The [qtest_]in[bwl]() functions/macros don't have a value argument. Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1360604139-16797-1-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-10qtest: Add function to send QMP commandsKevin Wolf1-0/+17
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-03-30qtest: add C version of test infrastructureAnthony Liguori1-0/+335
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>