diff --git a/tests/commandhelper.c b/tests/commandhelper.c index 86ed8915c99d9d17035276a2a1742c12d701f540..015efdaa6618f9df42de5b5590bcd67f17eb0c8b 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -70,9 +70,8 @@ int main(int argc, char **argv) { if (!log) goto cleanup; - for (i = 1; i < argc; i++) { + for (i = 1; i < argc; i++) fprintf(log, "ARG:%s\n", argv[i]); - } origenv = environ; n = 0; diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c index 41c08075d2ffc9b5b1df1602ba29bb4e55bbc8cc..44bdc849d99e2a2aeb46693a0696fee299b45b3b 100644 --- a/tests/esxutilstest.c +++ b/tests/esxutilstest.c @@ -54,9 +54,8 @@ testParseDatastorePath(const void *data ATTRIBUTE_UNUSED) goto failure; } - if (paths[i].result < 0) { + if (paths[i].result < 0) continue; - } if (STRNEQ(paths[i].datastoreName, datastoreName)) { virtTestDifference(stderr, paths[i].datastoreName, datastoreName); @@ -138,9 +137,8 @@ testConvertDateTimeToCalendarTime(const void *data ATTRIBUTE_UNUSED) return -1; } - if (times[i].calendarTime != calendarTime) { + if (times[i].calendarTime != calendarTime) return -1; - } } return 0; @@ -186,9 +184,8 @@ testEscapeDatastoreItem(const void *data ATTRIBUTE_UNUSED) escaped = esxUtil_EscapeDatastoreItem(datastoreItems[i].string); - if (escaped == NULL) { + if (escaped == NULL) return -1; - } if (STRNEQ(datastoreItems[i].escaped, escaped)) { VIR_FREE(escaped); @@ -228,9 +225,8 @@ testConvertWindows1252ToUTF8(const void *data ATTRIBUTE_UNUSED) utf8 = virVMXConvertToUTF8("Windows-1252", windows1252ToUTF8[i].windows1252); - if (utf8 == NULL) { + if (utf8 == NULL) return -1; - } if (STRNEQ(windows1252ToUTF8[i].utf8, utf8)) { VIR_FREE(utf8); diff --git a/tests/eventtest.c b/tests/eventtest.c index 87b49d3315c249b130e41bcad92478e6bf341c12..13adbf6721fc5024cce42df42ccf8b178d4d6cd4 100644 --- a/tests/eventtest.c +++ b/tests/eventtest.c @@ -124,9 +124,8 @@ static int eventThreadJobDone; ATTRIBUTE_NORETURN static void *eventThreadLoop(void *data ATTRIBUTE_UNUSED) { while (1) { pthread_mutex_lock(&eventThreadMutex); - while (!eventThreadRunOnce) { + while (!eventThreadRunOnce) pthread_cond_wait(&eventThreadRunCond, &eventThreadMutex); - } eventThreadRunOnce = 0; pthread_mutex_unlock(&eventThreadMutex); diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c index ed2c098862207df59233cf9036681826912efc73..f5a8d12f7e2133ebddbee37025b091d064f99c95 100644 --- a/tests/openvzutilstest.c +++ b/tests/openvzutilstest.c @@ -42,9 +42,8 @@ testReadConfigParam(const void *data ATTRIBUTE_UNUSED) char *conf = NULL; char *value = NULL; - if (virAsprintf(&conf, "%s/openvzutilstest.conf", abs_srcdir) < 0) { + if (virAsprintf(&conf, "%s/openvzutilstest.conf", abs_srcdir) < 0) return -1; - } for (i = 0; i < ARRAY_CARDINALITY(configParams); ++i) { if (openvzReadConfigParam(conf, configParams[i].param, @@ -52,9 +51,8 @@ testReadConfigParam(const void *data ATTRIBUTE_UNUSED) goto cleanup; } - if (configParams[i].ret != 1) { + if (configParams[i].ret != 1) continue; - } if (STRNEQ(configParams[i].value, value)) { virtTestDifference(stderr, configParams[i].value, value); diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c index 455eb74caf43363af21b977f4f8fda3c4d3e7689..8106c776d68af98ed800ddbf8c99ec1eaa53cc94 100644 --- a/tests/securityselinuxlabeltest.c +++ b/tests/securityselinuxlabeltest.c @@ -120,9 +120,8 @@ testSELinuxLoadFileList(const char *testname, abs_srcdir, testname) < 0) goto cleanup; - if (!(fp = fopen(path, "r"))) { + if (!(fp = fopen(path, "r"))) goto cleanup; - } if (VIR_ALLOC_N(line, 1024) < 0) goto cleanup; @@ -191,9 +190,8 @@ testSELinuxLoadDef(const char *testname) abs_srcdir, testname) < 0) goto cleanup; - if (virFileReadAll(xmlfile, 1024*1024, &xmlstr) < 0) { + if (virFileReadAll(xmlfile, 1024*1024, &xmlstr) < 0) goto cleanup; - } if (!(def = virDomainDefParseString(xmlstr, caps, xmlopt, QEMU_EXPECTED_VIRT_TYPES, diff --git a/tests/shunloadtest.c b/tests/shunloadtest.c index 80f535134f04bae59821a2eb31b8167884abdfd0..37d990d71b7d57c065b3bd95581ef3057179a998 100644 --- a/tests/shunloadtest.c +++ b/tests/shunloadtest.c @@ -74,9 +74,8 @@ static void *threadMain(void *arg) pthread_cond_signal(&cond); } - while (!quit) { + while (!quit) pthread_cond_wait(&cond, &lock); - } pthread_mutex_unlock(&lock); return NULL; @@ -126,9 +125,8 @@ int main(int argc ATTRIBUTE_UNUSED, char **argv) /* Wait for the thread to start and call libvirt */ pthread_mutex_lock(&lock); - while (!running && !failstart) { + while (!running && !failstart) pthread_cond_wait(&cond, &lock); - } /* Close the shared library (and thus make libvirt.so * non-resident */ diff --git a/tests/utiltest.c b/tests/utiltest.c index 89e82aac797da7ad1e53939d1711b1474d1ef209..8950cf2f30631443af642deca2e83055a6bccf8e 100644 --- a/tests/utiltest.c +++ b/tests/utiltest.c @@ -124,9 +124,8 @@ testParseVersionString(const void *data ATTRIBUTE_UNUSED) return -1; } - if (result < 0) { + if (result < 0) continue; - } if (version != versions[i].version) { if (virTestGetDebug() > 0) { diff --git a/tests/virbuftest.c b/tests/virbuftest.c index 239889024657aedb814376cdaa378e9975b07300..554a8c070ae339eac873eef966a62c611144182b 100644 --- a/tests/virbuftest.c +++ b/tests/virbuftest.c @@ -38,9 +38,8 @@ static int testBufInfiniteLoop(const void *data) * which was the case after the above addchar at the time of the bug. * This test is a bit fragile, since it relies on virBuffer internals. */ - if (virAsprintf(&addstr, "%*s", buf->a - buf->b - 1, "a") < 0) { + if (virAsprintf(&addstr, "%*s", buf->a - buf->b - 1, "a") < 0) goto out; - } if (info->doEscape) virBufferEscapeString(buf, "%s", addstr); diff --git a/tests/virhashtest.c b/tests/virhashtest.c index 340dc84f3a262a2d6601a00d1738df1b6f24b49e..c9d189ba96cbdb071fcac36a9c522fdac50f62e4 100644 --- a/tests/virhashtest.c +++ b/tests/virhashtest.c @@ -531,17 +531,15 @@ testHashGetItems(const void *data ATTRIBUTE_UNUSED) virHashAddEntry(hash, keya, value3) < 0 || virHashAddEntry(hash, keyc, value1) < 0 || virHashAddEntry(hash, keyb, value2) < 0) { - if (virTestGetVerbose()) { + if (virTestGetVerbose()) testError("\nfailed to create hash"); - } goto cleanup; } if (!(array = virHashGetItems(hash, NULL)) || array[3].key || array[3].value) { - if (virTestGetVerbose()) { + if (virTestGetVerbose()) testError("\nfailed to get items with NULL sort"); - } goto cleanup; } VIR_FREE(array); @@ -554,9 +552,8 @@ testHashGetItems(const void *data ATTRIBUTE_UNUSED) STRNEQ(array[2].key, "c") || STRNEQ(array[2].value, "1") || array[3].key || array[3].value) { - if (virTestGetVerbose()) { + if (virTestGetVerbose()) testError("\nfailed to get items with key sort"); - } goto cleanup; } VIR_FREE(array); @@ -569,9 +566,8 @@ testHashGetItems(const void *data ATTRIBUTE_UNUSED) STRNEQ(array[2].key, "a") || STRNEQ(array[2].value, "3") || array[3].key || array[3].value) { - if (virTestGetVerbose()) { + if (virTestGetVerbose()) testError("\nfailed to get items with value sort"); - } goto cleanup; } @@ -612,44 +608,38 @@ testHashEqual(const void *data ATTRIBUTE_UNUSED) virHashAddEntry(hash1, keyc, value3_l) < 0 || virHashAddEntry(hash2, keya, value1_u) < 0 || virHashAddEntry(hash2, keyb, value2_u) < 0) { - if (virTestGetVerbose()) { + if (virTestGetVerbose()) testError("\nfailed to create hashes"); - } goto cleanup; } if (virHashEqual(hash1, hash2, testHashEqualCompValue)) { - if (virTestGetVerbose()) { + if (virTestGetVerbose()) testError("\nfailed equal test for different number of elements"); - } goto cleanup; } if (virHashAddEntry(hash2, keyc, value4_u) < 0) { - if (virTestGetVerbose()) { + if (virTestGetVerbose()) testError("\nfailed to add element to hash2"); - } goto cleanup; } if (virHashEqual(hash1, hash2, testHashEqualCompValue)) { - if (virTestGetVerbose()) { + if (virTestGetVerbose()) testError("\nfailed equal test for same number of elements"); - } goto cleanup; } if (virHashUpdateEntry(hash2, keyc, value3_u) < 0) { - if (virTestGetVerbose()) { + if (virTestGetVerbose()) testError("\nfailed to update element in hash2"); - } goto cleanup; } if (!virHashEqual(hash1, hash2, testHashEqualCompValue)) { - if (virTestGetVerbose()) { + if (virTestGetVerbose()) testError("\nfailed equal test for equal hash tables"); - } goto cleanup; } diff --git a/tests/virtimetest.c b/tests/virtimetest.c index 64bf19b7580a08932495ec34310812ba311b8be5..9ab38aebf8b44b20c1bf06cb817eed611f03e4fe 100644 --- a/tests/virtimetest.c +++ b/tests/virtimetest.c @@ -88,9 +88,8 @@ testTimeLocalOffset(const void *args) } tzset(); - if (virTimeLocalOffsetFromUTC(&actual) < 0) { + if (virTimeLocalOffsetFromUTC(&actual) < 0) return -1; - } if (data->offset != actual) { VIR_DEBUG("Expect Offset %ld got %ld\n", diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index 5c103dd691728962a5f6ad46ef6f9be0d40db50d..6b1e724bce658ebe4b8da8e587933b54e5b22f86 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -27,9 +27,8 @@ testCapsInit(void) caps = virCapabilitiesNew(VIR_ARCH_I686, true, true); - if (caps == NULL) { + if (caps == NULL) return; - } virCapabilitiesAddHostMigrateTransport(caps, "esx"); @@ -39,9 +38,8 @@ testCapsInit(void) VIR_ARCH_I686, NULL, NULL, 0, NULL); - if (guest == NULL) { + if (guest == NULL) goto failure; - } if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL) == NULL) { @@ -54,9 +52,8 @@ testCapsInit(void) VIR_ARCH_X86_64, NULL, NULL, 0, NULL); - if (guest == NULL) { + if (guest == NULL) goto failure; - } if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL) == NULL) { @@ -201,9 +198,8 @@ mymain(void) testCapsInit(); - if (caps == NULL) { + if (caps == NULL) return EXIT_FAILURE; - } if (!(xmlopt = virVMXDomainXMLConfInit())) return EXIT_FAILURE; diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index 58418dcca34c226a81c0387314553f86b68cc8b5..ca9445df2ab72c57c3f1b90ddb574eacd2bd379c 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -27,9 +27,8 @@ testCapsInit(void) caps = virCapabilitiesNew(VIR_ARCH_I686, true, true); - if (caps == NULL) { + if (caps == NULL) return; - } virCapabilitiesAddHostMigrateTransport(caps, "esx"); @@ -40,9 +39,8 @@ testCapsInit(void) VIR_ARCH_I686, NULL, NULL, 0, NULL); - if (guest == NULL) { + if (guest == NULL) goto failure; - } if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL) == NULL) { @@ -55,9 +53,8 @@ testCapsInit(void) VIR_ARCH_X86_64, NULL, NULL, 0, NULL); - if (guest == NULL) { + if (guest == NULL) goto failure; - } if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL) == NULL) { @@ -81,21 +78,18 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version) char *formatted = NULL; virDomainDefPtr def = NULL; - if (virtTestLoadFile(xml, &xmlData) < 0) { + if (virtTestLoadFile(xml, &xmlData) < 0) goto failure; - } - if (virtTestLoadFile(vmx, &vmxData) < 0) { + if (virtTestLoadFile(vmx, &vmxData) < 0) goto failure; - } def = virDomainDefParseString(xmlData, caps, xmlopt, 1 << VIR_DOMAIN_VIRT_VMWARE, VIR_DOMAIN_XML_INACTIVE); - if (def == NULL) { + if (def == NULL) goto failure; - } if (!virDomainDefCheckABIStability(def, def)) { fprintf(stderr, "ABI stability check failed on %s", xml); @@ -104,9 +98,8 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version) formatted = virVMXFormatConfig(&ctx, xmlopt, def, virtualHW_version); - if (formatted == NULL) { + if (formatted == NULL) goto failure; - } if (STRNEQ(vmxData, formatted)) { virtTestDifference(stderr, vmxData, formatted); @@ -207,9 +200,8 @@ testFormatVMXFileName(const char *src, void *opaque ATTRIBUTE_UNUSED) success = true; cleanup: - if (! success) { + if (! success) VIR_FREE(absolutePath); - } VIR_FREE(copyOfDatastorePath); @@ -233,9 +225,8 @@ mymain(void) testCapsInit(); - if (caps == NULL) { + if (caps == NULL) return EXIT_FAILURE; - } if (!(xmlopt = virVMXDomainXMLConfInit())) return EXIT_FAILURE;