mirror of https://gitee.com/openkylin/qemu.git
QOM infrastructure fixes and device conversions
* Documentation update * qom-test and related fixes -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABAgAGBQJWYdNvAAoJEPou0S0+fgE/uroP/0I96lSIBzxmnw1WIXZgpDKF 6y1sVEIEDAhkfWQkSOzvCZ0Er0rdh8621P5Jhj9707NMfK7271SocZK6N26ajECp FupZ+ZixKenMjGgTPJfsIVdzgxgA84O8D6DL6hOT3xK97viRGsomcaBUtQkJ1ASH HXjRCWHM006Q8DIMn9nPgDXCm+fr4EdXzARdpof5T074EBHunj3JLSL/MflqGxKT zC/KQ0sryZlrQaWJqfwj4VcjIkUROlJzuCt3XrVzQqwq7rhu5MBaXCApRD+jcMXI GnLZZUkW+/hLlDqnN5e4ARqXFIsf7Ugi6art5Bzwr5VlSGkf/Ts9UxAuOIW4fQoT D9pvHn+LdKlmLBP+7HYkWBZRZx8P+I01AoppG1hvjNZ9vhVtSteZrLPr/B5YnySZ XA6TRdFnXmWg0i8fzBDWQLLiNSDXtCW3GSg1uSQeWBbUsYi6HZ88yCbiesiQXVPh KqYYMF0lioAF5kp48Stw8rXs49jhZ1I3cTQ+2OKuUDXuEOaPKiRMUpF2mXZjn0Is 37fWJzGEUWirjfGN2AuhFpv/EtTbXd2TO4OeyAPy74D1eNv/iARqsFeQ+oxMZWVp 5POt6Hur1a5u+08J5lrtFxpCaj/d7w4ShgTsuGuk6tLgnU1VB/3kuCZzXfxOAVrX Nh9lmq9BiqI85KA1oWVD =LRWp -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging QOM infrastructure fixes and device conversions * Documentation update * qom-test and related fixes # gpg: Signature made Fri 04 Dec 2015 17:54:55 GMT using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-devices-for-peter: qom-test: Fix qmp() leaks tests: Use proper functions types instead of void (*fn) qom: Update documentation comment of struct Object tests: Fix check-report-qtest-% target Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
a5582eac15
|
@ -394,9 +394,6 @@ struct ObjectClass
|
|||
* As a result, #Object contains a reference to the objects type as its
|
||||
* first member. This allows identification of the real type of the object at
|
||||
* run time.
|
||||
*
|
||||
* #Object also contains a list of #Interfaces that this object
|
||||
* implements.
|
||||
*/
|
||||
struct Object
|
||||
{
|
||||
|
|
|
@ -612,7 +612,7 @@ $(patsubst %, check-%, $(check-unit-y)): check-%: %
|
|||
$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
|
||||
$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
|
||||
QTEST_QEMU_IMG=qemu-img$(EXESUF) \
|
||||
gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
|
||||
gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER $@")
|
||||
|
||||
check-report-unit.xml: $(check-unit-y)
|
||||
$(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
|
||||
|
@ -660,7 +660,7 @@ check: check-qapi-schema check-unit check-qtest
|
|||
check-clean:
|
||||
$(MAKE) -C tests/tcg clean
|
||||
rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
|
||||
rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)))
|
||||
rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
|
||||
|
||||
clean: check-clean
|
||||
|
||||
|
|
|
@ -593,12 +593,12 @@ static void test_flush_nodev(void)
|
|||
ide_test_quit();
|
||||
}
|
||||
|
||||
static void test_pci_retry_flush(const char *machine)
|
||||
static void test_pci_retry_flush(void)
|
||||
{
|
||||
test_retry_flush("pc");
|
||||
}
|
||||
|
||||
static void test_isa_retry_flush(const char *machine)
|
||||
static void test_isa_retry_flush(void)
|
||||
{
|
||||
test_retry_flush("isapc");
|
||||
}
|
||||
|
|
|
@ -110,6 +110,11 @@ static void kill_qemu(QTestState *s)
|
|||
}
|
||||
}
|
||||
|
||||
static void kill_qemu_hook_func(void *s)
|
||||
{
|
||||
kill_qemu(s);
|
||||
}
|
||||
|
||||
static void sigabrt_handler(int signo)
|
||||
{
|
||||
g_hook_list_invoke(&abrt_hooks, FALSE);
|
||||
|
@ -133,7 +138,7 @@ static void cleanup_sigabrt_handler(void)
|
|||
sigaction(SIGABRT, &sigact_old, NULL);
|
||||
}
|
||||
|
||||
void qtest_add_abrt_handler(void (*fn), const void *data)
|
||||
void qtest_add_abrt_handler(GHookFunc fn, const void *data)
|
||||
{
|
||||
GHook *hook;
|
||||
|
||||
|
@ -170,7 +175,7 @@ QTestState *qtest_init(const char *extra_args)
|
|||
sock = init_socket(socket_path);
|
||||
qmpsock = init_socket(qmp_socket_path);
|
||||
|
||||
qtest_add_abrt_handler(kill_qemu, s);
|
||||
qtest_add_abrt_handler(kill_qemu_hook_func, s);
|
||||
|
||||
s->qemu_pid = fork();
|
||||
if (s->qemu_pid == 0) {
|
||||
|
@ -755,14 +760,15 @@ void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size)
|
|||
g_strfreev(args);
|
||||
}
|
||||
|
||||
void qtest_add_func(const char *str, void (*fn))
|
||||
void qtest_add_func(const char *str, void (*fn)(void))
|
||||
{
|
||||
gchar *path = g_strdup_printf("/%s/%s", qtest_get_arch(), str);
|
||||
g_test_add_func(path, fn);
|
||||
g_free(path);
|
||||
}
|
||||
|
||||
void qtest_add_data_func(const char *str, const void *data, void (*fn))
|
||||
void qtest_add_data_func(const char *str, const void *data,
|
||||
void (*fn)(const void *))
|
||||
{
|
||||
gchar *path = g_strdup_printf("/%s/%s", qtest_get_arch(), str);
|
||||
g_test_add_data_func(path, data, fn);
|
||||
|
|
|
@ -416,7 +416,7 @@ const char *qtest_get_arch(void);
|
|||
* The path is prefixed with the architecture under test, as
|
||||
* returned by qtest_get_arch().
|
||||
*/
|
||||
void qtest_add_func(const char *str, void (*fn));
|
||||
void qtest_add_func(const char *str, void (*fn)(void));
|
||||
|
||||
/**
|
||||
* qtest_add_data_func:
|
||||
|
@ -428,7 +428,8 @@ void qtest_add_func(const char *str, void (*fn));
|
|||
* The path is prefixed with the architecture under test, as
|
||||
* returned by qtest_get_arch().
|
||||
*/
|
||||
void qtest_add_data_func(const char *str, const void *data, void (*fn));
|
||||
void qtest_add_data_func(const char *str, const void *data,
|
||||
void (*fn)(const void *));
|
||||
|
||||
/**
|
||||
* qtest_add:
|
||||
|
@ -450,7 +451,7 @@ void qtest_add_data_func(const char *str, const void *data, void (*fn));
|
|||
g_free(path); \
|
||||
} while (0)
|
||||
|
||||
void qtest_add_abrt_handler(void (*fn), const void *data);
|
||||
void qtest_add_abrt_handler(GHookFunc fn, const void *data);
|
||||
|
||||
/**
|
||||
* qtest_start:
|
||||
|
|
|
@ -47,7 +47,7 @@ static bool is_blacklisted(const char *arch, const char *mach)
|
|||
static void test_properties(const char *path, bool recurse)
|
||||
{
|
||||
char *child_path;
|
||||
QDict *response, *tuple;
|
||||
QDict *response, *tuple, *tmp;
|
||||
QList *list;
|
||||
QListEntry *entry;
|
||||
|
||||
|
@ -57,6 +57,7 @@ static void test_properties(const char *path, bool recurse)
|
|||
g_assert(response);
|
||||
|
||||
if (!recurse) {
|
||||
QDECREF(response);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -75,14 +76,16 @@ static void test_properties(const char *path, bool recurse)
|
|||
} else {
|
||||
const char *prop = qdict_get_str(tuple, "name");
|
||||
g_test_message("Testing property %s.%s", path, prop);
|
||||
response = qmp("{ 'execute': 'qom-get',"
|
||||
" 'arguments': { 'path': %s,"
|
||||
" 'property': %s } }",
|
||||
path, prop);
|
||||
tmp = qmp("{ 'execute': 'qom-get',"
|
||||
" 'arguments': { 'path': %s,"
|
||||
" 'property': %s } }",
|
||||
path, prop);
|
||||
/* qom-get may fail but should not, e.g., segfault. */
|
||||
g_assert(response);
|
||||
g_assert(tmp);
|
||||
QDECREF(tmp);
|
||||
}
|
||||
}
|
||||
QDECREF(response);
|
||||
}
|
||||
|
||||
static void test_machine(gconstpointer data)
|
||||
|
@ -98,9 +101,11 @@ static void test_machine(gconstpointer data)
|
|||
|
||||
response = qmp("{ 'execute': 'quit' }");
|
||||
g_assert(qdict_haskey(response, "return"));
|
||||
QDECREF(response);
|
||||
|
||||
qtest_end();
|
||||
g_free(args);
|
||||
g_free((void *)machine);
|
||||
}
|
||||
|
||||
static void add_machine_test_cases(void)
|
||||
|
@ -129,10 +134,12 @@ static void add_machine_test_cases(void)
|
|||
mname = qstring_get_str(qstr);
|
||||
if (!is_blacklisted(arch, mname)) {
|
||||
path = g_strdup_printf("qom/%s", mname);
|
||||
qtest_add_data_func(path, mname, test_machine);
|
||||
qtest_add_data_func(path, g_strdup(mname), test_machine);
|
||||
}
|
||||
}
|
||||
|
||||
qtest_end();
|
||||
QDECREF(response);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
|
|
@ -173,8 +173,9 @@ static void wait_for_fds(TestServer *s)
|
|||
g_mutex_unlock(&s->data_mutex);
|
||||
}
|
||||
|
||||
static void read_guest_mem(TestServer *s)
|
||||
static void read_guest_mem(const void *data)
|
||||
{
|
||||
TestServer *s = (void *)data;
|
||||
uint32_t *guest_mem;
|
||||
int i, j;
|
||||
size_t size;
|
||||
|
|
Loading…
Reference in New Issue