tests/: Remove the whitespace before ";"

This commit is contained in:
Osier Yang 2013-05-21 15:53:48 +08:00
parent e25ca77303
commit bb3ea8416b
14 changed files with 48 additions and 48 deletions

View File

@ -65,7 +65,7 @@ int main(int argc, char **argv) {
if (!log) if (!log)
goto error; goto error;
for (i = 1 ; i < argc ; i++) { for (i = 1; i < argc; i++) {
fprintf(log, "ARG:%s\n", argv[i]); fprintf(log, "ARG:%s\n", argv[i]);
} }
@ -88,14 +88,14 @@ int main(int argc, char **argv) {
} }
qsort(newenv, n, sizeof(newenv[0]), envsort); qsort(newenv, n, sizeof(newenv[0]), envsort);
for (i = 0 ; i < n ; i++) { for (i = 0; i < n; i++) {
/* Ignore the variables used to instruct the loader into /* Ignore the variables used to instruct the loader into
* behaving differently, as they could throw the tests off. */ * behaving differently, as they could throw the tests off. */
if (!STRPREFIX(newenv[i], "LD_")) if (!STRPREFIX(newenv[i], "LD_"))
fprintf(log, "ENV:%s\n", newenv[i]); fprintf(log, "ENV:%s\n", newenv[i]);
} }
for (i = 0 ; i < sysconf(_SC_OPEN_MAX) ; i++) { for (i = 0; i < sysconf(_SC_OPEN_MAX); i++) {
int f; int f;
int closed; int closed;
if (i == fileno(log)) if (i == fileno(log))

View File

@ -144,7 +144,7 @@ verifyFired(const char *name, int handle, int timer)
int handleFired = 0; int handleFired = 0;
int timerFired = 0; int timerFired = 0;
int i; int i;
for (i = 0 ; i < NUM_FDS ; i++) { for (i = 0; i < NUM_FDS; i++) {
if (handles[i].fired) { if (handles[i].fired) {
if (i != handle) { if (i != handle) {
virtTestResult(name, 1, virtTestResult(name, 1,
@ -177,7 +177,7 @@ verifyFired(const char *name, int handle, int timer)
} }
for (i = 0 ; i < NUM_TIME ; i++) { for (i = 0; i < NUM_TIME; i++) {
if (timers[i].fired) { if (timers[i].fired) {
if (i != timer) { if (i != timer) {
virtTestResult(name, 1, virtTestResult(name, 1,
@ -248,11 +248,11 @@ static void
resetAll(void) resetAll(void)
{ {
int i; int i;
for (i = 0 ; i < NUM_FDS ; i++) { for (i = 0; i < NUM_FDS; i++) {
handles[i].fired = 0; handles[i].fired = 0;
handles[i].error = EV_ERROR_NONE; handles[i].error = EV_ERROR_NONE;
} }
for (i = 0 ; i < NUM_TIME ; i++) { for (i = 0; i < NUM_TIME; i++) {
timers[i].fired = 0; timers[i].fired = 0;
timers[i].error = EV_ERROR_NONE; timers[i].error = EV_ERROR_NONE;
} }
@ -265,7 +265,7 @@ mymain(void)
pthread_t eventThread; pthread_t eventThread;
char one = '1'; char one = '1';
for (i = 0 ; i < NUM_FDS ; i++) { for (i = 0; i < NUM_FDS; i++) {
if (pipe(handles[i].pipeFD) < 0) { if (pipe(handles[i].pipeFD) < 0) {
fprintf(stderr, "Cannot create pipe: %d", errno); fprintf(stderr, "Cannot create pipe: %d", errno);
return EXIT_FAILURE; return EXIT_FAILURE;
@ -282,7 +282,7 @@ mymain(void)
virEventPollInit(); virEventPollInit();
for (i = 0 ; i < NUM_FDS ; i++) { for (i = 0; i < NUM_FDS; i++) {
handles[i].delete = -1; handles[i].delete = -1;
handles[i].watch = handles[i].watch =
virEventPollAddHandle(handles[i].pipeFD[0], virEventPollAddHandle(handles[i].pipeFD[0],
@ -291,7 +291,7 @@ mymain(void)
&handles[i], NULL); &handles[i], NULL);
} }
for (i = 0 ; i < NUM_TIME ; i++) { for (i = 0; i < NUM_TIME; i++) {
timers[i].delete = -1; timers[i].delete = -1;
timers[i].timeout = -1; timers[i].timeout = -1;
timers[i].timer = timers[i].timer =
@ -432,9 +432,9 @@ mymain(void)
if (finishJob("Deleted during dispatch", -1, 2) != EXIT_SUCCESS) if (finishJob("Deleted during dispatch", -1, 2) != EXIT_SUCCESS)
return EXIT_FAILURE; return EXIT_FAILURE;
for (i = 0 ; i < NUM_FDS - 1 ; i++) for (i = 0; i < NUM_FDS - 1; i++)
virEventPollRemoveHandle(handles[i].watch); virEventPollRemoveHandle(handles[i].watch);
for (i = 0 ; i < NUM_TIME - 1 ; i++) for (i = 0; i < NUM_TIME - 1; i++)
virEventPollRemoveTimeout(timers[i].timer); virEventPollRemoveTimeout(timers[i].timer);
resetAll(); resetAll();

View File

@ -60,7 +60,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
VIR_ALLOC_N(buf, PATTERN_LEN) < 0) VIR_ALLOC_N(buf, PATTERN_LEN) < 0)
goto cleanup; goto cleanup;
for (i = 0 ; i < PATTERN_LEN ; i++) for (i = 0; i < PATTERN_LEN; i++)
pattern[i] = i; pattern[i] = i;
if (virAsprintf(&file, "%s/input.data", scratchdir) < 0) if (virAsprintf(&file, "%s/input.data", scratchdir) < 0)
@ -69,7 +69,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
if ((fd = open(file, O_CREAT|O_WRONLY|O_EXCL, 0600)) < 0) if ((fd = open(file, O_CREAT|O_WRONLY|O_EXCL, 0600)) < 0)
goto cleanup; goto cleanup;
for (i = 0 ; i < 10 ; i++) { for (i = 0; i < 10; i++) {
if (safewrite(fd, pattern, PATTERN_LEN) != PATTERN_LEN) if (safewrite(fd, pattern, PATTERN_LEN) != PATTERN_LEN)
goto cleanup; goto cleanup;
} }
@ -88,7 +88,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
O_RDONLY) < 0) O_RDONLY) < 0)
goto cleanup; goto cleanup;
for (i = 0 ; i < 10 ; i++) { for (i = 0; i < 10; i++) {
size_t offset = 0; size_t offset = 0;
size_t want; size_t want;
if (i == 0) if (i == 0)
@ -192,7 +192,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
VIR_ALLOC_N(buf, PATTERN_LEN) < 0) VIR_ALLOC_N(buf, PATTERN_LEN) < 0)
goto cleanup; goto cleanup;
for (i = 0 ; i < PATTERN_LEN ; i++) for (i = 0; i < PATTERN_LEN; i++)
pattern[i] = i; pattern[i] = i;
if (virAsprintf(&file, "%s/input.data", scratchdir) < 0) if (virAsprintf(&file, "%s/input.data", scratchdir) < 0)
@ -209,7 +209,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
O_WRONLY, 0600) < 0) O_WRONLY, 0600) < 0)
goto cleanup; goto cleanup;
for (i = 0 ; i < 10 ; i++) { for (i = 0; i < 10; i++) {
size_t offset = 0; size_t offset = 0;
size_t want; size_t want;
if (i == 0) if (i == 0)
@ -247,7 +247,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
if ((fd = open(file, O_RDONLY)) < 0) if ((fd = open(file, O_RDONLY)) < 0)
goto cleanup; goto cleanup;
for (i = 0 ; i < 10 ; i++) { for (i = 0; i < 10; i++) {
size_t want; size_t want;
if (i == 9) if (i == 9)
want = PATTERN_LEN / 2; want = PATTERN_LEN / 2;
@ -261,7 +261,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
if (i == 0) { if (i == 0) {
size_t j; size_t j;
for (j = 0 ; j < (PATTERN_LEN / 2) ; j++) { for (j = 0; j < (PATTERN_LEN / 2); j++) {
if (buf[j] != 0) { if (buf[j] != 0) {
fprintf(stderr, "Mismatched pattern data iteration %zu\n", i); fprintf(stderr, "Mismatched pattern data iteration %zu\n", i);
goto cleanup; goto cleanup;

View File

@ -223,7 +223,7 @@ mymain(void)
goto cleanup; goto cleanup;
} }
VIR_DEBUG("Initial config [%s]", filedata); VIR_DEBUG("Initial config [%s]", filedata);
for (i = 0 ; params[i] != 0 ; i++) { for (i = 0; params[i] != 0; i++) {
const struct testCorruptData data = { params, filedata, filename, i }; const struct testCorruptData data = { params, filedata, filename, i };
if (virtTestRun("Test corruption", 1, testCorrupt, &data) < 0) if (virtTestRun("Test corruption", 1, testCorrupt, &data) < 0)
ret = -1; ret = -1;

View File

@ -139,7 +139,7 @@ mymain(void)
if (virInitialize() < 0) if (virInitialize() < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
for (i = 0 ; i < ARRAY_CARDINALITY(nodeData); i++) for (i = 0; i < ARRAY_CARDINALITY(nodeData); i++)
if (virtTestRun(nodeData[i], 1, linuxTestNodeInfo, nodeData[i]) != 0) if (virtTestRun(nodeData[i], 1, linuxTestNodeInfo, nodeData[i]) != 0)
ret = -1; ret = -1;

View File

@ -24,7 +24,7 @@ static void printMismatchedFlags(virQEMUCapsPtr got,
{ {
int i; int i;
for (i = 0 ; i < QEMU_CAPS_LAST ; i++) { for (i = 0; i < QEMU_CAPS_LAST; i++) {
bool gotFlag = virQEMUCapsGet(got, i); bool gotFlag = virQEMUCapsGet(got, i);
bool expectFlag = virQEMUCapsGet(expect, i); bool expectFlag = virQEMUCapsGet(expect, i);
if (gotFlag && !expectFlag) if (gotFlag && !expectFlag)

View File

@ -381,7 +381,7 @@ void qemuMonitorTestFree(qemuMonitorTestPtr test)
VIR_FREE(test->incoming); VIR_FREE(test->incoming);
VIR_FREE(test->outgoing); VIR_FREE(test->outgoing);
for (i = 0 ; i < test->nitems ; i++) for (i = 0; i < test->nitems; i++)
qemuMonitorTestItemFree(test->items[i]); qemuMonitorTestItemFree(test->items[i]);
VIR_FREE(test->items); VIR_FREE(test->items);

View File

@ -263,13 +263,13 @@ testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
}; };
size_t i; size_t i;
for (i = 0 ; i < ARRAY_CARDINALITY(newModels) ; i++) { for (i = 0; i < ARRAY_CARDINALITY(newModels); i++) {
if (virQEMUCapsAddCPUDefinition(caps, newModels[i]) < 0) if (virQEMUCapsAddCPUDefinition(caps, newModels[i]) < 0)
return -1; return -1;
} }
if (skipLegacy) if (skipLegacy)
return 0; return 0;
for (i = 0 ; i < ARRAY_CARDINALITY(legacyModels) ; i++) { for (i = 0; i < ARRAY_CARDINALITY(legacyModels); i++) {
if (virQEMUCapsAddCPUDefinition(caps, legacyModels[i]) < 0) if (virQEMUCapsAddCPUDefinition(caps, legacyModels[i]) < 0)
return -1; return -1;
} }

View File

@ -169,7 +169,7 @@ testSELinuxLoadDef(const char *testname)
0))) 0)))
goto cleanup; goto cleanup;
for (i = 0 ; i < def->ndisks ; i++) { for (i = 0; i < def->ndisks; i++) {
if (def->disks[i]->type != VIR_DOMAIN_DISK_TYPE_FILE && if (def->disks[i]->type != VIR_DOMAIN_DISK_TYPE_FILE &&
def->disks[i]->type != VIR_DOMAIN_DISK_TYPE_BLOCK) def->disks[i]->type != VIR_DOMAIN_DISK_TYPE_BLOCK)
continue; continue;
@ -178,7 +178,7 @@ testSELinuxLoadDef(const char *testname)
goto cleanup; goto cleanup;
} }
for (i = 0 ; i < def->nserials ; i++) { for (i = 0; i < def->nserials; i++) {
if (def->serials[i]->source.type != VIR_DOMAIN_CHR_TYPE_FILE && if (def->serials[i]->source.type != VIR_DOMAIN_CHR_TYPE_FILE &&
def->serials[i]->source.type != VIR_DOMAIN_CHR_TYPE_PIPE && def->serials[i]->source.type != VIR_DOMAIN_CHR_TYPE_PIPE &&
def->serials[i]->source.type != VIR_DOMAIN_CHR_TYPE_DEV && def->serials[i]->source.type != VIR_DOMAIN_CHR_TYPE_DEV &&
@ -216,7 +216,7 @@ testSELinuxCreateDisks(testSELinuxFile *files, size_t nfiles)
if (virFileMakePath(abs_builddir "/securityselinuxlabeldata") < 0) if (virFileMakePath(abs_builddir "/securityselinuxlabeldata") < 0)
return -1; return -1;
for (i = 0 ; i < nfiles ; i++) { for (i = 0; i < nfiles; i++) {
if (virFileTouch(files[i].file, 0600) < 0) if (virFileTouch(files[i].file, 0600) < 0)
return -1; return -1;
} }
@ -228,7 +228,7 @@ testSELinuxDeleteDisks(testSELinuxFile *files, size_t nfiles)
{ {
size_t i; size_t i;
for (i = 0 ; i < nfiles ; i++) { for (i = 0; i < nfiles; i++) {
if (unlink(files[i].file) < 0) if (unlink(files[i].file) < 0)
return -1; return -1;
} }
@ -241,7 +241,7 @@ testSELinuxCheckLabels(testSELinuxFile *files, size_t nfiles)
size_t i; size_t i;
security_context_t ctx; security_context_t ctx;
for (i = 0 ; i < nfiles ; i++) { for (i = 0; i < nfiles; i++) {
if (getfilecon(files[i].file, &ctx) < 0) { if (getfilecon(files[i].file, &ctx) < 0) {
if (errno == ENODATA) { if (errno == ENODATA) {
ctx = NULL; ctx = NULL;
@ -294,7 +294,7 @@ cleanup:
goto cleanup; goto cleanup;
virDomainDefFree(def); virDomainDefFree(def);
for (i = 0 ; i < nfiles; i++) { for (i = 0; i < nfiles; i++) {
VIR_FREE(files[i].file); VIR_FREE(files[i].file);
VIR_FREE(files[i].context); VIR_FREE(files[i].context);
} }

View File

@ -32,7 +32,7 @@ int main(int argc, char **argv)
int failConnect = 0; /* Exit -1, with no data on stdout, msg on stderr */ int failConnect = 0; /* Exit -1, with no data on stdout, msg on stderr */
int dieEarly = 0; /* Exit -1, with partial data on stdout, msg on stderr */ int dieEarly = 0; /* Exit -1, with partial data on stdout, msg on stderr */
for (i = 1 ; i < argc ; i++) { for (i = 1; i < argc; i++) {
if (STREQ(argv[i], "nosuchhost")) if (STREQ(argv[i], "nosuchhost"))
failConnect = 1; failConnect = 1;
else if (STREQ(argv[i], "crashinghost")) else if (STREQ(argv[i], "crashinghost"))
@ -50,7 +50,7 @@ int main(int argc, char **argv)
return -1; return -1;
} }
for (i = 1 ; i < argc ; i++) for (i = 1; i < argc; i++)
printf("%s%c", argv[i], i == (argc -1) ? '\n' : ' '); printf("%s%c", argv[i], i == (argc -1) ? '\n' : ' ');
return 0; return 0;

View File

@ -420,7 +420,7 @@ int virtTestDifferenceBin(FILE *stream,
if (virTestGetDebug() < 2) { if (virTestGetDebug() < 2) {
/* Skip to first character where they differ */ /* Skip to first character where they differ */
for (i = 0 ; i < length ; i++) { for (i = 0; i < length; i++) {
if (expect[i] != actual[i]) { if (expect[i] != actual[i]) {
start = i; start = i;
break; break;
@ -428,7 +428,7 @@ int virtTestDifferenceBin(FILE *stream,
} }
/* Work backwards to last character where they differ */ /* Work backwards to last character where they differ */
for (i = (length -1) ; i >= 0 ; i--) { for (i = (length -1); i >= 0; i--) {
if (expect[i] != actual[i]) { if (expect[i] != actual[i]) {
end = i; end = i;
break; break;
@ -443,14 +443,14 @@ int virtTestDifferenceBin(FILE *stream,
/* Show the trimmed differences */ /* Show the trimmed differences */
fprintf(stream, "\nExpect [ Region %d-%d", (int)start, (int)end); fprintf(stream, "\nExpect [ Region %d-%d", (int)start, (int)end);
for (i = start; i < end ; i++) { for (i = start; i < end; i++) {
if ((i % 4) == 0) if ((i % 4) == 0)
fprintf(stream, "\n "); fprintf(stream, "\n ");
fprintf(stream, "0x%02x, ", ((int)expect[i])&0xff); fprintf(stream, "0x%02x, ", ((int)expect[i])&0xff);
} }
fprintf(stream, "]\n"); fprintf(stream, "]\n");
fprintf(stream, "Actual [ Region %d-%d", (int)start, (int)end); fprintf(stream, "Actual [ Region %d-%d", (int)start, (int)end);
for (i = start; i < end ; i++) { for (i = start; i < end; i++) {
if ((i % 4) == 0) if ((i % 4) == 0)
fprintf(stream, "\n "); fprintf(stream, "\n ");
fprintf(stream, "0x%02x, ", ((int)actual[i])&0xff); fprintf(stream, "0x%02x, ", ((int)actual[i])&0xff);
@ -530,7 +530,7 @@ virtTestErrorHook(int n, void *data ATTRIBUTE_UNUSED)
symbols = backtrace_symbols(trace, ntrace); symbols = backtrace_symbols(trace, ntrace);
if (symbols) { if (symbols) {
fprintf(stderr, "Failing allocation %d at:\n", n); fprintf(stderr, "Failing allocation %d at:\n", n);
for (i = 0 ; i < ntrace ; i++) { for (i = 0; i < ntrace; i++) {
if (symbols[i]) if (symbols[i])
fprintf(stderr, " TRACE: %s\n", symbols[i]); fprintf(stderr, " TRACE: %s\n", symbols[i]);
} }
@ -666,7 +666,7 @@ int virtTestMain(int argc,
if (mp) { if (mp) {
int i; int i;
for (i = 0 ; i < mp ; i++) { for (i = 0; i < mp; i++) {
workers[i] = fork(); workers[i] = fork();
if (workers[i] == 0) { if (workers[i] == 0) {
worker = i + 1; worker = i + 1;
@ -677,7 +677,7 @@ int virtTestMain(int argc,
/* Run once for each alloc, failing a different one /* Run once for each alloc, failing a different one
and validating that the test case failed */ and validating that the test case failed */
for (n = 0; n < approxAlloc && (!mp || worker) ; n++) { for (n = 0; n < approxAlloc && (!mp || worker); n++) {
if (mp && if (mp &&
(n % mp) != (worker - 1)) (n % mp) != (worker - 1))
continue; continue;
@ -701,7 +701,7 @@ int virtTestMain(int argc,
_exit(ret); _exit(ret);
} else { } else {
int i; int i;
for (i = 0 ; i < mp ; i++) { for (i = 0; i < mp; i++) {
if (virProcessWait(workers[i], NULL) < 0) if (virProcessWait(workers[i], NULL) < 0)
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
} }

View File

@ -49,7 +49,7 @@ static int validateCgroup(virCgroupPtr cgroup,
return -1; return -1;
} }
for (i = 0 ; i < VIR_CGROUP_CONTROLLER_LAST ; i++) { for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
if (STRNEQ_NULLABLE(expectMountPoint[i], if (STRNEQ_NULLABLE(expectMountPoint[i],
cgroup->controllers[i].mountPoint)) { cgroup->controllers[i].mountPoint)) {
fprintf(stderr, "Wrong mount '%s', expected '%s' for '%s'\n", fprintf(stderr, "Wrong mount '%s', expected '%s' for '%s'\n",

View File

@ -86,7 +86,7 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
freeifaddrs(ifaddr); freeifaddrs(ifaddr);
for (i = 0 ; i < 50 ; i++) { for (i = 0; i < 50; i++) {
int only = 1; int only = 1;
if ((s4 = socket(AF_INET, SOCK_STREAM, 0)) < 0) if ((s4 = socket(AF_INET, SOCK_STREAM, 0)) < 0)
goto cleanup; goto cleanup;
@ -165,7 +165,7 @@ static int testSocketTCPAccept(const void *opaque)
if (virNetSocketNewListenTCP(data->lnode, portstr, &lsock, &nlsock) < 0) if (virNetSocketNewListenTCP(data->lnode, portstr, &lsock, &nlsock) < 0)
goto cleanup; goto cleanup;
for (i = 0 ; i < nlsock ; i++) { for (i = 0; i < nlsock; i++) {
if (virNetSocketListen(lsock[i], 0) < 0) if (virNetSocketListen(lsock[i], 0) < 0)
goto cleanup; goto cleanup;
} }
@ -175,7 +175,7 @@ static int testSocketTCPAccept(const void *opaque)
virObjectUnref(csock); virObjectUnref(csock);
for (i = 0 ; i < nlsock ; i++) { for (i = 0; i < nlsock; i++) {
if (virNetSocketAccept(lsock[i], &ssock) != -1 && ssock) { if (virNetSocketAccept(lsock[i], &ssock) != -1 && ssock) {
char c = 'a'; char c = 'a';
if (virNetSocketWrite(ssock, &c, 1) != -1 && if (virNetSocketWrite(ssock, &c, 1) != -1 &&
@ -192,7 +192,7 @@ static int testSocketTCPAccept(const void *opaque)
cleanup: cleanup:
virObjectUnref(ssock); virObjectUnref(ssock);
for (i = 0 ; i < nlsock ; i++) for (i = 0; i < nlsock; i++)
virObjectUnref(lsock[i]); virObjectUnref(lsock[i]);
VIR_FREE(lsock); VIR_FREE(lsock);
return ret; return ret;
@ -346,7 +346,7 @@ static int testSocketCommandNormal(const void *data ATTRIBUTE_UNUSED)
if (virNetSocketRead(csock, buf, sizeof(buf)) < 0) if (virNetSocketRead(csock, buf, sizeof(buf)) < 0)
goto cleanup; goto cleanup;
for (i = 0 ; i < sizeof(buf) ; i++) for (i = 0; i < sizeof(buf); i++)
if (buf[i] != '\0') if (buf[i] != '\0')
goto cleanup; goto cleanup;

View File

@ -92,7 +92,7 @@ static int testURIParse(const void *args)
goto cleanup; goto cleanup;
} }
for (i = 0 ; data->params && data->params[i].name && i < uri->paramsCount ; i++) { for (i = 0; data->params && data->params[i].name && i < uri->paramsCount; i++) {
if (!STREQ_NULLABLE(data->params[i].name, uri->params[i].name)) { if (!STREQ_NULLABLE(data->params[i].name, uri->params[i].name)) {
VIR_DEBUG("Expected param name %zu '%s', actual '%s'", VIR_DEBUG("Expected param name %zu '%s', actual '%s'",
i, data->params[i].name, uri->params[i].name); i, data->params[i].name, uri->params[i].name);