diff --git a/ChangeLog b/ChangeLog index cf7b0c0e8a..308d1b0199 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Jan 21 18:18:12 GMT 2009 Daniel P. Berrange + + 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 Least privilege support for Solaris diff --git a/tests/Makefile.am b/tests/Makefile.am index a2e5c0f37f..9924657cc8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -121,7 +121,7 @@ xml2sexprtest_SOURCES = \ xml2sexprtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) sexpr2xmltest_SOURCES = \ - sexpr2xmltest.c \ + sexpr2xmltest.c testutilsxen.c testutilsxen.h \ testutils.c testutils.h sexpr2xmltest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c index 9e8bac4480..21ae0ec99f 100644 --- a/tests/sexpr2xmltest.c +++ b/tests/sexpr2xmltest.c @@ -6,11 +6,15 @@ #include "internal.h" #include "xml.h" +#include "datatypes.h" +#include "xen_unified.h" #include "xend_internal.h" #include "testutils.h" +#include "testutilsxen.h" static char *progname; static char *abs_srcdir; +static virCapsPtr caps; #define MAX_FILE 4096 @@ -23,6 +27,12 @@ static int testCompareFiles(const char *xml, const char *sexpr, char *sexprPtr = &(sexprData[0]); int ret = -1; virDomainDefPtr def = NULL; + virConnectPtr conn; + struct _xenUnifiedPrivate priv; + + + conn = virGetConnect(); + if (!conn) goto fail; if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0) goto fail; @@ -30,7 +40,15 @@ static int testCompareFiles(const char *xml, const char *sexpr, if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0) 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; if (!(gotxml = virDomainDefFormat(NULL, def, 0))) @@ -46,6 +64,7 @@ static int testCompareFiles(const char *xml, const char *sexpr, fail: free(gotxml); virDomainDefFree(def); + virUnrefConnect(conn); return ret; } @@ -90,6 +109,9 @@ mymain(int argc, char **argv) return(EXIT_FAILURE); } + if (!(caps = testXenCapsInit())) + return(EXIT_FAILURE); + #define DO_TEST(in, out, version) \ do { \ struct testInfo info = { in, out, version }; \