提交 199cd7a3 编写于 作者: P Peter Krempa

qemumonitorjsontest: Add infrastructure for generated tests of deprecated commands

For sanity-chcecking of deprecated commands which are still used on some
old code paths which used the simple generated test cases add a
mechanism to mark them as deprecated so schema checking can be skipped.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 2700779f
...@@ -46,6 +46,8 @@ struct _testQemuMonitorJSONSimpleFuncData { ...@@ -46,6 +46,8 @@ struct _testQemuMonitorJSONSimpleFuncData {
virDomainXMLOptionPtr xmlopt; virDomainXMLOptionPtr xmlopt;
const char *reply; const char *reply;
virHashTablePtr schema; virHashTablePtr schema;
bool allowDeprecated;
bool allowRemoved;
}; };
typedef struct _testGenericData testGenericData; typedef struct _testGenericData testGenericData;
...@@ -1278,6 +1280,9 @@ testQemuMonitorJSON ## funcName(const void *opaque) \ ...@@ -1278,6 +1280,9 @@ testQemuMonitorJSON ## funcName(const void *opaque) \
\ \
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema))) \ if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema))) \
return -1; \ return -1; \
\
if (data->allowDeprecated) \
qemuMonitorTestSkipDeprecatedValidation(test, data->allowRemoved); \
\ \
if (!reply) \ if (!reply) \
reply = "{\"return\":{}}"; \ reply = "{\"return\":{}}"; \
...@@ -3121,13 +3126,19 @@ mymain(void) ...@@ -3121,13 +3126,19 @@ mymain(void)
if (virTestRun(# FNC, testQemuMonitorJSONSimpleFunc, &simpleFunc) < 0) \ if (virTestRun(# FNC, testQemuMonitorJSONSimpleFunc, &simpleFunc) < 0) \
ret = -1 ret = -1
#define DO_TEST_GEN(name, ...) \ #define DO_TEST_GEN_FULL(name, dpr, rmvd, ...) \
simpleFunc = (testQemuMonitorJSONSimpleFuncData) {.xmlopt = driver.xmlopt, \ simpleFunc = (testQemuMonitorJSONSimpleFuncData) {.xmlopt = driver.xmlopt, \
.allowDeprecated = dpr, \
.allowRemoved = rmvd, \
.schema = qapiData.schema \ .schema = qapiData.schema \
__VA_ARGS__ }; \ __VA_ARGS__ }; \
if (virTestRun(# name, testQemuMonitorJSON ## name, &simpleFunc) < 0) \ if (virTestRun(# name, testQemuMonitorJSON ## name, &simpleFunc) < 0) \
ret = -1 ret = -1
#define DO_TEST_GEN(name, ...) DO_TEST_GEN_FULL(name, false, false, __VA_ARGS__)
#define DO_TEST_GEN_DEPRECATED(name, removed, ...) \
DO_TEST_GEN_FULL(name, true, removed, __VA_ARGS__)
#define DO_TEST_CPU_DATA(name) \ #define DO_TEST_CPU_DATA(name) \
do { \ do { \
struct testCPUData data = { name, driver.xmlopt, qapiData.schema }; \ struct testCPUData data = { name, driver.xmlopt, qapiData.schema }; \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册