提交 f19b3a5f 编写于 作者: M Martin Kletzander

Use K&R style for curly braces in tests/

Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 0099a4ae
/*
* commandhelper.c: Auxiliary program for commandtest
*
* Copyright (C) 2010-2013 Red Hat, Inc.
* Copyright (C) 2010-2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -37,7 +37,8 @@
# define VIR_FROM_THIS VIR_FROM_NONE
static int envsort(const void *a, const void *b) {
static int envsort(const void *a, const void *b)
{
const char *const*astrptr = a;
const char *const*bstrptr = b;
const char *astr = *astrptr;
......
......@@ -36,7 +36,8 @@ static int blankProblemElements(char *data)
static int testCompareXMLToArgvFiles(const char *xml,
const char *cmdfile,
bool expect_warning) {
bool expect_warning)
{
char *expectxml = NULL;
char *actualxml = NULL;
char *cmd = NULL;
......
/*
* Copyright (C) 2011 Red Hat, Inc.
* Copyright (C) 2011, 2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -38,7 +38,8 @@ static void shunloadError(void *userData ATTRIBUTE_UNUSED,
int shunloadStart(void);
int shunloadStart(void) {
int shunloadStart(void)
{
virConnectPtr conn;
virSetErrorFunc(NULL, shunloadError);
......
......@@ -362,7 +362,8 @@ virtTestLoadFile(const char *file, char **buf)
#ifndef WIN32
static
void virtTestCaptureProgramExecChild(const char *const argv[],
int pipefd) {
int pipefd)
{
size_t i;
int open_max;
int stdinfd = -1;
......@@ -629,7 +630,8 @@ virtTestLogContentAndReset(void)
static unsigned int
virTestGetFlag(const char *name) {
virTestGetFlag(const char *name)
{
char *flagStr;
unsigned int flag;
......@@ -643,21 +645,24 @@ virTestGetFlag(const char *name) {
}
unsigned int
virTestGetDebug(void) {
virTestGetDebug(void)
{
if (testDebug == -1)
testDebug = virTestGetFlag("VIR_TEST_DEBUG");
return testDebug;
}
unsigned int
virTestGetVerbose(void) {
virTestGetVerbose(void)
{
if (testVerbose == -1)
testVerbose = virTestGetFlag("VIR_TEST_VERBOSE");
return testVerbose || virTestGetDebug();
}
unsigned int
virTestGetExpensive(void) {
virTestGetExpensive(void)
{
if (testExpensive == -1)
testExpensive = virTestGetFlag("VIR_TEST_EXPENSIVE");
return testExpensive;
......
......@@ -8,7 +8,8 @@
# include "domain_conf.h"
virCapsPtr testLXCCapsInit(void) {
virCapsPtr testLXCCapsInit(void)
{
virCapsPtr caps;
virCapsGuestPtr guest;
......
......@@ -203,7 +203,8 @@ error:
return -1;
}
virCapsPtr testQemuCapsInit(void) {
virCapsPtr testQemuCapsInit(void)
{
virCapsPtr caps;
virCapsGuestPtr guest;
virCapsGuestMachinePtr *machines = NULL;
......
......@@ -7,7 +7,8 @@
#include "domain_conf.h"
virCapsPtr testXenCapsInit(void) {
virCapsPtr testXenCapsInit(void)
{
struct utsname utsname;
virCapsPtr caps;
virCapsGuestPtr guest;
......
......@@ -42,7 +42,8 @@ static const char *domname_fc4 = "fc4\n\n";
static const char *domstate_fc4 = "running\n\n";
static int testFilterLine(char *buffer,
const char *toRemove) {
const char *toRemove)
{
char *start;
char *end;
......@@ -93,7 +94,8 @@ static char *custom_uri;
"--connect", \
custom_uri
static int testCompareListDefault(const void *data ATTRIBUTE_UNUSED) {
static int testCompareListDefault(const void *data ATTRIBUTE_UNUSED)
{
const char *const argv[] = { VIRSH_DEFAULT, "list", NULL };
const char *exp = "\
Id Name State\n\
......@@ -103,7 +105,8 @@ static int testCompareListDefault(const void *data ATTRIBUTE_UNUSED) {
return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareListCustom(const void *data ATTRIBUTE_UNUSED) {
static int testCompareListCustom(const void *data ATTRIBUTE_UNUSED)
{
const char *const argv[] = { VIRSH_CUSTOM, "list", NULL };
const char *exp = "\
Id Name State\n\
......@@ -114,7 +117,8 @@ static int testCompareListCustom(const void *data ATTRIBUTE_UNUSED) {
return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareNodeinfoDefault(const void *data ATTRIBUTE_UNUSED) {
static int testCompareNodeinfoDefault(const void *data ATTRIBUTE_UNUSED)
{
const char *const argv[] = { VIRSH_DEFAULT, "nodeinfo", NULL };
const char *exp = "\
CPU model: i686\n\
......@@ -129,7 +133,8 @@ Memory size: 3145728 KiB\n\
return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareNodeinfoCustom(const void *data ATTRIBUTE_UNUSED) {
static int testCompareNodeinfoCustom(const void *data ATTRIBUTE_UNUSED)
{
const char *const argv[] = {
VIRSH_CUSTOM,
"nodeinfo",
......@@ -148,73 +153,85 @@ Memory size: 8192000 KiB\n\
return testCompareOutputLit(exp, NULL, argv);
}
static int testCompareDominfoByID(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDominfoByUUID(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDominfoByName(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDomuuidByID(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDomuuidByName(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDomidByName(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDomidByUUID(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDomnameByID(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDomnameByUUID(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDomstateByID(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDomstateByUUID(const void *data ATTRIBUTE_UNUSED) {
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);
}
static int testCompareDomstateByName(const void *data ATTRIBUTE_UNUSED) {
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);
......@@ -225,7 +242,8 @@ struct testInfo {
const char *result;
};
static int testCompareEcho(const void *data) {
static int testCompareEcho(const void *data)
{
const struct testInfo *info = data;
return testCompareOutputLit(info->result, NULL, info->argv);
}
......
......@@ -137,7 +137,8 @@ cleanup:
static int
testCheckNdevs(const char* occasion,
size_t got,
size_t expected) {
size_t expected)
{
if (got != expected) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s: got %zu devices, expected %zu",
......
......@@ -69,21 +69,24 @@ testCompareFiles(virArch hostmachine, const char *xml_rel,
return ret;
}
static int testXeni686(const void *data ATTRIBUTE_UNUSED) {
static int testXeni686(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_I686,
"xencapsdata/xen-i686.xml",
"xencapsdata/xen-i686.cpuinfo",
"xencapsdata/xen-i686.caps");
}
static int testXeni686PAE(const void *data ATTRIBUTE_UNUSED) {
static int testXeni686PAE(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_I686,
"xencapsdata/xen-i686-pae.xml",
"xencapsdata/xen-i686-pae.cpuinfo",
"xencapsdata/xen-i686-pae.caps");
}
static int testXeni686PAEHVM(const void *data ATTRIBUTE_UNUSED) {
static int testXeni686PAEHVM(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_I686,
"xencapsdata/xen-i686-pae-hvm.xml",
"xencapsdata/xen-i686-pae-hvm.cpuinfo",
......@@ -93,7 +96,8 @@ static int testXeni686PAEHVM(const void *data ATTRIBUTE_UNUSED) {
/* No PAE + HVM is non-sensical - all VMX capable
CPUs have PAE */
/*
static int testXeni686HVM(const void *data ATTRIBUTE_UNUSED) {
static int testXeni686HVM(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_I686,
"xencapsdata/xen-i686-hvm.xml",
"xencapsdata/xen-i686.cpuinfo",
......@@ -101,46 +105,53 @@ static int testXeni686HVM(const void *data ATTRIBUTE_UNUSED) {
}
*/
static int testXenx86_64(const void *data ATTRIBUTE_UNUSED) {
static int testXenx86_64(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_X86_64,
"xencapsdata/xen-x86_64.xml",
"xencapsdata/xen-x86_64.cpuinfo",
"xencapsdata/xen-x86_64.caps");
}
static int testXenx86_64HVM(const void *data ATTRIBUTE_UNUSED) {
static int testXenx86_64HVM(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_X86_64,
"xencapsdata/xen-x86_64-hvm.xml",
"xencapsdata/xen-x86_64-hvm.cpuinfo",
"xencapsdata/xen-x86_64-hvm.caps");
}
static int testXenia64(const void *data ATTRIBUTE_UNUSED) {
static int testXenia64(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_ITANIUM,
"xencapsdata/xen-ia64.xml",
"xencapsdata/xen-ia64.cpuinfo",
"xencapsdata/xen-ia64.caps");
}
static int testXenia64BE(const void *data ATTRIBUTE_UNUSED) {
static int testXenia64BE(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_ITANIUM,
"xencapsdata/xen-ia64-be.xml",
"xencapsdata/xen-ia64-be.cpuinfo",
"xencapsdata/xen-ia64-be.caps");
}
static int testXenia64HVM(const void *data ATTRIBUTE_UNUSED) {
static int testXenia64HVM(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_ITANIUM,
"xencapsdata/xen-ia64-hvm.xml",
"xencapsdata/xen-ia64-hvm.cpuinfo",
"xencapsdata/xen-ia64-hvm.caps");
}
static int testXenia64BEHVM(const void *data ATTRIBUTE_UNUSED) {
static int testXenia64BEHVM(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_ITANIUM,
"xencapsdata/xen-ia64-be-hvm.xml",
"xencapsdata/xen-ia64-be-hvm.cpuinfo",
"xencapsdata/xen-ia64-be-hvm.caps");
}
static int testXenppc64(const void *data ATTRIBUTE_UNUSED) {
static int testXenppc64(const void *data ATTRIBUTE_UNUSED)
{
return testCompareFiles(VIR_ARCH_PPC64,
"xencapsdata/xen-ppc64.xml",
"xencapsdata/xen-ppc64.cpuinfo",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册