~ubuntu-branches/ubuntu/oneiric/libvirt/oneiric-updates

« back to all changes in this revision

Viewing changes to tests/xml2vmxtest.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2011-05-11 12:29:51 UTC
  • mfrom: (1.2.10) (3.4.30 sid)
  • Revision ID: package-import@ubuntu.com-20110511122951-ku5fk1tv37o5aymm
Tags: 0.9.1-1ubuntu1
* Resynchronize and merge from Debian unstable (LP: #794378). Remaining
  changes:
  - debian/control:
    * set X-Python-Version to 2.7, as 2.6 is not in oneiric.
    * set ubuntu maintainer
    * Build-Depends:
      - remove [linux-any] from all dependencies
      - remove [!linux-any] deps
      - swap libxen to libxen3, qemu to qemu-kvm, and open-iscsi to
        open-iscsi-utils in Build-Depends
      - remove virtualbox-ose Build-Depends
      - add parted and libapparmor-dev Build-Depends
    * convert Vcs-Git to Xs-Debian-Vcs-Git
    * libvirt-bin Depends: move netcat-openbsd, bridge-utils, dnsmasq-base
      (>= 2.46-1), and iptables from Recommends to Depends
    * libvirt-bin Recommends: move qemu to Suggests
    * libvirt-bin Suggests: add apparmor
    * libvirt0 Recommands: move lvm2 to Suggests
  - keep debian/libvirt-bin.apport
  - keep debian/libvirt-bin.cron.daily
  - debian/libvirt-bin.dirs:
    * add apparmor, cron.daily, and apport dirs
  - debian/libvirt-bin.examples:
    * add debian/libvirt-suspendonreboot
  - debian/libvirt-bin.install:
    * add /etc/apparmor.d files
    * add apport hook
  - debian/libvirt-bin.manpages:
    * add debian/libvirt-migrate-qemu-disks.1
  - debian/libvirt-bin.postinst:
    * replace libvirt groupname with libvirtd
    * add each admin user to libvirtd group
    * call apparmor_parser on usr.sbin.libvirtd and
      usr.lib.libvirt.virt-aa-helper
    * call 'libvirt-migrate-qemu-disks -a' after
      libvirt-bin has started if migrating from
      older than 0.8.3-1ubuntu1
  - debian/libvirt-bin.postrm:
    * replace libvirt groupname with libvirtd
    * remove usr.sbin.libvirtd and
      usr.lib.libvirt.virt-aa-helper
  - keep added files under debian/:
    * libvirt-bin.upstart
    * libvirt-migrate-qemu-disks
    * libvirt-migrate-qemu-disks.1
    * libvirt-suspendonreboot
    * apparmor profiles
  - debian/README.Debian:
    * add 'Apparmor Profile' section
    * add 'Disk migration' section
  - debian/rules:
    * move include of debhelper.mk to top of file so DEB_HOST_ARCH_OS
      is defined.
    * don't build with vbox since virtualbox-ose is in universe
      - remove WITH_VBOX, add explicit --without-vbox
    * add --with-apparmor to DEB_CONFIGURE_EXTRA_FLAGS
    * set DEB_DH_INSTALLINIT_ARGS to '--upstart-only'
    * remove unneeded binary-install/libvirt-bin:: and clean::
      sections (they only deal with sysvinit stuff)
    * add build/libvirt-bin:: section to install
      - apparmor files
      - apport hooks
      - libvirt-migrate-qemu-disks
* debian/patches/series:
  - don't apply Disable-CHECKSUM-rule.patch: our iptables can do this
  - don't apply Debian-specific Debianize-libvirt-guests.patch (sysvinit only)
  - don't apply Disable qemu-disable-network.diff.patch
* debian/patches:
  - drop 9007-fix-daemon-conf-ftbfs.patch (looks like it may be fixed)
  - drop patches applied upstream:
    * 9022-drop-booton-when-kernel-specified.patch
    * 9023-fix-lxc-console-hangup.patch
    * 9024-fix-broken-commandtest.patch
    * 9025-Pass-virSecurityManagerPtr-to-virSecurityDAC-Set-Res.patch
    * 9026-security-avoid-memory-leak.patch
    * 9027-CVE-2011-1146.patch
  - keep patches:
    * 9000-delayed_iff_up_bridge.patch
    * 9001-dont_clobber_existing_bridges.patch
    * 9002-better_default_uri_virsh.patch
    * 9003-better-default-arch.patch
    * 9004-libvirtd-group-name.patch
    * 9005-increase-unix-socket-timeout.patch
    * 9006-default-config-test-case.patch
    * 9011-move-ebtables-script.patch (refreshed)
    * 9014-skip-nodeinfotest.patch (modified to make it apply)
    * 9020-lp545795.patch (modified to make it still apply)
    * 9021-fix-uint64_t.patch
    * 9022-allows-lxc-containers-with-lxcguest.patch (renamed, modified
      to make it still apply, and added DEP-3 tags).
  - new patches:
    * 9023-disable-test-poll.patch - don't run broken test-poll

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# include "testutils.h"
12
12
# include "vmx/vmx.h"
13
13
 
14
 
static char *progname = NULL;
15
 
static char *abs_srcdir = NULL;
16
 
static virCapsPtr caps = NULL;
 
14
static virCapsPtr caps;
17
15
static virVMXContext ctx;
18
16
 
19
 
# define MAX_FILE 4096
20
 
 
21
17
static void
22
18
testCapsInit(void)
23
19
{
71
67
testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
72
68
{
73
69
    int result = -1;
74
 
    char xmlData[MAX_FILE];
75
 
    char vmxData[MAX_FILE];
 
70
    char *xmlData = NULL;
 
71
    char *vmxData = NULL;
76
72
    char *formatted = NULL;
77
 
    char *xmlPtr = &(xmlData[0]);
78
 
    char *vmxPtr = &(vmxData[0]);
79
73
    virDomainDefPtr def = NULL;
80
74
 
81
 
    if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0) {
 
75
    if (virtTestLoadFile(xml, &xmlData) < 0) {
82
76
        goto failure;
83
77
    }
84
78
 
85
 
    if (virtTestLoadFile(vmx, &vmxPtr, MAX_FILE) < 0) {
 
79
    if (virtTestLoadFile(vmx, &vmxData) < 0) {
86
80
        goto failure;
87
81
    }
88
82
 
106
100
    result = 0;
107
101
 
108
102
  failure:
 
103
    VIR_FREE(xmlData);
 
104
    VIR_FREE(vmxData);
109
105
    VIR_FREE(formatted);
110
106
    virDomainDefFree(def);
111
107
 
121
117
static int
122
118
testCompareHelper(const void *data)
123
119
{
 
120
    int result = -1;
124
121
    const struct testInfo *info = data;
125
 
    char xml[PATH_MAX];
126
 
    char vmx[PATH_MAX];
127
 
 
128
 
    snprintf(xml, PATH_MAX, "%s/xml2vmxdata/xml2vmx-%s.xml", abs_srcdir,
129
 
             info->input);
130
 
    snprintf(vmx, PATH_MAX, "%s/xml2vmxdata/xml2vmx-%s.vmx", abs_srcdir,
131
 
             info->output);
132
 
 
133
 
    return testCompareFiles(xml, vmx, info->virtualHW_version);
 
122
    char *xml = NULL;
 
123
    char *vmx = NULL;
 
124
 
 
125
    if (virAsprintf(&xml, "%s/xml2vmxdata/xml2vmx-%s.xml", abs_srcdir,
 
126
                    info->input) < 0 ||
 
127
        virAsprintf(&vmx, "%s/xml2vmxdata/xml2vmx-%s.vmx", abs_srcdir,
 
128
                    info->output) < 0) {
 
129
        goto cleanup;
 
130
    }
 
131
 
 
132
    result = testCompareFiles(xml, vmx, info->virtualHW_version);
 
133
 
 
134
  cleanup:
 
135
    VIR_FREE(xml);
 
136
    VIR_FREE(vmx);
 
137
 
 
138
    return result;
134
139
}
135
140
 
136
141
static int
198
203
}
199
204
 
200
205
static int
201
 
mymain(int argc, char **argv)
 
206
mymain(void)
202
207
{
203
208
    int result = 0;
204
 
    char cwd[PATH_MAX];
205
 
 
206
 
    progname = argv[0];
207
 
 
208
 
    if (argc > 1) {
209
 
        fprintf(stderr, "Usage: %s\n", progname);
210
 
        return EXIT_FAILURE;
211
 
    }
212
 
 
213
 
    abs_srcdir = getenv("abs_srcdir");
214
 
 
215
 
    if (abs_srcdir == NULL) {
216
 
        abs_srcdir = getcwd(cwd, sizeof(cwd));
217
 
    }
218
 
 
219
 
    if (argc > 1) {
220
 
        fprintf(stderr, "Usage: %s\n", progname);
221
 
        return EXIT_FAILURE;
222
 
    }
223
209
 
224
210
# define DO_TEST(_in, _out, _version)                                         \
225
211
        do {                                                                  \