提交 3c035a41 编写于 作者: P Peter Maydell

Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2018-11-20' into staging

- One additional simple qmp-test
- A fix for ide-test
- Add logging of QEMU parameters in libqtest

# gpg: Signature made Tue 20 Nov 2018 10:47:12 GMT
# gpg:                using RSA key 2ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>"
# gpg:                 aka "Thomas Huth <thuth@redhat.com>"
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>"
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>"
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2018-11-20:
  qtest: log QEMU command line
  tests/ide: Free pcibus when finishing a test
  tests: add qmp/missing-any-arg test
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
...@@ -142,6 +142,10 @@ static void ide_test_start(const char *cmdline_fmt, ...) ...@@ -142,6 +142,10 @@ static void ide_test_start(const char *cmdline_fmt, ...)
static void ide_test_quit(void) static void ide_test_quit(void)
{ {
if (pcibus) {
qpci_free_pc(pcibus);
pcibus = NULL;
}
pc_alloc_uninit(guest_malloc); pc_alloc_uninit(guest_malloc);
guest_malloc = NULL; guest_malloc = NULL;
qtest_end(); qtest_end();
......
...@@ -215,24 +215,28 @@ QTestState *qtest_init_without_qmp_handshake(bool use_oob, ...@@ -215,24 +215,28 @@ QTestState *qtest_init_without_qmp_handshake(bool use_oob,
qtest_add_abrt_handler(kill_qemu_hook_func, s); qtest_add_abrt_handler(kill_qemu_hook_func, s);
command = g_strdup_printf("exec %s "
"-qtest unix:%s,nowait "
"-qtest-log %s "
"-chardev socket,path=%s,nowait,id=char0 "
"-mon chardev=char0,mode=control%s "
"-machine accel=qtest "
"-display none "
"%s", qemu_binary, socket_path,
getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null",
qmp_socket_path, use_oob ? ",x-oob=on" : "",
extra_args ?: "");
g_test_message("starting QEMU: %s", command);
s->qemu_pid = fork(); s->qemu_pid = fork();
if (s->qemu_pid == 0) { if (s->qemu_pid == 0) {
setenv("QEMU_AUDIO_DRV", "none", true); setenv("QEMU_AUDIO_DRV", "none", true);
command = g_strdup_printf("exec %s "
"-qtest unix:%s,nowait "
"-qtest-log %s "
"-chardev socket,path=%s,nowait,id=char0 "
"-mon chardev=char0,mode=control%s "
"-machine accel=qtest "
"-display none "
"%s", qemu_binary, socket_path,
getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null",
qmp_socket_path, use_oob ? ",x-oob=on" : "",
extra_args ?: "");
execlp("/bin/sh", "sh", "-c", command, NULL); execlp("/bin/sh", "sh", "-c", command, NULL);
exit(1); exit(1);
} }
g_free(command);
s->fd = socket_accept(sock); s->fd = socket_accept(sock);
if (s->fd >= 0) { if (s->fd >= 0) {
s->qmp_fd = socket_accept(qmpsock); s->qmp_fd = socket_accept(qmpsock);
......
...@@ -318,6 +318,19 @@ static void test_qmp_preconfig(void) ...@@ -318,6 +318,19 @@ static void test_qmp_preconfig(void)
qtest_quit(qs); qtest_quit(qs);
} }
static void test_qmp_missing_any_arg(void)
{
QTestState *qts;
QDict *resp;
qts = qtest_init(common_args);
resp = qtest_qmp(qts, "{'execute': 'qom-set', 'arguments':"
" { 'path': '/machine', 'property': 'rtc-time' } }");
g_assert_nonnull(resp);
qmp_assert_error_class(resp, "GenericError");
qtest_quit(qts);
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
g_test_init(&argc, &argv, NULL); g_test_init(&argc, &argv, NULL);
...@@ -325,6 +338,7 @@ int main(int argc, char *argv[]) ...@@ -325,6 +338,7 @@ int main(int argc, char *argv[])
qtest_add_func("qmp/protocol", test_qmp_protocol); qtest_add_func("qmp/protocol", test_qmp_protocol);
qtest_add_func("qmp/oob", test_qmp_oob); qtest_add_func("qmp/oob", test_qmp_oob);
qtest_add_func("qmp/preconfig", test_qmp_preconfig); qtest_add_func("qmp/preconfig", test_qmp_preconfig);
qtest_add_func("qmp/missing-any-arg", test_qmp_missing_any_arg);
return g_test_run(); return g_test_run();
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册