static int testFilterLine(char *buffer,
const char *toRemove)
{
- char *start;
- char *end;
-
- if (!(start = strstr(buffer, toRemove)))
- return -1;
-
- if (!(end = strstr(start+1, "\n"))) {
- *start = '\0';
- } else {
- memmove(start, end, strlen(end)+1);
- }
- return 0;
+ char *start;
+ char *end;
+
+ if (!(start = strstr(buffer, toRemove)))
+ return -1;
+
+ if (!(end = strstr(start+1, "\n"))) {
+ *start = '\0';
+ } else {
+ memmove(start, end, strlen(end)+1);
+ }
+ return 0;
}
static int
static int testCompareListDefault(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_DEFAULT, "list", NULL };
- const char *exp = "\
+ const char *const argv[] = { VIRSH_DEFAULT, "list", NULL };
+ const char *exp = "\
Id Name State \n\
----------------------\n\
1 test running \n\
\n";
- return testCompareOutputLit(exp, NULL, argv);
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareListCustom(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "list", NULL };
- const char *exp = "\
+ const char *const argv[] = { VIRSH_CUSTOM, "list", NULL };
+ const char *exp = "\
Id Name State \n\
----------------------\n\
1 fv0 running \n\
2 fc4 running \n\
\n";
- return testCompareOutputLit(exp, NULL, argv);
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareNodeinfoDefault(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_DEFAULT, "nodeinfo", NULL };
- const char *exp = "\
+ const char *const argv[] = { VIRSH_DEFAULT, "nodeinfo", NULL };
+ const char *exp = "\
CPU model: i686\n\
CPU(s): 16\n\
CPU frequency: 1400 MHz\n\
NUMA cell(s): 2\n\
Memory size: 3145728 KiB\n\
\n";
- return testCompareOutputLit(exp, NULL, argv);
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareNodeinfoCustom(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = {
- VIRSH_CUSTOM,
- "nodeinfo",
- NULL
- };
- const char *exp = "\
+ const char *const argv[] = {
+ VIRSH_CUSTOM,
+ "nodeinfo",
+ NULL
+ };
+ const char *exp = "\
CPU model: i986\n\
CPU(s): 50\n\
CPU frequency: 6000 MHz\n\
NUMA cell(s): 4\n\
Memory size: 8192000 KiB\n\
\n";
- return testCompareOutputLit(exp, NULL, argv);
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareDominfoByID(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "dominfo", "2", NULL };
- const char *exp = dominfo_fc4;
- return testCompareOutputLit(exp, "\nCPU time:", argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "dominfo", "2", NULL };
+ const char *exp = dominfo_fc4;
+ return testCompareOutputLit(exp, "\nCPU time:", argv);
}
static int testCompareDominfoByUUID(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "dominfo", DOM_UUID, NULL };
- const char *exp = dominfo_fc4;
- return testCompareOutputLit(exp, "\nCPU time:", argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "dominfo", DOM_UUID, NULL };
+ const char *exp = dominfo_fc4;
+ return testCompareOutputLit(exp, "\nCPU time:", argv);
}
static int testCompareDominfoByName(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "dominfo", "fc4", NULL };
- const char *exp = dominfo_fc4;
- return testCompareOutputLit(exp, "\nCPU time:", argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "dominfo", "fc4", NULL };
+ const char *exp = dominfo_fc4;
+ return testCompareOutputLit(exp, "\nCPU time:", argv);
}
static int testCompareDomuuidByID(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "domuuid", "2", NULL };
- const char *exp = domuuid_fc4;
- return testCompareOutputLit(exp, NULL, argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "domuuid", "2", NULL };
+ const char *exp = domuuid_fc4;
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareDomuuidByName(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "domuuid", "fc4", NULL };
- const char *exp = domuuid_fc4;
- return testCompareOutputLit(exp, NULL, argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "domuuid", "fc4", NULL };
+ const char *exp = domuuid_fc4;
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareDomidByName(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "domid", "fc4", NULL };
- const char *exp = domid_fc4;
- return testCompareOutputLit(exp, NULL, argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "domid", "fc4", NULL };
+ const char *exp = domid_fc4;
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareDomidByUUID(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "domid", DOM_UUID, NULL };
- const char *exp = domid_fc4;
- return testCompareOutputLit(exp, NULL, argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "domid", DOM_UUID, NULL };
+ const char *exp = domid_fc4;
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareDomnameByID(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "domname", "2", NULL };
- const char *exp = domname_fc4;
- return testCompareOutputLit(exp, NULL, argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "domname", "2", NULL };
+ const char *exp = domname_fc4;
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareDomnameByUUID(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "domname", DOM_UUID, NULL };
- const char *exp = domname_fc4;
- return testCompareOutputLit(exp, NULL, argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "domname", DOM_UUID, NULL };
+ const char *exp = domname_fc4;
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareDomstateByID(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "domstate", "2", NULL };
- const char *exp = domstate_fc4;
- return testCompareOutputLit(exp, NULL, argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "domstate", "2", NULL };
+ const char *exp = domstate_fc4;
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareDomstateByUUID(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "domstate", DOM_UUID, NULL };
- const char *exp = domstate_fc4;
- return testCompareOutputLit(exp, NULL, argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "domstate", DOM_UUID, NULL };
+ const char *exp = domstate_fc4;
+ return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareDomstateByName(const void *data ATTRIBUTE_UNUSED)
{
- const char *const argv[] = { VIRSH_CUSTOM, "domstate", "fc4", NULL };
- const char *exp = domstate_fc4;
- return testCompareOutputLit(exp, NULL, argv);
+ const char *const argv[] = { VIRSH_CUSTOM, "domstate", "fc4", NULL };
+ const char *exp = domstate_fc4;
+ return testCompareOutputLit(exp, NULL, argv);
}
struct testInfo {