Remove unnecessary curly brackets in tests/

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2014-11-13 15:20:43 +01:00
parent 91cc3d9570
commit f5e65e4b71
12 changed files with 38 additions and 76 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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,

View File

@ -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 */

View File

@ -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) {

View File

@ -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);

View File

@ -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;
}

View File

@ -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",

View File

@ -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;

View File

@ -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;