mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
tests: Move data directories into testQemuData
This removes a little duplication right away, and will allow us to avoid introducing more later on. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
c125a6ef2a
commit
0c744afe1a
@ -35,6 +35,7 @@ typedef struct _testQemuData testQemuData;
|
|||||||
typedef testQemuData *testQemuDataPtr;
|
typedef testQemuData *testQemuDataPtr;
|
||||||
struct _testQemuData {
|
struct _testQemuData {
|
||||||
virQEMUDriver driver;
|
virQEMUDriver driver;
|
||||||
|
const char *dataDir;
|
||||||
const char *archName;
|
const char *archName;
|
||||||
const char *base;
|
const char *base;
|
||||||
int ret;
|
int ret;
|
||||||
@ -47,6 +48,8 @@ testQemuDataInit(testQemuDataPtr data)
|
|||||||
if (qemuTestDriverInit(&data->driver) < 0)
|
if (qemuTestDriverInit(&data->driver) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
data->dataDir = abs_srcdir "/qemucapabilitiesdata";
|
||||||
|
|
||||||
data->ret = 0;
|
data->ret = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -73,10 +76,10 @@ testQemuCaps(const void *opaque)
|
|||||||
unsigned int fakeMicrocodeVersion = 0;
|
unsigned int fakeMicrocodeVersion = 0;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
if (virAsprintf(&repliesFile, "%s/qemucapabilitiesdata/%s.%s.replies",
|
if (virAsprintf(&repliesFile, "%s/%s.%s.replies",
|
||||||
abs_srcdir, data->base, data->archName) < 0 ||
|
data->dataDir, data->base, data->archName) < 0 ||
|
||||||
virAsprintf(&capsFile, "%s/qemucapabilitiesdata/%s.%s.xml",
|
virAsprintf(&capsFile, "%s/%s.%s.xml",
|
||||||
abs_srcdir, data->base, data->archName) < 0)
|
data->dataDir, data->base, data->archName) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(mon = qemuMonitorTestNewFromFileFull(repliesFile, &data->driver, NULL)))
|
if (!(mon = qemuMonitorTestNewFromFileFull(repliesFile, &data->driver, NULL)))
|
||||||
@ -141,8 +144,8 @@ testQemuCapsCopy(const void *opaque)
|
|||||||
virQEMUCapsPtr copy = NULL;
|
virQEMUCapsPtr copy = NULL;
|
||||||
char *actual = NULL;
|
char *actual = NULL;
|
||||||
|
|
||||||
if (virAsprintf(&capsFile, "%s/qemucapabilitiesdata/%s.%s.xml",
|
if (virAsprintf(&capsFile, "%s/%s.%s.xml",
|
||||||
abs_srcdir, data->base, data->archName) < 0)
|
data->dataDir, data->base, data->archName) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(caps = virCapabilitiesNew(virArchFromString(data->archName),
|
if (!(caps = virCapabilitiesNew(virArchFromString(data->archName),
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
typedef struct _testQemuData testQemuData;
|
typedef struct _testQemuData testQemuData;
|
||||||
typedef testQemuData *testQemuDataPtr;
|
typedef testQemuData *testQemuDataPtr;
|
||||||
struct _testQemuData {
|
struct _testQemuData {
|
||||||
|
const char *inputDir;
|
||||||
|
const char *outputDir;
|
||||||
const char *base;
|
const char *base;
|
||||||
const char *archName;
|
const char *archName;
|
||||||
int ret;
|
int ret;
|
||||||
@ -36,6 +38,9 @@ struct _testQemuData {
|
|||||||
static int
|
static int
|
||||||
testQemuDataInit(testQemuDataPtr data)
|
testQemuDataInit(testQemuDataPtr data)
|
||||||
{
|
{
|
||||||
|
data->inputDir = abs_srcdir "/qemucapabilitiesdata";
|
||||||
|
data->outputDir = abs_srcdir "/qemucaps2xmloutdata";
|
||||||
|
|
||||||
data->ret = 0;
|
data->ret = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -137,12 +142,12 @@ testQemuCapsXML(const void *opaque)
|
|||||||
char *capsXml = NULL;
|
char *capsXml = NULL;
|
||||||
virCapsPtr capsProvided = NULL;
|
virCapsPtr capsProvided = NULL;
|
||||||
|
|
||||||
if (virAsprintf(&xmlFile, "%s/qemucaps2xmloutdata/caps.%s.xml",
|
if (virAsprintf(&xmlFile, "%s/caps.%s.xml",
|
||||||
abs_srcdir, data->archName) < 0)
|
data->outputDir, data->archName) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virAsprintf(&capsFile, "%s/qemucapabilitiesdata/%s.%s.xml",
|
if (virAsprintf(&capsFile, "%s/%s.%s.xml",
|
||||||
abs_srcdir, data->base, data->archName) < 0)
|
data->inputDir, data->base, data->archName) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virTestLoadFile(capsFile, &capsData) < 0)
|
if (virTestLoadFile(capsFile, &capsData) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user