]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemumonitorjsontest: Add infrastructure for generated tests of deprecated commands
authorPeter Krempa <pkrempa@redhat.com>
Wed, 29 Apr 2020 17:41:38 +0000 (19:41 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 20 May 2020 06:53:29 +0000 (08:53 +0200)
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: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemumonitorjsontest.c

index fce88083b931b00f3157e8cf99d89a95a65984e3..33bad45b96c3a01174e5175875ca57256ee27933 100644 (file)
@@ -46,6 +46,8 @@ struct _testQemuMonitorJSONSimpleFuncData {
     virDomainXMLOptionPtr xmlopt;
     const char *reply;
     virHashTablePtr schema;
+    bool allowDeprecated;
+    bool allowRemoved;
 };
 
 typedef struct _testGenericData testGenericData;
@@ -1278,6 +1280,9 @@ testQemuMonitorJSON ## funcName(const void *opaque) \
  \
     if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema))) \
         return -1; \
+ \
+    if (data->allowDeprecated) \
+        qemuMonitorTestSkipDeprecatedValidation(test, data->allowRemoved); \
  \
     if (!reply) \
         reply = "{\"return\":{}}"; \
@@ -3121,13 +3126,19 @@ mymain(void)
     if (virTestRun(# FNC, testQemuMonitorJSONSimpleFunc, &simpleFunc) < 0) \
         ret = -1
 
-#define DO_TEST_GEN(name, ...) \
+#define DO_TEST_GEN_FULL(name, dpr, rmvd, ...) \
     simpleFunc = (testQemuMonitorJSONSimpleFuncData) {.xmlopt = driver.xmlopt, \
+                                                      .allowDeprecated = dpr, \
+                                                      .allowRemoved = rmvd, \
                                                       .schema = qapiData.schema \
                                                      __VA_ARGS__ }; \
     if (virTestRun(# name, testQemuMonitorJSON ## name, &simpleFunc) < 0) \
         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) \
     do { \
         struct testCPUData data = { name, driver.xmlopt, qapiData.schema }; \