mirror of https://gitee.com/openkylin/libvirt.git
tests/: Remove the whitespace before ";"
This commit is contained in:
parent
e25ca77303
commit
bb3ea8416b
|
@ -65,7 +65,7 @@ int main(int argc, char **argv) {
|
|||
if (!log)
|
||||
goto error;
|
||||
|
||||
for (i = 1 ; i < argc ; i++) {
|
||||
for (i = 1; i < argc; 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);
|
||||
|
||||
for (i = 0 ; i < n ; i++) {
|
||||
for (i = 0; i < n; i++) {
|
||||
/* Ignore the variables used to instruct the loader into
|
||||
* behaving differently, as they could throw the tests off. */
|
||||
if (!STRPREFIX(newenv[i], "LD_"))
|
||||
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 closed;
|
||||
if (i == fileno(log))
|
||||
|
|
|
@ -144,7 +144,7 @@ verifyFired(const char *name, int handle, int timer)
|
|||
int handleFired = 0;
|
||||
int timerFired = 0;
|
||||
int i;
|
||||
for (i = 0 ; i < NUM_FDS ; i++) {
|
||||
for (i = 0; i < NUM_FDS; i++) {
|
||||
if (handles[i].fired) {
|
||||
if (i != handle) {
|
||||
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 (i != timer) {
|
||||
virtTestResult(name, 1,
|
||||
|
@ -248,11 +248,11 @@ static void
|
|||
resetAll(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0 ; i < NUM_FDS ; i++) {
|
||||
for (i = 0; i < NUM_FDS; i++) {
|
||||
handles[i].fired = 0;
|
||||
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].error = EV_ERROR_NONE;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ mymain(void)
|
|||
pthread_t eventThread;
|
||||
char one = '1';
|
||||
|
||||
for (i = 0 ; i < NUM_FDS ; i++) {
|
||||
for (i = 0; i < NUM_FDS; i++) {
|
||||
if (pipe(handles[i].pipeFD) < 0) {
|
||||
fprintf(stderr, "Cannot create pipe: %d", errno);
|
||||
return EXIT_FAILURE;
|
||||
|
@ -282,7 +282,7 @@ mymain(void)
|
|||
|
||||
virEventPollInit();
|
||||
|
||||
for (i = 0 ; i < NUM_FDS ; i++) {
|
||||
for (i = 0; i < NUM_FDS; i++) {
|
||||
handles[i].delete = -1;
|
||||
handles[i].watch =
|
||||
virEventPollAddHandle(handles[i].pipeFD[0],
|
||||
|
@ -291,7 +291,7 @@ mymain(void)
|
|||
&handles[i], NULL);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < NUM_TIME ; i++) {
|
||||
for (i = 0; i < NUM_TIME; i++) {
|
||||
timers[i].delete = -1;
|
||||
timers[i].timeout = -1;
|
||||
timers[i].timer =
|
||||
|
@ -432,9 +432,9 @@ mymain(void)
|
|||
if (finishJob("Deleted during dispatch", -1, 2) != EXIT_SUCCESS)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
for (i = 0 ; i < NUM_FDS - 1 ; i++)
|
||||
for (i = 0; i < NUM_FDS - 1; i++)
|
||||
virEventPollRemoveHandle(handles[i].watch);
|
||||
for (i = 0 ; i < NUM_TIME - 1 ; i++)
|
||||
for (i = 0; i < NUM_TIME - 1; i++)
|
||||
virEventPollRemoveTimeout(timers[i].timer);
|
||||
|
||||
resetAll();
|
||||
|
|
|
@ -60,7 +60,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
|
|||
VIR_ALLOC_N(buf, PATTERN_LEN) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0 ; i < PATTERN_LEN ; i++)
|
||||
for (i = 0; i < PATTERN_LEN; i++)
|
||||
pattern[i] = i;
|
||||
|
||||
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)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0 ; i < 10 ; i++) {
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (safewrite(fd, pattern, PATTERN_LEN) != PATTERN_LEN)
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
|
|||
O_RDONLY) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0 ; i < 10 ; i++) {
|
||||
for (i = 0; i < 10; i++) {
|
||||
size_t offset = 0;
|
||||
size_t want;
|
||||
if (i == 0)
|
||||
|
@ -192,7 +192,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
|
|||
VIR_ALLOC_N(buf, PATTERN_LEN) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0 ; i < PATTERN_LEN ; i++)
|
||||
for (i = 0; i < PATTERN_LEN; i++)
|
||||
pattern[i] = i;
|
||||
|
||||
if (virAsprintf(&file, "%s/input.data", scratchdir) < 0)
|
||||
|
@ -209,7 +209,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
|
|||
O_WRONLY, 0600) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0 ; i < 10 ; i++) {
|
||||
for (i = 0; i < 10; i++) {
|
||||
size_t offset = 0;
|
||||
size_t want;
|
||||
if (i == 0)
|
||||
|
@ -247,7 +247,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
|
|||
if ((fd = open(file, O_RDONLY)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0 ; i < 10 ; i++) {
|
||||
for (i = 0; i < 10; i++) {
|
||||
size_t want;
|
||||
if (i == 9)
|
||||
want = PATTERN_LEN / 2;
|
||||
|
@ -261,7 +261,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
|
|||
|
||||
if (i == 0) {
|
||||
size_t j;
|
||||
for (j = 0 ; j < (PATTERN_LEN / 2) ; j++) {
|
||||
for (j = 0; j < (PATTERN_LEN / 2); j++) {
|
||||
if (buf[j] != 0) {
|
||||
fprintf(stderr, "Mismatched pattern data iteration %zu\n", i);
|
||||
goto cleanup;
|
||||
|
|
|
@ -223,7 +223,7 @@ mymain(void)
|
|||
goto cleanup;
|
||||
}
|
||||
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 };
|
||||
if (virtTestRun("Test corruption", 1, testCorrupt, &data) < 0)
|
||||
ret = -1;
|
||||
|
|
|
@ -139,7 +139,7 @@ mymain(void)
|
|||
if (virInitialize() < 0)
|
||||
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)
|
||||
ret = -1;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ static void printMismatchedFlags(virQEMUCapsPtr got,
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < QEMU_CAPS_LAST ; i++) {
|
||||
for (i = 0; i < QEMU_CAPS_LAST; i++) {
|
||||
bool gotFlag = virQEMUCapsGet(got, i);
|
||||
bool expectFlag = virQEMUCapsGet(expect, i);
|
||||
if (gotFlag && !expectFlag)
|
||||
|
|
|
@ -381,7 +381,7 @@ void qemuMonitorTestFree(qemuMonitorTestPtr test)
|
|||
VIR_FREE(test->incoming);
|
||||
VIR_FREE(test->outgoing);
|
||||
|
||||
for (i = 0 ; i < test->nitems ; i++)
|
||||
for (i = 0; i < test->nitems; i++)
|
||||
qemuMonitorTestItemFree(test->items[i]);
|
||||
VIR_FREE(test->items);
|
||||
|
||||
|
|
|
@ -263,13 +263,13 @@ testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
|
|||
};
|
||||
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)
|
||||
return -1;
|
||||
}
|
||||
if (skipLegacy)
|
||||
return 0;
|
||||
for (i = 0 ; i < ARRAY_CARDINALITY(legacyModels) ; i++) {
|
||||
for (i = 0; i < ARRAY_CARDINALITY(legacyModels); i++) {
|
||||
if (virQEMUCapsAddCPUDefinition(caps, legacyModels[i]) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ testSELinuxLoadDef(const char *testname)
|
|||
0)))
|
||||
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 &&
|
||||
def->disks[i]->type != VIR_DOMAIN_DISK_TYPE_BLOCK)
|
||||
continue;
|
||||
|
@ -178,7 +178,7 @@ testSELinuxLoadDef(const char *testname)
|
|||
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 &&
|
||||
def->serials[i]->source.type != VIR_DOMAIN_CHR_TYPE_PIPE &&
|
||||
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)
|
||||
return -1;
|
||||
|
||||
for (i = 0 ; i < nfiles ; i++) {
|
||||
for (i = 0; i < nfiles; i++) {
|
||||
if (virFileTouch(files[i].file, 0600) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ testSELinuxDeleteDisks(testSELinuxFile *files, size_t nfiles)
|
|||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0 ; i < nfiles ; i++) {
|
||||
for (i = 0; i < nfiles; i++) {
|
||||
if (unlink(files[i].file) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ testSELinuxCheckLabels(testSELinuxFile *files, size_t nfiles)
|
|||
size_t i;
|
||||
security_context_t ctx;
|
||||
|
||||
for (i = 0 ; i < nfiles ; i++) {
|
||||
for (i = 0; i < nfiles; i++) {
|
||||
if (getfilecon(files[i].file, &ctx) < 0) {
|
||||
if (errno == ENODATA) {
|
||||
ctx = NULL;
|
||||
|
@ -294,7 +294,7 @@ cleanup:
|
|||
goto cleanup;
|
||||
|
||||
virDomainDefFree(def);
|
||||
for (i = 0 ; i < nfiles; i++) {
|
||||
for (i = 0; i < nfiles; i++) {
|
||||
VIR_FREE(files[i].file);
|
||||
VIR_FREE(files[i].context);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ int main(int argc, char **argv)
|
|||
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 */
|
||||
|
||||
for (i = 1 ; i < argc ; i++) {
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (STREQ(argv[i], "nosuchhost"))
|
||||
failConnect = 1;
|
||||
else if (STREQ(argv[i], "crashinghost"))
|
||||
|
@ -50,7 +50,7 @@ int main(int argc, char **argv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
for (i = 1 ; i < argc ; i++)
|
||||
for (i = 1; i < argc; i++)
|
||||
printf("%s%c", argv[i], i == (argc -1) ? '\n' : ' ');
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -420,7 +420,7 @@ int virtTestDifferenceBin(FILE *stream,
|
|||
|
||||
if (virTestGetDebug() < 2) {
|
||||
/* Skip to first character where they differ */
|
||||
for (i = 0 ; i < length ; i++) {
|
||||
for (i = 0; i < length; i++) {
|
||||
if (expect[i] != actual[i]) {
|
||||
start = i;
|
||||
break;
|
||||
|
@ -428,7 +428,7 @@ int virtTestDifferenceBin(FILE *stream,
|
|||
}
|
||||
|
||||
/* 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]) {
|
||||
end = i;
|
||||
break;
|
||||
|
@ -443,14 +443,14 @@ int virtTestDifferenceBin(FILE *stream,
|
|||
|
||||
/* Show the trimmed differences */
|
||||
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)
|
||||
fprintf(stream, "\n ");
|
||||
fprintf(stream, "0x%02x, ", ((int)expect[i])&0xff);
|
||||
}
|
||||
fprintf(stream, "]\n");
|
||||
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)
|
||||
fprintf(stream, "\n ");
|
||||
fprintf(stream, "0x%02x, ", ((int)actual[i])&0xff);
|
||||
|
@ -530,7 +530,7 @@ virtTestErrorHook(int n, void *data ATTRIBUTE_UNUSED)
|
|||
symbols = backtrace_symbols(trace, ntrace);
|
||||
if (symbols) {
|
||||
fprintf(stderr, "Failing allocation %d at:\n", n);
|
||||
for (i = 0 ; i < ntrace ; i++) {
|
||||
for (i = 0; i < ntrace; i++) {
|
||||
if (symbols[i])
|
||||
fprintf(stderr, " TRACE: %s\n", symbols[i]);
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ int virtTestMain(int argc,
|
|||
|
||||
if (mp) {
|
||||
int i;
|
||||
for (i = 0 ; i < mp ; i++) {
|
||||
for (i = 0; i < mp; i++) {
|
||||
workers[i] = fork();
|
||||
if (workers[i] == 0) {
|
||||
worker = i + 1;
|
||||
|
@ -677,7 +677,7 @@ int virtTestMain(int argc,
|
|||
|
||||
/* Run once for each alloc, failing a different one
|
||||
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 &&
|
||||
(n % mp) != (worker - 1))
|
||||
continue;
|
||||
|
@ -701,7 +701,7 @@ int virtTestMain(int argc,
|
|||
_exit(ret);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0 ; i < mp ; i++) {
|
||||
for (i = 0; i < mp; i++) {
|
||||
if (virProcessWait(workers[i], NULL) < 0)
|
||||
ret = EXIT_FAILURE;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ static int validateCgroup(virCgroupPtr cgroup,
|
|||
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],
|
||||
cgroup->controllers[i].mountPoint)) {
|
||||
fprintf(stderr, "Wrong mount '%s', expected '%s' for '%s'\n",
|
||||
|
|
|
@ -86,7 +86,7 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
|
|||
|
||||
freeifaddrs(ifaddr);
|
||||
|
||||
for (i = 0 ; i < 50 ; i++) {
|
||||
for (i = 0; i < 50; i++) {
|
||||
int only = 1;
|
||||
if ((s4 = socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
||||
goto cleanup;
|
||||
|
@ -165,7 +165,7 @@ static int testSocketTCPAccept(const void *opaque)
|
|||
if (virNetSocketNewListenTCP(data->lnode, portstr, &lsock, &nlsock) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0 ; i < nlsock ; i++) {
|
||||
for (i = 0; i < nlsock; i++) {
|
||||
if (virNetSocketListen(lsock[i], 0) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ static int testSocketTCPAccept(const void *opaque)
|
|||
|
||||
virObjectUnref(csock);
|
||||
|
||||
for (i = 0 ; i < nlsock ; i++) {
|
||||
for (i = 0; i < nlsock; i++) {
|
||||
if (virNetSocketAccept(lsock[i], &ssock) != -1 && ssock) {
|
||||
char c = 'a';
|
||||
if (virNetSocketWrite(ssock, &c, 1) != -1 &&
|
||||
|
@ -192,7 +192,7 @@ static int testSocketTCPAccept(const void *opaque)
|
|||
|
||||
cleanup:
|
||||
virObjectUnref(ssock);
|
||||
for (i = 0 ; i < nlsock ; i++)
|
||||
for (i = 0; i < nlsock; i++)
|
||||
virObjectUnref(lsock[i]);
|
||||
VIR_FREE(lsock);
|
||||
return ret;
|
||||
|
@ -346,7 +346,7 @@ static int testSocketCommandNormal(const void *data ATTRIBUTE_UNUSED)
|
|||
if (virNetSocketRead(csock, buf, sizeof(buf)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0 ; i < sizeof(buf) ; i++)
|
||||
for (i = 0; i < sizeof(buf); i++)
|
||||
if (buf[i] != '\0')
|
||||
goto cleanup;
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ static int testURIParse(const void *args)
|
|||
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)) {
|
||||
VIR_DEBUG("Expected param name %zu '%s', actual '%s'",
|
||||
i, data->params[i].name, uri->params[i].name);
|
||||
|
|
Loading…
Reference in New Issue