File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -543,19 +543,33 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
543
543
return qtest_init_internal (qtest_qemu_binary (NULL ), extra_args );
544
544
}
545
545
546
- QTestState * qtest_init_with_env (const char * var , const char * extra_args )
546
+ QTestState * qtest_init_with_env_and_capabilities (const char * var ,
547
+ const char * extra_args ,
548
+ QList * capabilities )
547
549
{
548
550
QTestState * s = qtest_init_internal (qtest_qemu_binary (var ), extra_args );
549
551
QDict * greeting ;
550
552
551
553
/* Read the QMP greeting and then do the handshake */
552
554
greeting = qtest_qmp_receive (s );
553
555
qobject_unref (greeting );
554
- qobject_unref (qtest_qmp (s , "{ 'execute': 'qmp_capabilities' }" ));
556
+ if (capabilities ) {
557
+ qtest_qmp_assert_success (s ,
558
+ "{ 'execute': 'qmp_capabilities', "
559
+ "'arguments': { 'enable': %p } }" ,
560
+ qobject_ref (capabilities ));
561
+ } else {
562
+ qtest_qmp_assert_success (s , "{ 'execute': 'qmp_capabilities' }" );
563
+ }
555
564
556
565
return s ;
557
566
}
558
567
568
+ QTestState * qtest_init_with_env (const char * var , const char * extra_args )
569
+ {
570
+ return qtest_init_with_env_and_capabilities (var , extra_args , NULL );
571
+ }
572
+
559
573
QTestState * qtest_init (const char * extra_args )
560
574
{
561
575
return qtest_init_with_env (NULL , extra_args );
Original file line number Diff line number Diff line change 19
19
20
20
#include "qapi/qmp/qobject.h"
21
21
#include "qapi/qmp/qdict.h"
22
+ #include "qapi/qmp/qlist.h"
22
23
#include "libqmp.h"
23
24
24
25
typedef struct QTestState QTestState ;
@@ -68,6 +69,22 @@ QTestState *qtest_init(const char *extra_args);
68
69
*/
69
70
QTestState * qtest_init_with_env (const char * var , const char * extra_args );
70
71
72
+ /**
73
+ * qtest_init_with_env_and_capabilities:
74
+ * @var: Environment variable from where to take the QEMU binary
75
+ * @extra_args: Other arguments to pass to QEMU. CAUTION: these
76
+ * arguments are subject to word splitting and shell evaluation.
77
+ * @capabilities: list of QMP capabilities (strings) to enable
78
+ *
79
+ * Like qtest_init_with_env(), but enable specified capabilities during
80
+ * hadshake.
81
+ *
82
+ * Returns: #QTestState instance.
83
+ */
84
+ QTestState * qtest_init_with_env_and_capabilities (const char * var ,
85
+ const char * extra_args ,
86
+ QList * capabilities );
87
+
71
88
/**
72
89
* qtest_init_without_qmp_handshake:
73
90
* @extra_args: other arguments to pass to QEMU. CAUTION: these
You can’t perform that action at this time.
0 commit comments