qom-test: Test QOM properties
PATCH 1/1 qom-test: Test QOM properties
Recursively walk all properties under /machine and try to retrieve their value. This is a regression test for link<> properties.
Cf. be2f78b6b062eec5170e2612299fb8953046993f
--- tests/qom-test.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
tests/qom-test.c +38 -0
@@ -10,6 +10,7 @@#include <glib.h> #include <string.h> +#include "qemu-common.h" #include "qemu/osdep.h" #include "qapi/qmp/types.h"
@@ -42,6 +43,39 @@ static bool is_blacklisted(const char *arch, const char *mach)return false; } +static void test_properties (const char *path) +{ +char *cmd, *child_path; +QDict *response, *tuple; +QList *list; +QListEntry *entry; + + cmd =g_strdup_printf ("{ 'execute': 'qom-list'," +" 'arguments': { 'path': '%s' } }" , path); + response =qmp (cmd); +g_free (cmd); + +g_assert (qdict_haskey (response,"return" )); + list =qobject_to_qlist (qdict_get (response,"return" )); + QLIST_FOREACH_ENTRY(list, entry) { + tuple =qobject_to_qdict (qlist_entry_obj (entry)); +if (strstart (qdict_get_str (tuple,"type" ),"child<" ,NULL )) { + child_path =g_strdup_printf ("%s/%s" , + path,qdict_get_str (tuple,"name" )); +test_properties (child_path); +g_free (child_path); + }else { + cmd =g_strdup_printf ("{ 'execute': 'qom-get'," +" 'arguments': { 'path': '%s'," +" 'property': '%s' } }" , + path,qdict_get_str (tuple,"name" )); + response =qmp (cmd); +g_free (cmd); +/* This may fail but should not, e.g., segfault. */ + } + } +} +static void test_machine (gconstpointer data) {const char *machine = data;
@@ -50,8 +84,12 @@ static void test_machine(gconstpointer data) args =g_strdup_printf ("-machine %s" , machine);qtest_start (args); + +test_properties ("/machine" ); + response =qmp ("{ 'execute': 'quit' }" );g_assert (qdict_haskey (response,"return" )); +qtest_end ();g_free (args); }
Signature · 1 line
1.8.4.5
Am 07.02.2014 15:39, schrieb Andreas Färber:
Quoted 9 lines
Recursively walk all properties under /machine and try to retrieve their value. This is a regression test for link<> properties.
Cf.
be2f78b6b062eec5170e2612299fb8953046993fSigned-off-by Andreas Färber <[email protected]>--- tests/qom-test.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
Ping! Since posting this, aarch64 appears to have started failing this test, without the patch it succeeds. Peter, any ideas why?
Thanks,
Andreas
TEST: tests/qom-test... (pid=16456)
/aarch64/qom/versatilepb:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02Sbe5546e997cdd42c8c2ab864ce478a29 (pid=16461)
/aarch64/qom/borzoi:
Broken pipe
FAIL
GTester: last random seed: R02S802158587527baf252b66ffed0b0e6a2 (pid=16465)
/aarch64/qom/virt:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02S6d99aeca817c17274c155818ce2efd40 (pid=16469)
/aarch64/qom/midway:
Broken pipe
FAIL
GTester: last random seed: R02Sff251ddc27d5d47988b447c07dc213e5 (pid=16473)
/aarch64/qom/none: OK
/aarch64/qom/cheetah:
Broken pipe
FAIL
GTester: last random seed: R02S638657223c3018d1fc7eb793a1418fb9 (pid=16478)
/aarch64/qom/spitz:
Broken pipe
FAIL
GTester: last random seed: R02S8b5262ceaf6c759df94a4eb8d1241bf9 (pid=16482)
/aarch64/qom/vexpress-a15:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02S6d24006c02f200e3114212b301cc8de9 (pid=16486)
/aarch64/qom/realview-pb-a8:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02Sf101c2f47a576b8249448de219ec9b1f (pid=16490)
/aarch64/qom/collie:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02S7a04cdb86160fe63e6695ec157a0f958 (pid=16494)
/aarch64/qom/n800:
Broken pipe
FAIL
GTester: last random seed: R02S72a2ba2d2d9e060be2d393e96aef3adf (pid=16498)
/aarch64/qom/highbank:
Broken pipe
FAIL
GTester: last random seed: R02Sd3c0a1f2a22c60dfdd74fc9ed8b5cf9f (pid=16502)
/aarch64/qom/kzm:
Broken pipe
FAIL
GTester: last random seed: R02S2d5d0603d452b08344c58a6dee0168b5 (pid=16506)
/aarch64/qom/sx1-v1:
Broken pipe
FAIL
GTester: last random seed: R02S80df0a1557f306ad8a6cd90cc4384ef1 (pid=16510)
/aarch64/qom/integratorcp:
Broken pipe
FAIL
GTester: last random seed: R02Sa0265e95028872f0d2f4d0ce3effdee1 (pid=16514)
/aarch64/qom/smdkc210:
Broken pipe
FAIL
GTester: last random seed: R02S90847dbf1dc6f7c2ebe1813c77990591 (pid=16519)
/aarch64/qom/akita:
Broken pipe
FAIL
GTester: last random seed: R02Sb0990e3cd50a983188b705bd0541ca11 (pid=16523)
/aarch64/qom/canon-a1100:
Broken pipe
FAIL
GTester: last random seed: R02S6d2b6d159a29214320b5ff3139bd597a (pid=16527)
/aarch64/qom/verdex:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02S35e5b9727603df70cf271b4759d5d14c (pid=16531)
/aarch64/qom/realview-eb-mpcore:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02Sfb76d0c7e9941abb5655ffe9ef7cce92 (pid=16535)
/aarch64/qom/nuri:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02Sd5132cbc2c1b364e604eaaa88a1becc0 (pid=16540)
/aarch64/qom/xilinx-zynq-a9:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02Se28a58b786d2946e36f80586ce94a3e1 (pid=16544)
/aarch64/qom/n810:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02S910ce0fde6b6b11093fa44701ca0f9a0 (pid=16548)
/aarch64/qom/terrier:
Broken pipe
FAIL
GTester: last random seed: R02S4e0f91b694d027b30c47304e383428cf (pid=16552)
/aarch64/qom/mainstone:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02Sd6601b61e55a935805397ee1768daf7a (pid=16556)
/aarch64/qom/musicpal:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02Sd4d69e17d45c007cde1ecb02a6d5d414 (pid=16560)
/aarch64/qom/realview-pbx-a9:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02S8079447fb009dd788101cc9ee4fc1b13 (pid=16564)
/aarch64/qom/lm3s6965evb:
Broken pipe
FAIL
GTester: last random seed: R02S1cc35618a26fab4157b76e8501872cac (pid=16568)
/aarch64/qom/vexpress-a9:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02Se6fb9a536823228bae43aa0c1dcb2840 (pid=16572)
/aarch64/qom/cubieboard:
Broken pipe
FAIL
GTester: last random seed: R02S0ba14ac65a9a7ecbe297fc07a8cf0999 (pid=16576)
/aarch64/qom/tosa:
Broken pipe
FAIL
GTester: last random seed: R02Sdf32519c6fc2a47e096848daa0212fef (pid=16580)
/aarch64/qom/realview-eb:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02S98ee72ad0a9fd357b89bb6c02e21ed15 (pid=16584)
/aarch64/qom/sx1:
Broken pipe
FAIL
GTester: last random seed: R02S42f7be4342c6ab29717c392bc9d02e0e (pid=16588)
/aarch64/qom/connex:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02S11cfb1179595ce100482b3e2790a0c31 (pid=16592)
/aarch64/qom/z2:
Broken pipe
FAIL
GTester: last random seed: R02Sc837fb48c120cd95ee6e97151000e0e9 (pid=16596)
/aarch64/qom/lm3s811evb:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02S44a496e98b70fe520c011e18fb42d4e9 (pid=16600)
/aarch64/qom/versatileab:
main-loop: WARNING: I/O thread spun for 1000 iterations Broken pipe
FAIL
GTester: last random seed: R02S00cdba089e9157d927484a294f9e337e (pid=16604)
FAIL: tests/qom-test
make: *** [check-qtest-aarch64] Fehler 1
Quoted 67 lines
tests/qom-test.c +38
-0@@ -10,6 +10,7 @@#include <glib.h> #include <string.h> +#include "qemu-common.h" #include "qemu/osdep.h" #include "qapi/qmp/types.h" @@ -42,6 +43,39 @@ static bool is_blacklisted(const char *arch, const char *mach)return false; } +static void test_properties (const char *path) +{ +char *cmd, *child_path; +QDict *response, *tuple; +QList *list; +QListEntry *entry; + + cmd =g_strdup_printf ("{ 'execute': 'qom-list'," +" 'arguments': { 'path': '%s' } }" , path); + response =qmp (cmd); +g_free (cmd); + +g_assert (qdict_haskey (response,"return" )); + list =qobject_to_qlist (qdict_get (response,"return" )); + QLIST_FOREACH_ENTRY(list, entry) { + tuple =qobject_to_qdict (qlist_entry_obj (entry)); +if (strstart (qdict_get_str (tuple,"type" ),"child<" ,NULL )) { + child_path =g_strdup_printf ("%s/%s" , + path,qdict_get_str (tuple,"name" )); +test_properties (child_path); +g_free (child_path); + }else { + cmd =g_strdup_printf ("{ 'execute': 'qom-get'," +" 'arguments': { 'path': '%s'," +" 'property': '%s' } }" , + path,qdict_get_str (tuple,"name" )); + response =qmp (cmd); +g_free (cmd); +/* This may fail but should not, e.g., segfault. */ + } + } +} +static void test_machine (gconstpointer data) {const char *machine = data;@@ -50,8 +84,12 @@ static void test_machine(gconstpointer data) args =g_strdup_printf ("-machine %s" , machine);qtest_start (args); + +test_properties ("/machine" ); + response =qmp ("{ 'execute': 'quit' }" );g_assert (qdict_haskey (response,"return" )); +qtest_end ();g_free (args); }
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg