]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuMonitorTestAddItemExpect: Remove unused helper
authorPeter Krempa <pkrempa@redhat.com>
Mon, 22 May 2023 14:30:59 +0000 (16:30 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 2 Jun 2023 07:41:25 +0000 (09:41 +0200)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemumonitortestutils.c
tests/qemumonitortestutils.h

index 40ef05727196250cf016f58e43a349960dfa62d8..9e6da78a8b1d9c7c28275db11b66b67de12c4715 100644 (file)
@@ -859,101 +859,6 @@ qemuMonitorTestAddItemParams(qemuMonitorTest *test,
 }
 
 
-static int
-qemuMonitorTestProcessCommandWithArgStr(qemuMonitorTest *test,
-                                        qemuMonitorTestItem *item,
-                                        const char *cmdstr)
-{
-    struct qemuMonitorTestHandlerData *data = item->opaque;
-    g_autoptr(virJSONValue) val = NULL;
-    virJSONValue *args;
-    g_autofree char *argstr = NULL;
-    const char *cmdname;
-
-    if (!(val = virJSONValueFromString(cmdstr)))
-        return -1;
-
-    if (!(cmdname = virJSONValueObjectGetString(val, "execute"))) {
-        qemuMonitorTestError("Missing command name in %s", cmdstr);
-        return -1;
-    }
-
-    if (STRNEQ(data->command_name, cmdname)) {
-        qemuMonitorTestErrorInvalidCommand(data->command_name, cmdname);
-        return -1;
-    }
-
-    if (!(args = virJSONValueObjectGet(val, "arguments"))) {
-        qemuMonitorTestError("Missing arguments section for command '%s'",
-                             data->command_name);
-        return -1;
-    }
-
-    /* convert the arguments to string */
-    if (!(argstr = virJSONValueToString(args, false)))
-        return -1;
-
-    /* verify that the argument value is expected */
-    if (STRNEQ(argstr, data->expectArgs)) {
-        qemuMonitorTestError("%s: expected arguments: '%s', got: '%s'",
-                             data->command_name,
-                             data->expectArgs, argstr);
-        return -1;
-    }
-
-    /* arguments checked out, return the response */
-    return qemuMonitorTestAddResponse(test, data->response);
-}
-
-
-/**
- * qemuMonitorTestAddItemExpect:
- *
- * @test: test monitor object
- * @cmdname: command name
- * @cmdargs: expected arguments of the command
- * @apostrophe: convert apostrophes (') in @cmdargs to quotes (")
- * @response: simulated response of the command
- *
- * Simulates a qemu monitor command. Checks that the 'arguments' of the qmp
- * command are expected. If @apostrophe is true apostrophes are converted to
- * quotes for simplification of writing the strings into code.
- */
-int
-qemuMonitorTestAddItemExpect(qemuMonitorTest *test,
-                             const char *cmdname,
-                             const char *cmdargs,
-                             bool apostrophe,
-                             const char *response)
-{
-    struct qemuMonitorTestHandlerData *data;
-
-    data = g_new0(struct qemuMonitorTestHandlerData, 1);
-
-    data->command_name = g_strdup(cmdname);
-    data->response = g_strdup(response);
-    data->expectArgs = g_strdup(cmdargs);
-
-    if (apostrophe) {
-        char *tmp = data->expectArgs;
-
-        while (*tmp != '\0') {
-            if (*tmp == '\'')
-                *tmp = '"';
-
-            tmp++;
-        }
-    }
-
-    qemuMonitorTestAddHandler(test,
-                              cmdname,
-                              qemuMonitorTestProcessCommandWithArgStr,
-                              data, qemuMonitorTestHandlerDataFree);
-
-    return 0;
-}
-
-
 static void
 qemuMonitorTestEOFNotify(qemuMonitor *mon G_GNUC_UNUSED,
                          virDomainObj *vm G_GNUC_UNUSED)
index df0d54472037235488768ddaa5034712485dcaf6..5de55172be64488b1ec4eea331b84087ea49c6b6 100644 (file)
@@ -81,13 +81,6 @@ qemuMonitorTestAddItemParams(qemuMonitorTest *test,
                              ...)
     G_GNUC_NULL_TERMINATED;
 
-int
-qemuMonitorTestAddItemExpect(qemuMonitorTest *test,
-                             const char *cmdname,
-                             const char *cmdargs,
-                             bool apostrophe,
-                             const char *response);
-
 #define qemuMonitorTestNewSimple(xmlopt) \
     qemuMonitorTestNew(xmlopt, NULL, NULL, NULL)
 #define qemuMonitorTestNewSchema(xmlopt, schema) \