docs: Reword virDomainGetEmulatorPinInfo description
[libvirt.git] / tests / vmwarevertest.c
blobcdbd58fb4ff9bb3e099a56070eb3ddb6d5d83ee5
1 /*
2 * Copyright (c) 2013. Doug Goldstein <cardoe@cardoe.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see
16 * <http://www.gnu.org/licenses/>.
19 #include <config.h>
21 #include "testutils.h"
23 #ifdef WITH_VMWARE
26 # include "vmware/vmware_conf.h"
28 //# define VIR_FROM_THIS VIR_FROM_NONE
30 struct testInfo {
31 const char *vmware_type;
32 const char *name;
33 unsigned long version;
36 static int
37 testVerStrParse(const void *data)
39 const struct testInfo *info = data;
40 g_autofree char *path = NULL;
41 g_autofree char *databuf = NULL;
42 unsigned long version;
43 int vmware_type;
45 path = g_strdup_printf("%s/vmwareverdata/%s.txt", abs_srcdir, info->name);
47 if (virTestLoadFile(path, &databuf) < 0)
48 return -1;
50 if ((vmware_type = vmwareDriverTypeFromString(info->vmware_type)) < 0)
51 return -1;
53 if (vmwareParseVersionStr(vmware_type, databuf, &version) < 0)
54 return -1;
56 if (version != info->version) {
57 fprintf(stderr, "%s: parsed versions do not match: got %lu, "
58 "expected %lu\n", info->name, version, info->version);
59 return -1;
62 return 0;
65 static int
66 mymain(void)
68 int ret = 0;
70 # define DO_TEST(vmware_type, name, version) \
71 do { \
72 struct testInfo info = { \
73 vmware_type, name, version \
74 }; \
75 if (virTestRun("VMware Version String Parsing " name, \
76 testVerStrParse, &info) < 0) \
77 ret = -1; \
78 } while (0)
80 DO_TEST("ws", "workstation-7.0.0", 7000000);
81 DO_TEST("ws", "workstation-7.0.0-with-garbage", 7000000);
82 DO_TEST("fusion", "fusion-5.0.3", 5000003);
84 return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
87 VIR_TEST_MAIN(mymain)
89 #else
91 int
92 main(void)
94 return EXIT_AM_SKIP;
97 #endif /* WITH_VMWARE */