~nova-coresec/ubuntu/maverick/libvirt/nova-ppa

« back to all changes in this revision

Viewing changes to tests/vmx2xmltest.c

  • Committer: Bazaar Package Importer
  • Author(s): Guido Günther
  • Date: 2010-04-19 18:11:57 UTC
  • mto: (3.4.14 squeeze) (1.2.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 92.
  • Revision ID: james.westby@ubuntu.com-20100419181157-yyj82wyh90r6wxwr
Tags: upstream-0.8.0
Import upstream version 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
#ifdef WITH_ESX
4
4
 
5
 
#include <stdio.h>
6
 
#include <string.h>
7
 
#include <unistd.h>
 
5
# include <stdio.h>
 
6
# include <string.h>
 
7
# include <unistd.h>
8
8
 
9
 
#include "internal.h"
10
 
#include "memory.h"
11
 
#include "testutils.h"
12
 
#include "esx/esx_vmx.h"
 
9
# include "internal.h"
 
10
# include "memory.h"
 
11
# include "testutils.h"
 
12
# include "esx/esx_vmx.h"
13
13
 
14
14
static char *progname = NULL;
15
15
static char *abs_srcdir = NULL;
16
16
 
17
 
#define MAX_FILE 4096
 
17
# define MAX_FILE 4096
18
18
 
19
19
static int
20
20
testCompareFiles(const char *vmx, const char *xml, esxVI_APIVersion apiVersion)
26
26
    char *vmxPtr = &(vmxData[0]);
27
27
    char *xmlPtr = &(xmlData[0]);
28
28
    virDomainDefPtr def = NULL;
 
29
    virErrorPtr err = NULL;
29
30
 
30
31
    if (virtTestLoadFile(vmx, &vmxPtr, MAX_FILE) < 0) {
31
32
        goto failure;
39
40
                             apiVersion);
40
41
 
41
42
    if (def == NULL) {
 
43
        err = virGetLastError();
 
44
        fprintf(stderr, "ERROR: %s\n", err != NULL ? err->message : "<unknown>");
42
45
        goto failure;
43
46
    }
44
47
 
45
48
    formatted = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE);
46
49
 
47
50
    if (formatted == NULL) {
 
51
        err = virGetLastError();
 
52
        fprintf(stderr, "ERROR: %s\n", err != NULL ? err->message : "<unknown>");
48
53
        goto failure;
49
54
    }
50
55
 
107
112
        return EXIT_FAILURE;
108
113
    }
109
114
 
110
 
    #define DO_TEST(_in, _out, _version)                                      \
 
115
# define DO_TEST(_in, _out, _version)                                      \
111
116
        do {                                                                  \
112
117
            struct testInfo info = { _in, _out, _version };                   \
113
118
            virResetLastError();                                              \
117
122
            }                                                                 \
118
123
        } while (0)
119
124
 
 
125
    DO_TEST("case-insensitive-1", "case-insensitive-1", esxVI_APIVersion_25);
 
126
    DO_TEST("case-insensitive-2", "case-insensitive-2", esxVI_APIVersion_25);
 
127
 
120
128
    DO_TEST("minimal", "minimal", esxVI_APIVersion_25);
121
129
    DO_TEST("minimal-64bit", "minimal-64bit", esxVI_APIVersion_25);
122
130
 
123
131
    DO_TEST("graphics-vnc", "graphics-vnc", esxVI_APIVersion_25);
124
132
 
125
 
    DO_TEST("scsi-buslogic", "scsi-buslogic", esxVI_APIVersion_25);
 
133
    DO_TEST("scsi-driver", "scsi-driver", esxVI_APIVersion_25);
126
134
    DO_TEST("scsi-writethrough", "scsi-writethrough", esxVI_APIVersion_25);
127
135
 
128
136
    DO_TEST("harddisk-scsi-file", "harddisk-scsi-file", esxVI_APIVersion_25);