From nobody Mon Feb 9 05:44:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565610880; cv=none; d=zoho.com; s=zohoarc; b=iO6kMFRfgufrc5Pf+LIf8PIXI9gpe2k1c1WHn2/j2QEXl4ySL/hMx65wxFZhBWVuwAR8HQLYSabt4W/Jv/2WSDtLtjq7royOgZ/hQ1uD4N7j7YAJAghwrA2QG7YI88538pD33WEETV1+oTrCT8dlFDn5es9+QUa5X7p60ypAciQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610880; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=zqZd5s6Ymmr6cwxCM9cUDg3XklfyQjZom+66MCVsFNQ=; b=kQIrKUkcohogExdEHC6guD5rTNHN3i7njItqlI4bccK97x/X30P7kjzy96U55+0z+Y1f2w0OWp+ss7rf6ifT7BMD1nTA6t6F2o3y6hSJiMoFyr3Sl3Xo/u225aoA/yFQFsS1hxyS66opvqdcWIyYdiaQIbK8/zFUEWuhfxvIgCE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565610880679630.3782097945674; Mon, 12 Aug 2019 04:54:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FE27C08E284; Mon, 12 Aug 2019 11:54:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 392237CD9A; Mon, 12 Aug 2019 11:54:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F2E24180B536; Mon, 12 Aug 2019 11:54:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7CBsVNr016141 for ; Mon, 12 Aug 2019 07:54:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9B3391001947; Mon, 12 Aug 2019 11:54:31 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0000B1001944 for ; Mon, 12 Aug 2019 11:54:30 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:18 +0200 Message-Id: <94df274f13e33983c79b73184955090631984108.1565610801.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/9] tests: Always put '\n' at the end of VIR_TEST_VERBOSE X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 12 Aug 2019 11:54:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Similarly to the previous commit, VIR_TEST_VERBOSE should put '\n' at the end of each call so that the output is not broken. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/cputest.c | 14 +++--- tests/qemublocktest.c | 10 ++--- tests/qemuhotplugtest.c | 10 ++--- tests/qemumonitorjsontest.c | 8 ++-- tests/securityselinuxlabeltest.c | 4 +- tests/testutils.h | 4 +- tests/testutilsqemu.c | 9 ++-- tests/testutilsqemuschema.c | 8 ++-- tests/virerrortest.c | 12 +++--- tests/virhashtest.c | 18 ++++---- tests/virjsontest.c | 74 ++++++++++++++++---------------- 11 files changed, 87 insertions(+), 84 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index dfc01f7e75..7037bcc8bd 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -215,7 +215,7 @@ cpuTestCompare(const void *arg) virResetLastError(); =20 if (data->result !=3D result) { - VIR_TEST_VERBOSE("\nExpected result %s, got %s\n", + VIR_TEST_VERBOSE("\nExpected result %s, got %s", cpuTestCompResStr(data->result), cpuTestCompResStr(result)); /* Pad to line up with test name ... in virTestRun */ @@ -290,7 +290,7 @@ cpuTestGuestCPU(const void *arg) virResetLastError(); ret =3D 0; } else { - VIR_TEST_VERBOSE("\nExpected result %d, got %d\n", + VIR_TEST_VERBOSE("\nExpected result %d, got %d", data->result, ret); /* Pad to line up with test name ... in virTestRun */ VIR_TEST_VERBOSE("%74s", "... "); @@ -357,7 +357,7 @@ cpuTestBaseline(const void *arg) cmp =3D virCPUCompare(cpus[i]->arch, cpus[i], baseline, false); if (cmp !=3D VIR_CPU_COMPARE_SUPERSET && cmp !=3D VIR_CPU_COMPARE_IDENTICAL) { - VIR_TEST_VERBOSE("\nbaseline CPU is incompatible with CPU %zu\= n", + VIR_TEST_VERBOSE("\nbaseline CPU is incompatible with CPU %zu", i); VIR_TEST_VERBOSE("%74s", "... "); ret =3D -1; @@ -438,7 +438,7 @@ cpuTestHasFeature(const void *arg) virResetLastError(); =20 if (data->result !=3D result) { - VIR_TEST_VERBOSE("\nExpected result %s, got %s\n", + VIR_TEST_VERBOSE("\nExpected result %s, got %s", cpuTestBoolWithErrorStr(data->result), cpuTestBoolWithErrorStr(result)); /* Pad to line up with test name ... in virTestRun */ @@ -712,7 +712,7 @@ cpuTestUpdateLiveCompare(virArch arch, return -1; =20 if (STRNEQ(actual->model, expected->model)) { - VIR_TEST_VERBOSE("Actual CPU model '%s', expected '%s'\n", + VIR_TEST_VERBOSE("Actual CPU model '%s', expected '%s'", actual->model, expected->model); return -1; } @@ -765,7 +765,7 @@ cpuTestUpdateLiveCompare(virArch arch, featExp->policy =3D=3D VIR_CPU_FEATURE_REQUIRE) || (cmp > 0 && featExp->policy =3D=3D VIR_CPU_FEATURE_REQUIRE)) { - VIR_TEST_VERBOSE("Actual CPU lacks feature '%s'\n", + VIR_TEST_VERBOSE("Actual CPU lacks feature '%s'", featExp->name); ret =3D -1; continue; @@ -778,7 +778,7 @@ cpuTestUpdateLiveCompare(virArch arch, featAct->policy =3D=3D VIR_CPU_FEATURE_REQUIRE) || (cmp > 0 && featExp->policy =3D=3D VIR_CPU_FEATURE_DISABLE)) { - VIR_TEST_VERBOSE("Actual CPU has extra feature '%s'\n", + VIR_TEST_VERBOSE("Actual CPU has extra feature '%s'", cmp <=3D 0 ? featAct->name : featExp->name); ret =3D -1; } diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 9321531f6c..45ff230408 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -211,7 +211,7 @@ testQemuDiskXMLToProps(const void *opaque) =20 if (qemuCheckDiskConfig(disk, data->qemuCaps) < 0 || qemuDomainDeviceDefValidateDisk(disk, data->qemuCaps) < 0) { - VIR_TEST_VERBOSE("invalid configuration for disk\n"); + VIR_TEST_VERBOSE("invalid configuration for disk"); goto cleanup; } =20 @@ -229,11 +229,11 @@ testQemuDiskXMLToProps(const void *opaque) !(storageSrcOnlyProps =3D qemuBlockStorageSourceGetBackendProp= s(n, false, true, true)) || !(storageProps =3D qemuBlockStorageSourceGetBackendProps(n, fa= lse, false, true))) { if (!data->fail) { - VIR_TEST_VERBOSE("failed to generate qemu blockdev props\n= "); + VIR_TEST_VERBOSE("failed to generate qemu blockdev props"); goto cleanup; } } else if (data->fail) { - VIR_TEST_VERBOSE("qemu blockdev props should have failed\n"); + VIR_TEST_VERBOSE("qemu blockdev props should have failed"); goto cleanup; } =20 @@ -531,7 +531,7 @@ mymain(void) if (!(capslatest_x86_64 =3D testQemuGetLatestCapsForArch("x86_64", "xm= l"))) return EXIT_FAILURE; =20 - VIR_TEST_VERBOSE("\nlatest caps x86_64: %s\n", capslatest_x86_64); + VIR_TEST_VERBOSE("\nlatest caps x86_64: %s", capslatest_x86_64); =20 if (!(caps_x86_64 =3D qemuTestParseCapabilitiesArch(virArchFromString(= "x86_64"), capslatest_x86_64))) @@ -641,7 +641,7 @@ mymain(void) diskxmljsondata.schema, &diskxmljsondata.schemaroot) < 0 || !diskxmljsondata.schemaroot) { - VIR_TEST_VERBOSE("failed to find schema entry for blockdev-add\n"); + VIR_TEST_VERBOSE("failed to find schema entry for blockdev-add"); ret =3D -1; goto cleanup; } diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 6ad67c8902..b6aad330a9 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -131,7 +131,7 @@ testQemuHotplugAttach(virDomainObjPtr vm, ret =3D qemuDomainAttachWatchdog(&driver, vm, dev->data.watchdog); break; default: - VIR_TEST_VERBOSE("device type '%s' cannot be attached\n", + VIR_TEST_VERBOSE("device type '%s' cannot be attached", virDomainDeviceTypeToString(dev->type)); break; } @@ -154,7 +154,7 @@ testQemuHotplugDetach(virDomainObjPtr vm, ret =3D qemuDomainDetachDeviceLive(vm, dev, &driver, async); break; default: - VIR_TEST_VERBOSE("device type '%s' cannot be detached\n", + VIR_TEST_VERBOSE("device type '%s' cannot be detached", virDomainDeviceTypeToString(dev->type)); break; } @@ -178,7 +178,7 @@ testQemuHotplugUpdate(virDomainObjPtr vm, ret =3D qemuDomainChangeGraphics(&driver, vm, dev->data.graphics); break; default: - VIR_TEST_VERBOSE("device type '%s' cannot be updated\n", + VIR_TEST_VERBOSE("device type '%s' cannot be updated", virDomainDeviceTypeToString(dev->type)); break; } @@ -203,7 +203,7 @@ testQemuHotplugCheckResult(virDomainObjPtr vm, =20 if (STREQ(expected, actual)) { if (fail) - VIR_TEST_VERBOSE("domain XML should not match the expected res= ult\n"); + VIR_TEST_VERBOSE("domain XML should not match the expected res= ult"); ret =3D 0; } else { if (!fail) @@ -262,7 +262,7 @@ testQemuHotplug(const void *data) if (test->vm) { vm =3D test->vm; if (!vm->def) { - VIR_TEST_VERBOSE("test skipped due to failure of dependent tes= t\n"); + VIR_TEST_VERBOSE("test skipped due to failure of dependent tes= t"); goto cleanup; } } else { diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 522ff5a3d5..57b6e02b6e 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1643,7 +1643,7 @@ static void testQemuMonitorJSONGetBlockInfoPrint(const struct qemuDomainDiskInfo *d) { VIR_TEST_VERBOSE("removable: %d, tray: %d, tray_open: %d, empty: %d, " - "io_status: %d, nodename: '%s'\n", + "io_status: %d, nodename: '%s'", d->removable, d->tray, d->tray_open, d->empty, d->io_status, NULLSTR(d->nodename)); } @@ -2905,7 +2905,7 @@ testQAPISchemaValidate(const void *opaque) =20 if ((testQEMUSchemaValidate(json, schemaroot, data->schema, &debug) = =3D=3D 0) !=3D data->success) { if (!data->success) - VIR_TEST_VERBOSE("\nschema validation should have failed\n"); + VIR_TEST_VERBOSE("\nschema validation should have failed"); } else { ret =3D 0; } @@ -3026,7 +3026,7 @@ mymain(void) virEventRegisterDefaultImpl(); =20 if (!(qapiData.schema =3D testQEMUSchemaLoad())) { - VIR_TEST_VERBOSE("failed to load qapi schema\n"); + VIR_TEST_VERBOSE("failed to load qapi schema"); ret =3D -1; goto cleanup; } @@ -3267,7 +3267,7 @@ mymain(void) =20 if (!(metaschema =3D testQEMUSchemaGetLatest()) || !(metaschemastr =3D virJSONValueToString(metaschema, false))) { - VIR_TEST_VERBOSE("failed to load latest qapi schema\n"); + VIR_TEST_VERBOSE("failed to load latest qapi schema"); ret =3D -1; goto cleanup; } diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabelt= est.c index 76db2494bd..8c3cb29c41 100644 --- a/tests/securityselinuxlabeltest.c +++ b/tests/securityselinuxlabeltest.c @@ -329,7 +329,7 @@ testSELinuxLabeling(const void *opaque) } VIR_FREE(files); if (ret < 0) - VIR_TEST_VERBOSE("%s\n", virGetLastErrorMessage()); + VIR_TEST_VERBOSE("%s", virGetLastErrorMessage()); return ret; } =20 @@ -349,7 +349,7 @@ mymain(void) if (!(mgr =3D virSecurityManagerNew("selinux", "QEMU", VIR_SECURITY_MANAGER_DEFAULT_CONFINE= D | VIR_SECURITY_MANAGER_PRIVILEGED))) { - VIR_TEST_VERBOSE("Unable to initialize security driver: %s\n", + VIR_TEST_VERBOSE("Unable to initialize security driver: %s", virGetLastErrorMessage()); return EXIT_FAILURE; } diff --git a/tests/testutils.h b/tests/testutils.h index cfc60084b2..2d0cea7826 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -97,8 +97,10 @@ unsigned int virTestGetRegenerate(void); =20 #define VIR_TEST_VERBOSE(...) \ do { \ - if (virTestGetVerbose()) \ + if (virTestGetVerbose()) { \ fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); \ + } \ } while (0) =20 char *virTestLogContentAndReset(void); diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index cd04606cf0..41a7451fa1 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -851,7 +851,7 @@ testQemuGetLatestCapsForArch(const char *arch, goto cleanup; =20 if (!maxname) { - VIR_TEST_VERBOSE("failed to find capabilities for '%s' in '%s'\n", + VIR_TEST_VERBOSE("failed to find capabilities for '%s' in '%s'", arch, TEST_QEMU_CAPS_PATH); goto cleanup; } @@ -882,7 +882,7 @@ testQemuGetLatestCaps(void) if (!(capslatest =3D virHashCreate(4, virHashValueFree))) goto error; =20 - VIR_TEST_VERBOSE("\n"); + VIR_TEST_VERBOSE(NULL); =20 for (i =3D 0; i < ARRAY_CARDINALITY(archs); ++i) { char *cap =3D testQemuGetLatestCapsForArch(archs[i], "xml"); @@ -890,10 +890,11 @@ testQemuGetLatestCaps(void) if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0) goto error; =20 - VIR_TEST_VERBOSE("latest caps for %s: %s\n", archs[i], cap); + VIR_TEST_VERBOSE("latest caps for %s: %s", archs[i], cap); } =20 - VIR_TEST_VERBOSE("\n"); + VIR_TEST_VERBOSE(NULL); + return capslatest; =20 error: diff --git a/tests/testutilsqemuschema.c b/tests/testutilsqemuschema.c index 0728771bfe..3773f63ecb 100644 --- a/tests/testutilsqemuschema.c +++ b/tests/testutilsqemuschema.c @@ -534,7 +534,7 @@ testQEMUSchemaGetLatest(void) virJSONValuePtr schema =3D NULL; =20 if (!(capsLatestFile =3D testQemuGetLatestCapsForArch("x86_64", "repli= es"))) { - VIR_TEST_VERBOSE("failed to find latest caps replies\n"); + VIR_TEST_VERBOSE("failed to find latest caps replies"); return NULL; } =20 @@ -546,7 +546,7 @@ testQEMUSchemaGetLatest(void) if (!(schemaReply =3D strstr(capsLatest, "\"execute\": \"query-qmp-sch= ema\"")) || !(schemaReply =3D strstr(schemaReply, "\n\n")) || !(end =3D strstr(schemaReply + 2, "\n\n"))) { - VIR_TEST_VERBOSE("failed to find reply to 'query-qmp-schema' in '%= s'\n", + VIR_TEST_VERBOSE("failed to find reply to 'query-qmp-schema' in '%= s'", capsLatestFile); goto cleanup; } @@ -555,13 +555,13 @@ testQEMUSchemaGetLatest(void) *end =3D '\0'; =20 if (!(reply =3D virJSONValueFromString(schemaReply))) { - VIR_TEST_VERBOSE("failed to parse 'query-qmp-schema' reply from '%= s'\n", + VIR_TEST_VERBOSE("failed to parse 'query-qmp-schema' reply from '%= s'", capsLatestFile); goto cleanup; } =20 if (!(schema =3D virJSONValueObjectStealArray(reply, "return"))) { - VIR_TEST_VERBOSE("missing qapi schema data in reply in '%s'\n", + VIR_TEST_VERBOSE("missing qapi schema data in reply in '%s'", capsLatestFile); goto cleanup; } diff --git a/tests/virerrortest.c b/tests/virerrortest.c index b49d1a9135..63ba84c2f9 100644 --- a/tests/virerrortest.c +++ b/tests/virerrortest.c @@ -31,11 +31,11 @@ virErrorTestMsgFormatInfoOne(const char *msg) =20 for (next =3D (char *)msg; (next =3D strchr(next, '%')); next++) { if (next[1] !=3D 's') { - VIR_TEST_VERBOSE("\nerror message '%s' contains disallowed pri= ntf modifiers\n", msg); + VIR_TEST_VERBOSE("\nerror message '%s' contains disallowed pri= ntf modifiers", msg); ret =3D -1; } else { if (found) { - VIR_TEST_VERBOSE("\nerror message '%s' contains multiple %= %s modifiers\n", msg); + VIR_TEST_VERBOSE("\nerror message '%s' contains multiple %= %s modifiers", msg); ret =3D -1; } else { found =3D true; @@ -44,7 +44,7 @@ virErrorTestMsgFormatInfoOne(const char *msg) } =20 if (!found) { - VIR_TEST_VERBOSE("\nerror message '%s' does not contain any %%s mo= difiers\n", msg); + VIR_TEST_VERBOSE("\nerror message '%s' does not contain any %%s mo= difiers", msg); ret =3D -1; } =20 @@ -65,17 +65,17 @@ virErrorTestMsgs(const void *opaque ATTRIBUTE_UNUSED) err_info =3D virErrorMsg(i, ""); =20 if (!err_noinfo) { - VIR_TEST_VERBOSE("\nmissing string without info for error id %= zu\n", i); + VIR_TEST_VERBOSE("\nmissing string without info for error id %= zu", i); ret =3D -1; } =20 if (!err_info) { - VIR_TEST_VERBOSE("\nmissing string with info for error id %zu\= n", i); + VIR_TEST_VERBOSE("\nmissing string with info for error id %zu"= , i); ret =3D -1; } =20 if (err_noinfo && strchr(err_noinfo, '%')) { - VIR_TEST_VERBOSE("\nerror message id %zu contains formatting c= haracters: '%s'\n", + VIR_TEST_VERBOSE("\nerror message id %zu contains formatting c= haracters: '%s'", i, err_noinfo); ret =3D -1; } diff --git a/tests/virhashtest.c b/tests/virhashtest.c index 38f549848f..95634eec80 100644 --- a/tests/virhashtest.c +++ b/tests/virhashtest.c @@ -41,7 +41,7 @@ testHashInit(int size) =20 for (i =3D 0; i < ARRAY_CARDINALITY(uuids); i++) { if (!virHashLookup(hash, uuids[i])) { - VIR_TEST_VERBOSE("\nentry \"%s\" could not be found\n", uuids[= i]); + VIR_TEST_VERBOSE("\nentry \"%s\" could not be found", uuids[i]= ); virHashFree(hash); return NULL; } @@ -69,7 +69,7 @@ testHashCheckCount(virHashTablePtr hash, size_t count) size_t iter_count =3D 0; =20 if (virHashSize(hash) !=3D count) { - VIR_TEST_VERBOSE("\nhash contains %zd instead of %zu elements\n", + VIR_TEST_VERBOSE("\nhash contains %zd instead of %zu elements", virHashSize(hash), count); return -1; } @@ -77,7 +77,7 @@ testHashCheckCount(virHashTablePtr hash, size_t count) virHashForEach(hash, testHashCheckForEachCount, &iter_count); if (count !=3D iter_count) { VIR_TEST_VERBOSE("\nhash claims to have %zu elements but iteration" - "finds %zu\n", count, iter_count); + "finds %zu", count, iter_count); return -1; } =20 @@ -125,7 +125,7 @@ testHashUpdate(const void *data ATTRIBUTE_UNUSED) =20 for (i =3D 0; i < ARRAY_CARDINALITY(uuids_subset); i++) { if (virHashUpdateEntry(hash, uuids_subset[i], (void *) 1) < 0) { - VIR_TEST_VERBOSE("\nentry \"%s\" could not be updated\n", + VIR_TEST_VERBOSE("\nentry \"%s\" could not be updated", uuids_subset[i]); goto cleanup; } @@ -133,7 +133,7 @@ testHashUpdate(const void *data ATTRIBUTE_UNUSED) =20 for (i =3D 0; i < ARRAY_CARDINALITY(uuids_new); i++) { if (virHashUpdateEntry(hash, uuids_new[i], (void *) 1) < 0) { - VIR_TEST_VERBOSE("\nnew entry \"%s\" could not be updated\n", + VIR_TEST_VERBOSE("\nnew entry \"%s\" could not be updated", uuids_new[i]); goto cleanup; } @@ -163,7 +163,7 @@ testHashRemove(const void *data ATTRIBUTE_UNUSED) =20 for (i =3D 0; i < ARRAY_CARDINALITY(uuids_subset); i++) { if (virHashRemoveEntry(hash, uuids_subset[i]) < 0) { - VIR_TEST_VERBOSE("\nentry \"%s\" could not be removed\n", + VIR_TEST_VERBOSE("\nentry \"%s\" could not be removed", uuids_subset[i]); goto cleanup; } @@ -257,7 +257,7 @@ testHashSteal(const void *data ATTRIBUTE_UNUSED) =20 for (i =3D 0; i < ARRAY_CARDINALITY(uuids_subset); i++) { if (!virHashSteal(hash, uuids_subset[i])) { - VIR_TEST_VERBOSE("\nentry \"%s\" could not be stolen\n", + VIR_TEST_VERBOSE("\nentry \"%s\" could not be stolen", uuids_subset[i]); goto cleanup; } @@ -316,7 +316,7 @@ testHashRemoveSet(const void *data ATTRIBUTE_UNUSED) =20 if (count !=3D rcount) { VIR_TEST_VERBOSE("\nvirHashRemoveSet didn't remove expected number= of" - " entries, %d !=3D %u\n", + " entries, %d !=3D %u", rcount, count); goto cleanup; } @@ -355,7 +355,7 @@ testHashSearch(const void *data ATTRIBUTE_UNUSED) entry =3D virHashSearch(hash, testHashSearchIter, NULL, NULL); =20 if (!entry || STRNEQ(uuids_subset[testSearchIndex], entry)) { - VIR_TEST_VERBOSE("\nvirHashSearch didn't find entry '%s'\n", + VIR_TEST_VERBOSE("\nvirHashSearch didn't find entry '%s'", uuids_subset[testSearchIndex]); goto cleanup; } diff --git a/tests/virjsontest.c b/tests/virjsontest.c index dbc0b41cc8..81da89a6b0 100644 --- a/tests/virjsontest.c +++ b/tests/virjsontest.c @@ -39,7 +39,7 @@ testJSONFromFile(const void *data) =20 if (!injson) { if (info->pass) { - VIR_TEST_VERBOSE("Failed to parse %s\n", info->doc); + VIR_TEST_VERBOSE("Failed to parse %s", info->doc); return -1; } else { VIR_TEST_DEBUG("As expected, failed to parse %s", info->doc); @@ -47,7 +47,7 @@ testJSONFromFile(const void *data) } } else { if (!info->pass) { - VIR_TEST_VERBOSE("Unexpected success while parsing %s\n", info= ->doc); + VIR_TEST_VERBOSE("Unexpected success while parsing %s", info->= doc); return -1; } } @@ -74,7 +74,7 @@ testJSONFromString(const void *data) =20 if (!json) { if (info->pass) { - VIR_TEST_VERBOSE("Failed to parse %s\n", info->doc); + VIR_TEST_VERBOSE("Failed to parse %s", info->doc); return -1; } else { VIR_TEST_DEBUG("As expected, failed to parse %s", info->doc); @@ -82,7 +82,7 @@ testJSONFromString(const void *data) } } else { if (!info->pass) { - VIR_TEST_VERBOSE("Unexpected success while parsing %s\n", info= ->doc); + VIR_TEST_VERBOSE("Unexpected success while parsing %s", info->= doc); return -1; } } @@ -90,7 +90,7 @@ testJSONFromString(const void *data) VIR_TEST_DEBUG("Parsed %s", info->doc); =20 if (!(formatted =3D virJSONValueToString(json, false))) { - VIR_TEST_VERBOSE("Failed to format json data\n"); + VIR_TEST_VERBOSE("Failed to format json data"); return -1; } =20 @@ -125,14 +125,14 @@ testJSONAddRemove(const void *data) =20 json =3D virJSONValueFromString(indata); if (!json) { - VIR_TEST_VERBOSE("Fail to parse %s\n", info->name); + VIR_TEST_VERBOSE("Fail to parse %s", info->name); return -1; } =20 switch (virJSONValueObjectRemoveKey(json, "name", &name)) { case 1: if (!info->pass) { - VIR_TEST_VERBOSE("should not remove from non-object %s\n", + VIR_TEST_VERBOSE("should not remove from non-object %s", info->name); return -1; } @@ -141,29 +141,29 @@ testJSONAddRemove(const void *data) if (!info->pass) return 0; else - VIR_TEST_VERBOSE("Fail to recognize non-object %s\n", info->na= me); + VIR_TEST_VERBOSE("Fail to recognize non-object %s", info->name= ); return -1; default: - VIR_TEST_VERBOSE("unexpected result when removing from %s\n", + VIR_TEST_VERBOSE("unexpected result when removing from %s", info->name); return -1; } if (STRNEQ_NULLABLE(virJSONValueGetString(name), "sample")) { - VIR_TEST_VERBOSE("unexpected value after removing name: %s\n", + VIR_TEST_VERBOSE("unexpected value after removing name: %s", NULLSTR(virJSONValueGetString(name))); return -1; } if (virJSONValueObjectRemoveKey(json, "name", NULL)) { VIR_TEST_VERBOSE("%s", - "unexpected success when removing missing key\n"); + "unexpected success when removing missing key"); return -1; } if (virJSONValueObjectAppendString(json, "newname", "foo") < 0) { - VIR_TEST_VERBOSE("%s", "unexpected failure adding new key\n"); + VIR_TEST_VERBOSE("%s", "unexpected failure adding new key"); return -1; } if (!(actual =3D virJSONValueToString(json, false))) { - VIR_TEST_VERBOSE("%s", "failed to stringize result\n"); + VIR_TEST_VERBOSE("%s", "failed to stringize result"); return -1; } =20 @@ -187,28 +187,28 @@ testJSONLookup(const void *data) =20 json =3D virJSONValueFromString(info->doc); if (!json) { - VIR_TEST_VERBOSE("Fail to parse %s\n", info->doc); + VIR_TEST_VERBOSE("Fail to parse %s", info->doc); return -1; } =20 value =3D virJSONValueObjectGetObject(json, "a"); if (value) { if (!info->pass) { - VIR_TEST_VERBOSE("lookup for 'a' in '%s' should have failed\n", + VIR_TEST_VERBOSE("lookup for 'a' in '%s' should have failed", info->doc); return -1; } else { result =3D virJSONValueToString(value, false); if (STRNEQ_NULLABLE(result, "{}")) { VIR_TEST_VERBOSE("lookup for 'a' in '%s' found '%s' but " - "should have found '{}'\n", + "should have found '{}'", info->doc, NULLSTR(result)); return -1; } VIR_FREE(result); } } else if (info->pass) { - VIR_TEST_VERBOSE("lookup for 'a' in '%s' should have succeeded\n", + VIR_TEST_VERBOSE("lookup for 'a' in '%s' should have succeeded", info->doc); return -1; } @@ -217,17 +217,17 @@ testJSONLookup(const void *data) rc =3D virJSONValueObjectGetNumberInt(json, "b", &number); if (rc =3D=3D 0) { if (!info->pass) { - VIR_TEST_VERBOSE("lookup for 'b' in '%s' should have failed\n", + VIR_TEST_VERBOSE("lookup for 'b' in '%s' should have failed", info->doc); return -1; } else if (number !=3D 1) { VIR_TEST_VERBOSE("lookup for 'b' in '%s' found %d but " - "should have found 1\n", + "should have found 1", info->doc, number); return -1; } } else if (info->pass) { - VIR_TEST_VERBOSE("lookup for 'b' in '%s' should have succeeded\n", + VIR_TEST_VERBOSE("lookup for 'b' in '%s' should have succeeded", info->doc); return -1; } @@ -235,16 +235,16 @@ testJSONLookup(const void *data) str =3D virJSONValueObjectGetString(json, "c"); if (str) { if (!info->pass) { - VIR_TEST_VERBOSE("lookup for 'c' in '%s' should have failed\n", + VIR_TEST_VERBOSE("lookup for 'c' in '%s' should have failed", info->doc); return -1; } else if (STRNEQ(str, "str")) { VIR_TEST_VERBOSE("lookup for 'c' in '%s' found '%s' but " - "should have found 'str'\n", info->doc, str); + "should have found 'str'", info->doc, str); return -1; } } else if (info->pass) { - VIR_TEST_VERBOSE("lookup for 'c' in '%s' should have succeeded\n", + VIR_TEST_VERBOSE("lookup for 'c' in '%s' should have succeeded", info->doc); return -1; } @@ -252,21 +252,21 @@ testJSONLookup(const void *data) value =3D virJSONValueObjectGetArray(json, "d"); if (value) { if (!info->pass) { - VIR_TEST_VERBOSE("lookup for 'd' in '%s' should have failed\n", + VIR_TEST_VERBOSE("lookup for 'd' in '%s' should have failed", info->doc); return -1; } else { result =3D virJSONValueToString(value, false); if (STRNEQ_NULLABLE(result, "[]")) { VIR_TEST_VERBOSE("lookup for 'd' in '%s' found '%s' but " - "should have found '[]'\n", + "should have found '[]'", info->doc, NULLSTR(result)); return -1; } VIR_FREE(result); } } else if (info->pass) { - VIR_TEST_VERBOSE("lookup for 'd' in '%s' should have succeeded\n", + VIR_TEST_VERBOSE("lookup for 'd' in '%s' should have succeeded", info->doc); return -1; } @@ -286,25 +286,25 @@ testJSONCopy(const void *data) =20 json =3D virJSONValueFromString(info->doc); if (!json) { - VIR_TEST_VERBOSE("Failed to parse %s\n", info->doc); + VIR_TEST_VERBOSE("Failed to parse %s", info->doc); return -1; } =20 jsonCopy =3D virJSONValueCopy(json); if (!jsonCopy) { - VIR_TEST_VERBOSE("Failed to copy JSON data\n"); + VIR_TEST_VERBOSE("Failed to copy JSON data"); return -1; } =20 result =3D virJSONValueToString(json, false); if (!result) { - VIR_TEST_VERBOSE("Failed to format original JSON data\n"); + VIR_TEST_VERBOSE("Failed to format original JSON data"); return -1; } =20 resultCopy =3D virJSONValueToString(json, false); if (!resultCopy) { - VIR_TEST_VERBOSE("Failed to format copied JSON data\n"); + VIR_TEST_VERBOSE("Failed to format copied JSON data"); return -1; } =20 @@ -319,13 +319,13 @@ testJSONCopy(const void *data) =20 result =3D virJSONValueToString(json, true); if (!result) { - VIR_TEST_VERBOSE("Failed to format original JSON data\n"); + VIR_TEST_VERBOSE("Failed to format original JSON data"); return -1; } =20 resultCopy =3D virJSONValueToString(json, true); if (!resultCopy) { - VIR_TEST_VERBOSE("Failed to format copied JSON data\n"); + VIR_TEST_VERBOSE("Failed to format copied JSON data"); return -1; } =20 @@ -364,7 +364,7 @@ testJSONDeflatten(const void *data) =20 if ((deflattened =3D virJSONValueObjectDeflatten(injson))) { if (!info->pass) { - VIR_TEST_VERBOSE("%s: deflattening should have failed\n", info= ->name); + VIR_TEST_VERBOSE("%s: deflattening should have failed", info->= name); return -1; } } else { @@ -450,22 +450,22 @@ testJSONObjectFormatSteal(const void *opaque ATTRIBUT= E_UNUSED) } =20 if (virJSONValueObjectCreate(&t1, "a:t", &a1, "s:f", NULL, NULL) !=3D = -1) { - VIR_TEST_VERBOSE("virJSONValueObjectCreate(t1) should have failed\= n"); + VIR_TEST_VERBOSE("virJSONValueObjectCreate(t1) should have failed"= ); return -1; } =20 if (a1) { - VIR_TEST_VERBOSE("appended object a1 was not consumed\n"); + VIR_TEST_VERBOSE("appended object a1 was not consumed"); return -1; } =20 if (virJSONValueObjectCreate(&t2, "s:f", NULL, "a:t", &a1, NULL) !=3D = -1) { - VIR_TEST_VERBOSE("virJSONValueObjectCreate(t2) should have failed\= n"); + VIR_TEST_VERBOSE("virJSONValueObjectCreate(t2) should have failed"= ); return -1; } =20 if (!a2) { - VIR_TEST_VERBOSE("appended object a2 was consumed\n"); + VIR_TEST_VERBOSE("appended object a2 was consumed"); return -1; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list