mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
Fix to xen test case for threadsafety patches
This commit is contained in:
parent
2b29698352
commit
39e6ded8ae
@ -1,3 +1,10 @@
|
|||||||
|
Wed Jan 21 18:18:12 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
Missing test case fix up from Xen threadsafety changes
|
||||||
|
* tests/sexpr2xmltest.c, tests/Makefile.am: Pass a real
|
||||||
|
connection object into the xenDaemonParseSxprString()
|
||||||
|
method, since it needs to use the priv object.
|
||||||
|
|
||||||
Thu Jan 22 09:23:53 PST 2009 John Levon <john.levon@sun.com>
|
Thu Jan 22 09:23:53 PST 2009 John Levon <john.levon@sun.com>
|
||||||
|
|
||||||
Least privilege support for Solaris
|
Least privilege support for Solaris
|
||||||
|
@ -121,7 +121,7 @@ xml2sexprtest_SOURCES = \
|
|||||||
xml2sexprtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
|
xml2sexprtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
|
||||||
|
|
||||||
sexpr2xmltest_SOURCES = \
|
sexpr2xmltest_SOURCES = \
|
||||||
sexpr2xmltest.c \
|
sexpr2xmltest.c testutilsxen.c testutilsxen.h \
|
||||||
testutils.c testutils.h
|
testutils.c testutils.h
|
||||||
sexpr2xmltest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
|
sexpr2xmltest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)
|
||||||
|
|
||||||
|
@ -6,11 +6,15 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "xml.h"
|
#include "xml.h"
|
||||||
|
#include "datatypes.h"
|
||||||
|
#include "xen_unified.h"
|
||||||
#include "xend_internal.h"
|
#include "xend_internal.h"
|
||||||
#include "testutils.h"
|
#include "testutils.h"
|
||||||
|
#include "testutilsxen.h"
|
||||||
|
|
||||||
static char *progname;
|
static char *progname;
|
||||||
static char *abs_srcdir;
|
static char *abs_srcdir;
|
||||||
|
static virCapsPtr caps;
|
||||||
|
|
||||||
#define MAX_FILE 4096
|
#define MAX_FILE 4096
|
||||||
|
|
||||||
@ -23,6 +27,12 @@ static int testCompareFiles(const char *xml, const char *sexpr,
|
|||||||
char *sexprPtr = &(sexprData[0]);
|
char *sexprPtr = &(sexprData[0]);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virDomainDefPtr def = NULL;
|
virDomainDefPtr def = NULL;
|
||||||
|
virConnectPtr conn;
|
||||||
|
struct _xenUnifiedPrivate priv;
|
||||||
|
|
||||||
|
|
||||||
|
conn = virGetConnect();
|
||||||
|
if (!conn) goto fail;
|
||||||
|
|
||||||
if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0)
|
if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -30,7 +40,15 @@ static int testCompareFiles(const char *xml, const char *sexpr,
|
|||||||
if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0)
|
if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(def = xenDaemonParseSxprString(NULL, sexprData, xendConfigVersion)))
|
memset(&priv, 0, sizeof priv);
|
||||||
|
/* Many puppies died to bring you this code. */
|
||||||
|
priv.xendConfigVersion = xendConfigVersion;
|
||||||
|
priv.caps = caps;
|
||||||
|
conn->privateData = &priv;
|
||||||
|
if (virMutexInit(&priv.lock) < 0)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (!(def = xenDaemonParseSxprString(conn, sexprData, xendConfigVersion)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(gotxml = virDomainDefFormat(NULL, def, 0)))
|
if (!(gotxml = virDomainDefFormat(NULL, def, 0)))
|
||||||
@ -46,6 +64,7 @@ static int testCompareFiles(const char *xml, const char *sexpr,
|
|||||||
fail:
|
fail:
|
||||||
free(gotxml);
|
free(gotxml);
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
|
virUnrefConnect(conn);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -90,6 +109,9 @@ mymain(int argc, char **argv)
|
|||||||
return(EXIT_FAILURE);
|
return(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(caps = testXenCapsInit()))
|
||||||
|
return(EXIT_FAILURE);
|
||||||
|
|
||||||
#define DO_TEST(in, out, version) \
|
#define DO_TEST(in, out, version) \
|
||||||
do { \
|
do { \
|
||||||
struct testInfo info = { in, out, version }; \
|
struct testInfo info = { in, out, version }; \
|
||||||
|
Loading…
Reference in New Issue
Block a user