From f5e65e4b7104c645c18ba795693aca90d8d263cc Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Thu, 13 Nov 2014 15:20:43 +0100 Subject: [PATCH] Remove unnecessary curly brackets in tests/ Signed-off-by: Martin Kletzander --- tests/commandhelper.c | 3 +-- tests/esxutilstest.c | 12 ++++-------- tests/eventtest.c | 3 +-- tests/openvzutilstest.c | 6 ++---- tests/securityselinuxlabeltest.c | 6 ++---- tests/shunloadtest.c | 6 ++---- tests/utiltest.c | 3 +-- tests/virbuftest.c | 3 +-- tests/virhashtest.c | 30 ++++++++++-------------------- tests/virtimetest.c | 3 +-- tests/vmx2xmltest.c | 12 ++++-------- tests/xml2vmxtest.c | 27 +++++++++------------------ 12 files changed, 38 insertions(+), 76 deletions(-) diff --git a/tests/commandhelper.c b/tests/commandhelper.c index 86ed8915c9..015efdaa66 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 41c08075d2..44bdc849d9 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 87b49d3315..13adbf6721 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 ed2c098862..f5a8d12f7e 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 455eb74caf..8106c776d6 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 80f535134f..37d990d71b 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 89e82aac79..8950cf2f30 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 2398890246..554a8c070a 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 340dc84f3a..c9d189ba96 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 64bf19b758..9ab38aebf8 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 5c103dd691..6b1e724bce 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 58418dcca3..ca9445df2a 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; -- GitLab