File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 88
99#include "qemu/osdep.h"
1010#include "libqtest.h"
11+ #include "standard-headers/linux/virtio_balloon.h"
1112
1213/*
1314 * https://gitlab.com/qemu-project/qemu/-/issues/2576
@@ -26,11 +27,30 @@ static void oss_fuzz_71649(void)
2627 qtest_quit (s );
2728}
2829
30+ static void query_stats (void )
31+ {
32+ QTestState * s = qtest_init ("-device virtio-balloon,id=balloon"
33+ " -nodefaults" );
34+ QDict * ret = qtest_qmp_assert_success_ref (
35+ s ,
36+ "{ 'execute': 'qom-get', 'arguments': " \
37+ "{ 'path': '/machine/peripheral/balloon', " \
38+ " 'property': 'guest-stats' } }" );
39+ QDict * stats = qdict_get_qdict (ret , "stats" );
40+
41+ /* We expect 1 entry in the dict for each known kernel stat */
42+ assert (qdict_size (stats ) == VIRTIO_BALLOON_S_NR );
43+
44+ qobject_unref (ret );
45+ qtest_quit (s );
46+ }
47+
2948int main (int argc , char * * argv )
3049{
3150 g_test_init (& argc , & argv , NULL );
3251
3352 qtest_add_func ("virtio-balloon/oss_fuzz_71649" , oss_fuzz_71649 );
53+ qtest_add_func ("virtio-balloon/query-stats" , query_stats );
3454
3555 return g_test_run ();
3656}
You can’t perform that action at this time.
0 commit comments