mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-31 00:45:18 +00:00
tests: nodedev: remove virt type from test macros
We only use the virt_type "QEMU" in this tests, so simply hard-code it in the test function rather than specifying it in the test macro. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
7dd31c4938
commit
3bbfbceb0f
@ -10,8 +10,9 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NODEDEV
|
#define VIR_FROM_THIS VIR_FROM_NODEDEV
|
||||||
|
|
||||||
|
#define VIRT_TYPE "QEMU"
|
||||||
|
|
||||||
struct TestInfo {
|
struct TestInfo {
|
||||||
const char *virt_type;
|
|
||||||
const char *filename;
|
const char *filename;
|
||||||
virMdevctlCommand command;
|
virMdevctlCommand command;
|
||||||
};
|
};
|
||||||
@ -35,8 +36,7 @@ typedef virCommand * (*MdevctlCmdFunc)(virNodeDeviceDef *, char **, char **);
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testMdevctlCmd(const char *virt_type,
|
testMdevctlCmd(virMdevctlCommand cmd_type,
|
||||||
virMdevctlCommand cmd_type,
|
|
||||||
const char *mdevxml,
|
const char *mdevxml,
|
||||||
const char *cmdfile,
|
const char *cmdfile,
|
||||||
const char *jsonfile)
|
const char *jsonfile)
|
||||||
@ -68,7 +68,7 @@ testMdevctlCmd(const char *virt_type,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(def = virNodeDeviceDefParseFile(mdevxml, create, virt_type)))
|
if (!(def = virNodeDeviceDefParseFile(mdevxml, create, VIRT_TYPE)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* this function will set a stdin buffer containing the json configuration
|
/* this function will set a stdin buffer containing the json configuration
|
||||||
@ -120,8 +120,7 @@ testMdevctlHelper(const void *data)
|
|||||||
jsonfile = g_strdup_printf("%s/nodedevmdevctldata/%s-%s.json", abs_srcdir,
|
jsonfile = g_strdup_printf("%s/nodedevmdevctldata/%s-%s.json", abs_srcdir,
|
||||||
info->filename, cmd);
|
info->filename, cmd);
|
||||||
|
|
||||||
return testMdevctlCmd(info->virt_type, info->command, mdevxml,
|
return testMdevctlCmd(info->command, mdevxml, cmdlinefile, jsonfile);
|
||||||
cmdlinefile, jsonfile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -330,27 +329,27 @@ mymain(void)
|
|||||||
if (virTestRun(desc, func, info) < 0) \
|
if (virTestRun(desc, func, info) < 0) \
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
#define DO_TEST_CMD(desc, virt_type, filename, command) \
|
#define DO_TEST_CMD(desc, filename, command) \
|
||||||
do { \
|
do { \
|
||||||
struct TestInfo info = { virt_type, filename, command }; \
|
struct TestInfo info = { filename, command }; \
|
||||||
DO_TEST_FULL(desc, testMdevctlHelper, &info); \
|
DO_TEST_FULL(desc, testMdevctlHelper, &info); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
#define DO_TEST_CREATE(filename) \
|
#define DO_TEST_CREATE(filename) \
|
||||||
DO_TEST_CMD("create mdev " filename, "QEMU", filename, MDEVCTL_CMD_CREATE)
|
DO_TEST_CMD("create mdev " filename, filename, MDEVCTL_CMD_CREATE)
|
||||||
|
|
||||||
#define DO_TEST_DEFINE(filename) \
|
#define DO_TEST_DEFINE(filename) \
|
||||||
DO_TEST_CMD("define mdev " filename, "QEMU", filename, MDEVCTL_CMD_DEFINE)
|
DO_TEST_CMD("define mdev " filename, filename, MDEVCTL_CMD_DEFINE)
|
||||||
|
|
||||||
#define DO_TEST_STOP(filename) \
|
#define DO_TEST_STOP(filename) \
|
||||||
DO_TEST_CMD("stop mdev " filename, "QEMU", filename, MDEVCTL_CMD_STOP)
|
DO_TEST_CMD("stop mdev " filename, filename, MDEVCTL_CMD_STOP)
|
||||||
|
|
||||||
#define DO_TEST_UNDEFINE(filename) \
|
#define DO_TEST_UNDEFINE(filename) \
|
||||||
DO_TEST_CMD("undefine mdev" filename, "QEMU", filename, MDEVCTL_CMD_UNDEFINE)
|
DO_TEST_CMD("undefine mdev" filename, filename, MDEVCTL_CMD_UNDEFINE)
|
||||||
|
|
||||||
#define DO_TEST_START(filename) \
|
#define DO_TEST_START(filename) \
|
||||||
DO_TEST_CMD("start mdev " filename, "QEMU", filename, MDEVCTL_CMD_START)
|
DO_TEST_CMD("start mdev " filename, filename, MDEVCTL_CMD_START)
|
||||||
|
|
||||||
#define DO_TEST_LIST_DEFINED() \
|
#define DO_TEST_LIST_DEFINED() \
|
||||||
DO_TEST_FULL("list defined mdevs", testMdevctlListDefined, NULL)
|
DO_TEST_FULL("list defined mdevs", testMdevctlListDefined, NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user