Skip to contentSkip to conversation

qtest patches

GIT PULL Applied Thomas Huth 2 participants 5 messages Nov 20, 2018

lore
Share & tools
lore
#0 lore raw

Hi Peter,

the following changes since commit d304cf014bf9feec3dcd7ee65c75a7f52206ecdf:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20181119' into staging (2018-11-19 15:58:17 +0000)

are available in the git repository at:

https://gitlab.com/huth/qemu.git tags/pull-request-2018-11-20

for you to fetch changes up to ced09f9b07e425690d3bfe524cf93c4dbf4b26bc:

qtest: log QEMU command line (2018-11-20 10:49:12 +0100)

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

Marc-André Lureau (1):
tests: add qmp/missing-any-arg test

Paolo Bonzini (1):
qtest: log QEMU command line

Thomas Huth (1):
tests/ide: Free pcibus when finishing a test

 tests/ide-test.c |  4 ++++
 tests/libqtest.c | 26 +++++++++++++++-----------
 tests/qmp-test.c | 14 ++++++++++++++
 3 files changed, 33 insertions(+), 11 deletions(-)

Marc-André Lureau (1):
tests: add qmp/missing-any-arg test

Paolo Bonzini (1):
qtest: log QEMU command line

Thomas Huth (1):
tests/ide: Free pcibus when finishing a test

 tests/ide-test.c |  4 ++++
 tests/libqtest.c | 26 +++++++++++++++-----------
 tests/qmp-test.c | 14 ++++++++++++++
 3 files changed, 33 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

[Qemu-devel] [PULL 1/3] tests: add qmp/missing-any-arg test

From: Marc-André Lureau <[email protected]>

test_qmp_missing_any_arg() is about a bug in infrastructure used by the QMP core, fixed in commit c489780203. We covered the bug in infrastructure unit tests (commit bce3035a44). Let's test it at the QMP level as well.

[thuth: Tweaked the commit message according to Markus' suggestion]
---
 tests/qmp-test.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
tests/qmp-test.c +14 -0
index 6c419f6..7517be4 100644
@@ -318,6 +318,19 @@ static void test_qmp_preconfig(void)
     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[])
 {
     g_test_init(&argc, &argv, NULL);
@@ -325,6 +338,7 @@ int main(int argc, char *argv[])
     qtest_add_func("qmp/protocol", test_qmp_protocol);
     qtest_add_func("qmp/oob", test_qmp_oob);
     qtest_add_func("qmp/preconfig", test_qmp_preconfig);
+    qtest_add_func("qmp/missing-any-arg", test_qmp_missing_any_arg);
 
     return g_test_run();
 }
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL 2/3] tests/ide: Free pcibus when finishing a test

In reply to Thomas Huth

Once a test has finished, the pcibus structure should be freed, to avoid leaking memory and to make sure that the structure is properly re-initialized when the next test starts.

---
 tests/ide-test.c | 4 ++++
 1 file changed, 4 insertions(+)
tests/ide-test.c +4 -0
index 33cef61..f0280e6 100644
@@ -142,6 +142,10 @@ static void ide_test_start(const char *cmdline_fmt, ...)
 
 static void ide_test_quit(void)
 {
+    if (pcibus) {
+        qpci_free_pc(pcibus);
+        pcibus = NULL;
+    }
     pc_alloc_uninit(guest_malloc);
     guest_malloc = NULL;
     qtest_end();
Signature · 1 line
1.8.3.1
#3 lore raw

[Qemu-devel] [PULL 3/3] qtest: log QEMU command line

In reply to Thomas Huth

From: Paolo Bonzini <[email protected]>

Record the command line that was used to start QEMU. This can be useful for debugging.

[thuth: removed trailing \n from the message string]
---
 tests/libqtest.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)
tests/libqtest.c +15 -11
index 44ce118..75e07e1 100644
@@ -215,24 +215,28 @@ QTestState *qtest_init_without_qmp_handshake(bool use_oob,
 
     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();
     if (s->qemu_pid == 0) {
         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);
         exit(1);
     }
 
+    g_free(command);
     s->fd = socket_accept(sock);
     if (s->fd >= 0) {
         s->qmp_fd = socket_accept(qmpsock);
Signature · 1 line
1.8.3.1
#4 lore raw
In reply to Thomas Huth
Quoted 12 lines · Thomas Huth

Hi Peter,

the following changes since commit d304cf014bf9feec3dcd7ee65c75a7f52206ecdf:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20181119' into staging (2018-11-19 15:58:17 +0000)

are available in the git repository at:

https://gitlab.com/huth/qemu.git tags/pull-request-2018-11-20

for you to fetch changes up to ced09f9b07e425690d3bfe524cf93c4dbf4b26bc:

Quoted 8 lines

qtest: log QEMU command line (2018-11-20 10:49:12 +0100)

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

Applied, thanks.

-- PMM