From nobody Fri Mar 29 09:59:03 2024 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=1565610877; cv=none; d=zoho.com; s=zohoarc; b=n+7PzcI1Ltouu7WkgFe/f/Ts8fVPJ4tdHQP7+FB1tZ+4blLlKvx1BZDU9OmNqRM5NSXTV8gO2HskUioyDGot9KNj+4LxkE0RKX0lfHd3W3QIv9n7Z9FmmXJejISBwZKlaH1ZR/fxL8dX8m2VpJP/2YOeAuZ5KA50HJ9SlCdlbF8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610877; 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=OyMOtAxYxu0sA2tX/stJqmOWy6+b6ZXwIPHVFjCGBfE=; b=dn+muUQ/5S0Zrv7YrQdeJk89k/QWdmY7QWgtbLE9oB9UQTbAPIcfpTnPtEXCkHuTWgynAkpL44fk0zTm9GdetUIgTRG17gre81/dLWm84TRNFhUN3d4MdW2jzlmN7MM9xqEFM9hELuOmyIN0iiHWVnqKV1ciRUUupCPfwS/X7OA= 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 1565610877563182.47760034633382; Mon, 12 Aug 2019 04:54:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B29530BBE85; Mon, 12 Aug 2019 11:54:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08E2A28D0B; Mon, 12 Aug 2019 11:54:36 +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 C63F824F30; Mon, 12 Aug 2019 11:54:35 +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 x7CBsUMV016136 for ; Mon, 12 Aug 2019 07:54:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id A8C8E10016E8; Mon, 12 Aug 2019 11:54:30 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E7321001B17 for ; Mon, 12 Aug 2019 11:54:29 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:17 +0200 Message-Id: <15cc6768ba419dcb6c4976fe2c5c0973d5e8df02.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 1/9] tests: Always put a '\n' after each debug print 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 12 Aug 2019 11:54:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" There is an inconsistency with VIR_TEST_DEBUG() calls. One half (roughly) of calls does have the newline character the other one doesn't. Well, it doesn't have it because it assumed blindly that new line will be printed, which is not the case. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/bhyveargv2xmltest.c | 6 +++--- tests/bhyvexml2argvtest.c | 4 ++-- tests/bhyvexml2xmltest.c | 2 +- tests/cputest.c | 2 +- tests/qemuxml2argvtest.c | 2 +- tests/qemuxml2xmltest.c | 4 ++-- tests/storagepoolxml2argvtest.c | 8 ++++---- tests/testutils.c | 2 +- tests/testutils.h | 4 +++- tests/testutilsqemu.c | 2 +- tests/testutilsqemuschema.c | 2 +- tests/utiltest.c | 32 ++++++++++++++++---------------- tests/virbuftest.c | 8 ++++---- tests/virhostcputest.c | 2 +- tests/virjsontest.c | 6 +++--- tests/virlogtest.c | 14 +++++++------- tests/virnetdaemontest.c | 4 ++-- tests/virpcitest.c | 2 +- tests/virresctrltest.c | 2 +- 19 files changed, 55 insertions(+), 53 deletions(-) diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c index d552364846..49acb74759 100644 --- a/tests/bhyveargv2xmltest.c +++ b/tests/bhyveargv2xmltest.c @@ -41,13 +41,13 @@ testCompareXMLToArgvFiles(const char *xmlfile, driver.xmlopt))) { if ((flags & FLAG_EXPECT_FAILURE) && !virTestOOMActive()) { VIR_TEST_DEBUG("Got expected failure from " - "bhyveParseCommandLineString.\n"); + "bhyveParseCommandLineString."); } else { goto fail; } } else if ((flags & FLAG_EXPECT_FAILURE) && !virTestOOMActive()) { VIR_TEST_DEBUG("Did not get expected failure from " - "bhyveParseCommandLineString.\n"); + "bhyveParseCommandLineString."); goto fail; } =20 @@ -61,7 +61,7 @@ testCompareXMLToArgvFiles(const char *xmlfile, log); } else { VIR_TEST_DEBUG("bhyveParseCommandLineString " - "should have logged a warning\n"); + "should have logged a warning"); goto fail; } } else { /* didn't expect a warning */ diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index c84925c57b..72374d74ba 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -41,7 +41,7 @@ static int testCompareXMLToArgvFiles(const char *xml, ret =3D 0; } else if (flags & FLAG_EXPECT_FAILURE) { ret =3D 0; - VIR_TEST_DEBUG("Got expected error: %s\n", + VIR_TEST_DEBUG("Got expected error: %s", virGetLastErrorMessage()); virResetLastError(); } @@ -61,7 +61,7 @@ static int testCompareXMLToArgvFiles(const char *xml, if ((cmd =3D=3D NULL) || (ldcmd =3D=3D NULL)) { if (flags & FLAG_EXPECT_FAILURE) { ret =3D 0; - VIR_TEST_DEBUG("Got expected error: %s\n", + VIR_TEST_DEBUG("Got expected error: %s", virGetLastErrorMessage()); virResetLastError(); } diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c index e8a6867fcd..a02d16cb9e 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -44,7 +44,7 @@ testCompareXMLToXMLHelper(const void *data) =20 if ((ret !=3D 0) && (info->flags & FLAG_EXPECT_FAILURE)) { ret =3D 0; - VIR_TEST_DEBUG("Got expected error: %s\n", + VIR_TEST_DEBUG("Got expected error: %s", virGetLastErrorMessage()); virResetLastError(); } diff --git a/tests/cputest.c b/tests/cputest.c index 6e28e05756..dfc01f7e75 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1028,7 +1028,7 @@ mymain(void) char *log; \ if ((log =3D virTestLogContentAndReset()) && \ strlen(log) > 0) \ - VIR_TEST_DEBUG("\n%s\n", log); \ + VIR_TEST_DEBUG("\n%s", log); \ VIR_FREE(log); \ } \ ret =3D -1; \ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c166fd18d6..1f4d4ed09a 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -549,7 +549,7 @@ testCompareXMLToArgv(const void *data) ok: if (ret =3D=3D 0 && flags & FLAG_EXPECT_FAILURE) { ret =3D -1; - VIR_TEST_DEBUG("Error expected but there wasn't any.\n"); + VIR_TEST_DEBUG("Error expected but there wasn't any."); goto cleanup; } if (!virTestOOMActive()) { diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 525eb9a740..07bcc29c1e 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -62,7 +62,7 @@ testCompareStatusXMLToXMLFiles(const void *opaque) VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES= | VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE | VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARS= E_FAIL))) { - VIR_TEST_DEBUG("\nfailed to parse '%s'\n", data->infile); + VIR_TEST_DEBUG("\nfailed to parse '%s'", data->infile); goto cleanup; } =20 @@ -72,7 +72,7 @@ testCompareStatusXMLToXMLFiles(const void *opaque) VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET | VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATE= S | VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST))= ) { - VIR_TEST_DEBUG("\nfailed to format back '%s'\n", data->infile); + VIR_TEST_DEBUG("\nfailed to format back '%s'", data->infile); goto cleanup; } =20 diff --git a/tests/storagepoolxml2argvtest.c b/tests/storagepoolxml2argvtes= t.c index 0c01931946..8e09149906 100644 --- a/tests/storagepoolxml2argvtest.c +++ b/tests/storagepoolxml2argvtest.c @@ -38,13 +38,13 @@ testCompareXMLToArgvFiles(bool shouldFail, case VIR_STORAGE_POOL_FS: case VIR_STORAGE_POOL_NETFS: if (!(pool =3D virStoragePoolObjNew())) { - VIR_TEST_DEBUG("pool type '%s' alloc pool obj fails\n", defTyp= eStr); + VIR_TEST_DEBUG("pool type '%s' alloc pool obj fails", defTypeS= tr); goto cleanup; } virStoragePoolObjSetDef(pool, def); =20 if (!(src =3D virStorageBackendFileSystemGetPoolSource(pool))) { - VIR_TEST_DEBUG("pool type '%s' has no pool source\n", defTypeS= tr); + VIR_TEST_DEBUG("pool type '%s' has no pool source", defTypeStr= ); def =3D NULL; goto cleanup; } @@ -70,12 +70,12 @@ testCompareXMLToArgvFiles(bool shouldFail, case VIR_STORAGE_POOL_VSTORAGE: case VIR_STORAGE_POOL_LAST: default: - VIR_TEST_DEBUG("pool type '%s' has no xml2argv test\n", defTypeStr= ); + VIR_TEST_DEBUG("pool type '%s' has no xml2argv test", defTypeStr); goto cleanup; }; =20 if (!(actualCmdline =3D virCommandToString(cmd, false))) { - VIR_TEST_DEBUG("pool type '%s' failed to get commandline\n", defTy= peStr); + VIR_TEST_DEBUG("pool type '%s' failed to get commandline", defType= Str); goto cleanup; } =20 diff --git a/tests/testutils.c b/tests/testutils.c index 245b1832f6..d6a6742e10 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -1006,7 +1006,7 @@ int virTestMain(int argc, fprintf(stderr, "Usage: %s\n", argv[0]); fputs("effective environment variables:\n" "VIR_TEST_VERBOSE set to show names of individual tests\n" - "VIR_TEST_DEBUG set to show information for debugging failur= es\n", + "VIR_TEST_DEBUG set to show information for debugging failur= es", stderr); return EXIT_FAILURE; } diff --git a/tests/testutils.h b/tests/testutils.h index 8c12fd7c12..cfc60084b2 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -89,8 +89,10 @@ unsigned int virTestGetRegenerate(void); =20 #define VIR_TEST_DEBUG(...) \ do { \ - if (virTestGetDebug()) \ + if (virTestGetDebug()) { \ fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); \ + } \ } while (0) =20 #define VIR_TEST_VERBOSE(...) \ diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 9ac9f9bd39..cd04606cf0 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -837,7 +837,7 @@ testQemuGetLatestCapsForArch(const char *arch, continue; =20 if (virParseVersionString(tmp, &ver, false) < 0) { - VIR_TEST_DEBUG("skipping caps file '%s'\n", ent->d_name); + VIR_TEST_DEBUG("skipping caps file '%s'", ent->d_name); continue; } =20 diff --git a/tests/testutilsqemuschema.c b/tests/testutilsqemuschema.c index f1365e8846..0728771bfe 100644 --- a/tests/testutilsqemuschema.c +++ b/tests/testutilsqemuschema.c @@ -538,7 +538,7 @@ testQEMUSchemaGetLatest(void) return NULL; } =20 - VIR_TEST_DEBUG("replies file: '%s'\n", capsLatestFile); + VIR_TEST_DEBUG("replies file: '%s'", capsLatestFile); =20 if (virTestLoadFile(capsLatestFile, &capsLatest) < 0) goto cleanup; diff --git a/tests/utiltest.c b/tests/utiltest.c index 5e4920e3ca..71b8d869bd 100644 --- a/tests/utiltest.c +++ b/tests/utiltest.c @@ -78,8 +78,8 @@ testDiskNameToIndex(const void *data ATTRIBUTE_UNUSED) idx =3D virDiskNameToIndex(diskName); =20 if (idx < 0 || idx !=3D i) { - VIR_TEST_DEBUG("\nExpect [%zu]\n", i); - VIR_TEST_DEBUG("Actual [%d]\n", idx); + VIR_TEST_DEBUG("\nExpect [%zu]", i); + VIR_TEST_DEBUG("Actual [%d]", idx); =20 VIR_FREE(diskName); =20 @@ -108,21 +108,21 @@ testDiskNameParse(const void *data ATTRIBUTE_UNUSED) return -1; =20 if (disk->idx !=3D idx) { - VIR_TEST_DEBUG("\nExpect [%d]\n", disk->idx); - VIR_TEST_DEBUG("Actual [%d]\n", idx); + VIR_TEST_DEBUG("\nExpect [%d]", disk->idx); + VIR_TEST_DEBUG("Actual [%d]", idx); return -1; } =20 if (disk->partition !=3D partition) { - VIR_TEST_DEBUG("\nExpect [%d]\n", disk->partition); - VIR_TEST_DEBUG("Actual [%d]\n", partition); + VIR_TEST_DEBUG("\nExpect [%d]", disk->partition); + VIR_TEST_DEBUG("Actual [%d]", partition); return -1; } } =20 for (i =3D 0; i < ARRAY_CARDINALITY(diskNamesInvalid); ++i) { if (!virDiskNameParse(diskNamesInvalid[i], &idx, &partition)) { - VIR_TEST_DEBUG("Should Fail [%s]\n", diskNamesInvalid[i]); + VIR_TEST_DEBUG("Should Fail [%s]", diskNamesInvalid[i]); return -1; } } @@ -166,9 +166,9 @@ testParseVersionString(const void *data ATTRIBUTE_UNUSE= D) versions[i].allowMissing); =20 if (result !=3D versions[i].result) { - VIR_TEST_DEBUG("\nVersion string [%s]\n", versions[i].string); - VIR_TEST_DEBUG("Expect result [%d]\n", versions[i].result); - VIR_TEST_DEBUG("Actual result [%d]\n", result); + VIR_TEST_DEBUG("\nVersion string [%s]", versions[i].string); + VIR_TEST_DEBUG("Expect result [%d]", versions[i].result); + VIR_TEST_DEBUG("Actual result [%d]", result); =20 return -1; } @@ -177,9 +177,9 @@ testParseVersionString(const void *data ATTRIBUTE_UNUSE= D) continue; =20 if (version !=3D versions[i].version) { - VIR_TEST_DEBUG("\nVersion string [%s]\n", versions[i].string); - VIR_TEST_DEBUG("Expect version [%lu]\n", versions[i].version); - VIR_TEST_DEBUG("Actual version [%lu]\n", version); + VIR_TEST_DEBUG("\nVersion string [%s]", versions[i].string); + VIR_TEST_DEBUG("Expect version [%lu]", versions[i].version); + VIR_TEST_DEBUG("Actual version [%lu]", version); =20 return -1; } @@ -213,9 +213,9 @@ testRoundValueToPowerOfTwo(const void *data ATTRIBUTE_U= NUSED) for (i =3D 0; i < ARRAY_CARDINALITY(roundData); i++) { result =3D VIR_ROUND_UP_POWER_OF_TWO(roundData[i].input); if (roundData[i].output !=3D result) { - VIR_TEST_DEBUG("\nInput number [%u]\n", roundData[i].input); - VIR_TEST_DEBUG("Expected number [%u]\n", roundData[i].output); - VIR_TEST_DEBUG("Actual number [%u]\n", result); + VIR_TEST_DEBUG("\nInput number [%u]", roundData[i].input); + VIR_TEST_DEBUG("Expected number [%u]", roundData[i].output); + VIR_TEST_DEBUG("Actual number [%u]", result); =20 return -1; } diff --git a/tests/virbuftest.c b/tests/virbuftest.c index caad6f3ecb..a7eaef636d 100644 --- a/tests/virbuftest.c +++ b/tests/virbuftest.c @@ -354,7 +354,7 @@ testBufAddStr(const void *opaque ATTRIBUTE_UNUSED) } =20 if (STRNEQ_NULLABLE(actual, data->expect)) { - VIR_TEST_DEBUG("testBufAddStr(): Strings don't match:\n"); + VIR_TEST_DEBUG("testBufAddStr(): Strings don't match:"); virTestDifference(stderr, data->expect, actual); goto cleanup; } @@ -387,7 +387,7 @@ testBufEscapeStr(const void *opaque ATTRIBUTE_UNUSED) } =20 if (STRNEQ_NULLABLE(actual, data->expect)) { - VIR_TEST_DEBUG("testBufEscapeStr(): Strings don't match:\n"); + VIR_TEST_DEBUG("testBufEscapeStr(): Strings don't match:"); virTestDifference(stderr, data->expect, actual); goto cleanup; } @@ -416,7 +416,7 @@ testBufEscapeRegex(const void *opaque) } =20 if (STRNEQ_NULLABLE(actual, data->expect)) { - VIR_TEST_DEBUG("testBufEscapeRegex: Strings don't match:\n"); + VIR_TEST_DEBUG("testBufEscapeRegex: Strings don't match:"); virTestDifference(stderr, data->expect, actual); goto cleanup; } @@ -445,7 +445,7 @@ testBufSetIndent(const void *opaque ATTRIBUTE_UNUSED) goto cleanup; =20 if (STRNEQ(actual, " test\n test2\n")) { - VIR_TEST_DEBUG("testBufSetIndent: expected indent not set\n"); + VIR_TEST_DEBUG("testBufSetIndent: expected indent not set"); goto cleanup; } =20 diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c index bb60dd3ffc..88e6e9dc16 100644 --- a/tests/virhostcputest.c +++ b/tests/virhostcputest.c @@ -48,7 +48,7 @@ linuxTestCompareFiles(const char *cpuinfofile, &nodeinfo.cores, &nodeinfo.threads)= < 0) { if (virTestGetDebug()) { if (virGetLastErrorCode()) - VIR_TEST_DEBUG("\n%s\n", virGetLastErrorMessage()); + VIR_TEST_DEBUG("\n%s", virGetLastErrorMessage()); } VIR_FORCE_FCLOSE(cpuinfo); goto fail; diff --git a/tests/virjsontest.c b/tests/virjsontest.c index 4241acd911..dbc0b41cc8 100644 --- a/tests/virjsontest.c +++ b/tests/virjsontest.c @@ -42,7 +42,7 @@ testJSONFromFile(const void *data) VIR_TEST_VERBOSE("Failed to parse %s\n", info->doc); return -1; } else { - VIR_TEST_DEBUG("As expected, failed to parse %s\n", info->doc); + VIR_TEST_DEBUG("As expected, failed to parse %s", info->doc); return 0; } } else { @@ -77,7 +77,7 @@ testJSONFromString(const void *data) VIR_TEST_VERBOSE("Failed to parse %s\n", info->doc); return -1; } else { - VIR_TEST_DEBUG("As expected, failed to parse %s\n", info->doc); + VIR_TEST_DEBUG("As expected, failed to parse %s", info->doc); return 0; } } else { @@ -87,7 +87,7 @@ testJSONFromString(const void *data) } } =20 - VIR_TEST_DEBUG("Parsed %s\n", info->doc); + VIR_TEST_DEBUG("Parsed %s", info->doc); =20 if (!(formatted =3D virJSONValueToString(json, false))) { VIR_TEST_VERBOSE("Failed to format json data\n"); diff --git a/tests/virlogtest.c b/tests/virlogtest.c index 62b4b75300..ea7fd5e2a4 100644 --- a/tests/virlogtest.c +++ b/tests/virlogtest.c @@ -36,7 +36,7 @@ testLogMatch(const void *opaque) =20 bool got =3D virLogProbablyLogMessage(data->str); if (got !=3D data->pass) { - VIR_TEST_DEBUG("Expected '%d' but got '%d' for '%s'\n", + VIR_TEST_DEBUG("Expected '%d' but got '%d' for '%s'", data->pass, got, data->str); return -1; } @@ -54,7 +54,7 @@ testLogParseOutputs(const void *opaque) noutputs =3D virLogParseOutputs(data->str, &outputs); if (noutputs < 0) { if (!data->pass) { - VIR_TEST_DEBUG("Got expected error: %s\n", + VIR_TEST_DEBUG("Got expected error: %s", virGetLastErrorMessage()); virResetLastError(); ret =3D 0; @@ -62,10 +62,10 @@ testLogParseOutputs(const void *opaque) } } else if (noutputs !=3D data->count) { VIR_TEST_DEBUG("Expected number of parsed outputs is %d, " - "but got %d\n", data->count, noutputs); + "but got %d", data->count, noutputs); goto cleanup; } else if (!data->pass) { - VIR_TEST_DEBUG("Test should have failed\n"); + VIR_TEST_DEBUG("Test should have failed"); goto cleanup; } =20 @@ -86,7 +86,7 @@ testLogParseFilters(const void *opaque) nfilters =3D virLogParseFilters(data->str, &filters); if (nfilters < 0) { if (!data->pass) { - VIR_TEST_DEBUG("Got expected error: %s\n", + VIR_TEST_DEBUG("Got expected error: %s", virGetLastErrorMessage()); virResetLastError(); ret =3D 0; @@ -94,10 +94,10 @@ testLogParseFilters(const void *opaque) } } else if (nfilters !=3D data->count) { VIR_TEST_DEBUG("Expected number of parsed outputs is %d, " - "but got %d\n", data->count, nfilters); + "but got %d", data->count, nfilters); goto cleanup; } else if (!data->pass) { - VIR_TEST_DEBUG("Test should have failed\n"); + VIR_TEST_DEBUG("Test should have failed"); goto cleanup; } =20 diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c index 816bfe05d4..9089428047 100644 --- a/tests/virnetdaemontest.c +++ b/tests/virnetdaemontest.c @@ -338,13 +338,13 @@ static int testExecRestart(const void *opaque) cleanup: if (ret < 0) { if (!data->pass) { - VIR_TEST_DEBUG("Got expected error: %s\n", + VIR_TEST_DEBUG("Got expected error: %s", virGetLastErrorMessage()); virResetLastError(); ret =3D 0; } } else if (!data->pass) { - VIR_TEST_DEBUG("Test should have failed\n"); + VIR_TEST_DEBUG("Test should have failed"); ret =3D -1; } VIR_FREE(infile); diff --git a/tests/virpcitest.c b/tests/virpcitest.c index 961a7eff1a..b4c51851d7 100644 --- a/tests/virpcitest.c +++ b/tests/virpcitest.c @@ -359,7 +359,7 @@ mymain(void) char *fakerootdir; =20 if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { - VIR_TEST_DEBUG("Out of memory\n"); + VIR_TEST_DEBUG("Out of memory"); abort(); } =20 diff --git a/tests/virresctrltest.c b/tests/virresctrltest.c index 5abbb11e9a..34882ac127 100644 --- a/tests/virresctrltest.c +++ b/tests/virresctrltest.c @@ -56,7 +56,7 @@ test_virResctrlGetUnused(const void *opaque) ret =3D 0; goto cleanup; } else if (data->fail) { - VIR_TEST_DEBUG("Error expected but there wasn't any.\n"); + VIR_TEST_DEBUG("Error expected but there wasn't any."); ret =3D -1; goto cleanup; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 09:59:03 2024 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 From nobody Fri Mar 29 09:59:03 2024 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=1565610878; cv=none; d=zoho.com; s=zohoarc; b=EMBlvMFLQ5ZqEsxDLtFwNceGtqwrUBjfCOs65u1kuOTfYJw4BI4LcGsWfKdFsGueLLZMf9gqedwLnB5YPuL+J2YIYUMEDrXG2fWRAl3jKHv9V0kP5hOaCWaF+a9cNRSf7ISKFJALkpSWW+CuGhiMFuPGyd1op5WFC1pXRDwTVjU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610878; 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=Lb6fS/CDq7m+6mMZ+dYj58wbZrYNatowu/1v02UXR54=; b=Ixc1T+bmemQWGUNRwTlzDmAHmsR+JoW5vZ3wHTkH0sCmvdajwLYZww+1vdx4x8G3iR5B/EH20SYxJnhmiPIoJy9+x9te6CxtzPCkwFElFGgQcjqAUNizCyMh5mE3LZTyikn1mAYSagd+Ausd3SH8H7LH52Ux5fo3PyBEeLYP/+M= 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 1565610878010219.47015260986723; Mon, 12 Aug 2019 04:54:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C5CC8E591; Mon, 12 Aug 2019 11:54:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5931369FAF; Mon, 12 Aug 2019 11:54:36 +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 25CB124F30; Mon, 12 Aug 2019 11:54:36 +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 x7CBsWoA016146 for ; Mon, 12 Aug 2019 07:54:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 662DA10016E8; Mon, 12 Aug 2019 11:54:32 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id E65AC1001944 for ; Mon, 12 Aug 2019 11:54:31 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:19 +0200 Message-Id: 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 3/9] virhashtest: Drop useless new line 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 12 Aug 2019 11:54:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/virhashtest.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/virhashtest.c b/tests/virhashtest.c index 95634eec80..2355e7bc63 100644 --- a/tests/virhashtest.c +++ b/tests/virhashtest.c @@ -47,9 +47,6 @@ testHashInit(int size) } } =20 - if (size && size !=3D virHashTableSize(hash)) - VIR_TEST_DEBUG("\n"); - return hash; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 09:59:03 2024 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=1565610884; cv=none; d=zoho.com; s=zohoarc; b=ZXCDAipl9THe+Okz8LMQZheUN7LNbm9wgM/v39jjlrbHqG7593t8YvzTKwL3JYhY9TxqkSu62PeRf9Q6rT0x4f3i9gfEmIS/jpHE0OfTjPfUMjMDARl5nr6WnwCO7zxLWgAedYrOlHgOtkv0KYIYHc5POTYizJKb2xvsGDG7Sr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610884; 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=Kemnm1OmH8PaYAsix9OPL1/Bg+p87GolytoO/0Te3Wg=; b=CJSjOTSOP/N9EbG661LY32z9/8HJx9yZ0oo/ff6SSz5wBDJ0fYW/uZJd5H2bNrCN8xdmH5128BRlCHHZ7bcH1VnDCx8S/Ooiwr3F++zzzmB/iJymYaBMrepA8duhmW8FP+ECnN8oCaYhKlHRIIE/MpJuGn5Z+AhVHaGuIxSMu9Y= 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 1565610884426484.8874997704272; Mon, 12 Aug 2019 04:54:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 223143CA0B; Mon, 12 Aug 2019 11:54:43 +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 012AB5D9CA; Mon, 12 Aug 2019 11:54:43 +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 B73C6180124D; Mon, 12 Aug 2019 11:54:42 +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 x7CBsYUg016166 for ; Mon, 12 Aug 2019 07:54:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id C98621001B17; Mon, 12 Aug 2019 11:54:34 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55B501001B1A for ; Mon, 12 Aug 2019 11:54:32 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:20 +0200 Message-Id: <885689ab9378485b5d7b1efe677656b0a32cb309.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 4/9] virhostdevtest: Check for integer retval in more verbose way 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 12 Aug 2019 11:54:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Michal Privoznik There are few functions called from the test which return an integer but their retval is compared as if it was a pointer. Now, there is nothing wrong with that from machine POV, but from readability perspective it's wrong. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/virhostdevtest.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 20984f3442..2c65db2068 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -161,22 +161,22 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, - &hostdevs[0], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, + &hostdevs[0], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain ag= ain"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, - &hostdevs[1], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, + &hostdevs[1], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, - &hostdevs[2], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, + &hostdevs[2], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); @@ -252,22 +252,22 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, - &hostdevs[0], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, + &hostdevs[0], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain ag= ain"); - if (!virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, - &hostdevs[1], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, + &hostdevs[1], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again"); - if (!virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, - &hostdevs[2], 1, 0)) + if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, + &hostdevs[2], 1, 0) =3D=3D 0) goto cleanup; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 09:59:03 2024 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=1565610881; cv=none; d=zoho.com; s=zohoarc; b=kA2p5JnQu8yFRlKNuUK4bOjK1d9RnzZ9VxMi5FWvMqSw7WJQhaOowiVRGTH6+1Qp3C9FrCRL+v2UBW8P9aU++Rzgd/Kp1eS7NkhzbWRKye8KhpiF/+vj61Tf9eHCZIGu87q1LCzeQQW5nJUcRgcAlvHD17J3O0pB5CanA8TL/Co= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610881; 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=+CUEEXL2pAQt8v7NHpOKdH6KhykiJsq9qYGfJqeZr4g=; b=OOSb+LhcdJaQ1mucO9pmIfUMYoUGdQgYdOSYCJldZD741GmmylNezn77xcJuneRkIu2z52HPAxTcw8C0DcIfEfvjenEcYDXik0MfWQTLf8BU71a4rqfd7jdzM0DzQl0GlSnrNi8+TxojjDlLavCw2FkYmzP5NmikbWf3KsNLv7E= 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 156561088107013.815406210835363; Mon, 12 Aug 2019 04:54:41 -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 9D06F3066FD9; Mon, 12 Aug 2019 11:54:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79C1E7CD9C; 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 4241624F37; Mon, 12 Aug 2019 11:54:39 +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 x7CBsZDr016171 for ; Mon, 12 Aug 2019 07:54:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 957D21001B20; Mon, 12 Aug 2019 11:54:35 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 215E01001B17 for ; Mon, 12 Aug 2019 11:54:34 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:21 +0200 Message-Id: <6d4972c218e75d853a9740ff5a11ee2595af3e39.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 5/9] virhostdevtest: Drop most of 'cleanup' and 'out' labels 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.42]); Mon, 12 Aug 2019 11:54:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Michal Privoznik In this test there is this macro CHECK_LIST_COUNT() which checks if a list of PCI devices contains expected count. If it doesn't an error is reported and 'goto cleanup' is invoked. There's no real reason for that as even since its introduction there is no cleanup done and all 'cleanup' labels contains nothing but 'return'. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/virhostdevtest.c | 147 ++++++++++++----------------------------- 1 file changed, 42 insertions(+), 105 deletions(-) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 2c65db2068..713e0ff9a6 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -41,7 +41,7 @@ VIR_LOG_INIT("tests.hostdevtest"); virReportError(VIR_ERR_INTERNAL_ERROR, \ "Unexpected count of items in " #list ": %zu, "= \ "expecting %zu", actualCount, (size_t) cnt); \ - goto cleanup; \ + return -1; \ } \ } while (0) =20 @@ -132,7 +132,6 @@ myInit(void) static int testVirHostdevPreparePCIHostdevs_unmanaged(void) { - int ret =3D -1; size_t active_count, inactive_count, i; =20 for (i =3D 0; i < nhostdevs; i++) @@ -145,7 +144,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) VIR_DEBUG("Test 0 hostdevs"); if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, NULL, 0, 0) < 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -153,7 +152,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) VIR_DEBUG("Test >=3D1 unmanaged hostdevs"); if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, hostdevs, nhostdevs, 0) < 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count + nhostdevs); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count - nhostd= evs); =20 @@ -163,35 +162,30 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again"); if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, &hostdevs[0], 1, 0) =3D=3D 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain ag= ain"); if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, &hostdevs[1], 1, 0) =3D=3D 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again"); if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, &hostdevs[2], 1, 0) =3D=3D 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - ret =3D 0; - - cleanup: - return ret; - + return 0; } =20 static int testVirHostdevReAttachPCIHostdevs_unmanaged(void) { - int ret =3D -1; size_t active_count, inactive_count, i; =20 for (i =3D 0; i < nhostdevs; i++) { @@ -215,17 +209,12 @@ testVirHostdevReAttachPCIHostdevs_unmanaged(void) CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count - nhostdevs); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count + nhostd= evs); =20 - ret =3D 0; - - cleanup: - return ret; - + return 0; } =20 static int testVirHostdevPreparePCIHostdevs_managed(bool mixed) { - int ret =3D -1; size_t active_count, inactive_count, i; =20 for (i =3D 0; i < nhostdevs; i++) @@ -238,7 +227,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) VIR_DEBUG("Test >=3D1 hostdevs"); if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, hostdevs, nhostdevs, 0) < 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count + nhostdevs); /* If testing a mixed roundtrip, devices are already in the inactive l= ist * before we start and are removed from it as soon as we attach them to @@ -254,35 +243,30 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again"); if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, &hostdevs[0], 1, 0) =3D=3D 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain ag= ain"); if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, &hostdevs[1], 1, 0) =3D=3D 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again"); if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, &hostdevs[2], 1, 0) =3D=3D 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - ret =3D 0; - - cleanup: - return ret; - + return 0; } =20 static int testVirHostdevReAttachPCIHostdevs_managed(bool mixed) { - int ret =3D -1; size_t active_count, inactive_count, i; =20 for (i =3D 0; i < nhostdevs; i++) { @@ -311,82 +295,63 @@ testVirHostdevReAttachPCIHostdevs_managed(bool mixed) else CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - ret =3D 0; - - cleanup: - return ret; - + return 0; } =20 static int testVirHostdevDetachPCINodeDevice(void) { - int ret =3D -1; size_t active_count, inactive_count, i; =20 for (i =3D 0; i < nhostdevs; i++) { active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); if (virHostdevPCINodeDeviceDetach(mgr, dev[i]) < 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count + 1); } =20 - ret =3D 0; - - cleanup: - return ret; + return 0; } =20 static int testVirHostdevResetPCINodeDevice(void) { - int ret =3D -1; size_t active_count, inactive_count, i; =20 for (i =3D 0; i < nhostdevs; i++) { active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); if (virHostdevPCINodeDeviceReset(mgr, dev[i]) < 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); } =20 - ret =3D 0; - - cleanup: - return ret; - + return 0; } =20 static int testVirHostdevReAttachPCINodeDevice(void) { - int ret =3D -1; size_t active_count, inactive_count, i; =20 for (i =3D 0; i < nhostdevs; i++) { active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); if (virHostdevPCINodeDeviceReAttach(mgr, dev[i]) < 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count - 1); } =20 - ret =3D 0; - - cleanup: - return ret; - + return 0; } =20 static int testVirHostdevUpdateActivePCIHostdevs(void) { - int ret =3D -1; size_t active_count, inactive_count; =20 active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); @@ -395,21 +360,18 @@ testVirHostdevUpdateActivePCIHostdevs(void) VIR_DEBUG("Test 0 hostdevs"); if (virHostdevUpdateActivePCIDevices(mgr, NULL, 0, drv_name, dom_name) < 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 VIR_DEBUG("Test >=3D1 hostdevs"); if (virHostdevUpdateActivePCIDevices(mgr, hostdevs, nhostdevs, drv_name, dom_name) < 0) - goto cleanup; + return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count + nhostdevs); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - ret =3D 0; - - cleanup: - return ret; + return 0; } =20 /** @@ -424,17 +386,12 @@ testVirHostdevUpdateActivePCIHostdevs(void) static int testVirHostdevRoundtripNoGuest(const void *opaque ATTRIBUTE_UNUSED) { - int ret =3D -1; - if (testVirHostdevDetachPCINodeDevice() < 0) - goto out; + return -1; if (testVirHostdevReAttachPCINodeDevice() < 0) - goto out; + return -1; =20 - ret =3D 0; - - out: - return ret; + return 0; } =20 /** @@ -451,21 +408,16 @@ testVirHostdevRoundtripNoGuest(const void *opaque ATT= RIBUTE_UNUSED) static int testVirHostdevRoundtripUnmanaged(const void *opaque ATTRIBUTE_UNUSED) { - int ret =3D -1; - if (testVirHostdevDetachPCINodeDevice() < 0) - goto out; + return -1; if (testVirHostdevPreparePCIHostdevs_unmanaged() < 0) - goto out; + return -1; if (testVirHostdevReAttachPCIHostdevs_unmanaged() < 0) - goto out; + return -1; if (testVirHostdevReAttachPCINodeDevice() < 0) - goto out; + return -1; =20 - ret =3D 0; - - out: - return ret; + return 0; } =20 /** @@ -480,17 +432,12 @@ testVirHostdevRoundtripUnmanaged(const void *opaque A= TTRIBUTE_UNUSED) static int testVirHostdevRoundtripManaged(const void *opaque ATTRIBUTE_UNUSED) { - int ret =3D -1; - if (testVirHostdevPreparePCIHostdevs_managed(false) < 0) - goto out; + return -1; if (testVirHostdevReAttachPCIHostdevs_managed(false) < 0) - goto out; + return -1; =20 - ret =3D 0; - - out: - return ret; + return 0; } =20 /** @@ -508,21 +455,16 @@ testVirHostdevRoundtripManaged(const void *opaque ATT= RIBUTE_UNUSED) static int testVirHostdevRoundtripMixed(const void *opaque ATTRIBUTE_UNUSED) { - int ret =3D -1; - if (testVirHostdevDetachPCINodeDevice() < 0) - goto out; + return -1; if (testVirHostdevPreparePCIHostdevs_managed(true) < 0) - goto out; + return -1; if (testVirHostdevReAttachPCIHostdevs_managed(true) < 0) - goto out; + return -1; if (testVirHostdevReAttachPCINodeDevice() < 0) - goto out; + return -1; =20 - ret =3D 0; - - out: - return ret; + return 0; } =20 /** @@ -537,17 +479,12 @@ testVirHostdevRoundtripMixed(const void *opaque ATTRI= BUTE_UNUSED) static int testVirHostdevOther(const void *opaque ATTRIBUTE_UNUSED) { - int ret =3D -1; - if (testVirHostdevResetPCINodeDevice() < 0) - goto out; + return -1; if (testVirHostdevUpdateActivePCIHostdevs() < 0) - goto out; + return -1; =20 - ret =3D 0; - - out: - return ret; + return 0; } =20 # define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX" --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 09:59:03 2024 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=1565610884; cv=none; d=zoho.com; s=zohoarc; b=cYvLUxCLnvM6PUJtJ7k7cE9YCBpz3iB0xtlov7VfbvUeR4AyMDwSBTjzqpnRf18QJX7Te91AU9Fd/SLwceuBnmNWAW82K04s4YWmTJmO/ZcIM3P89RaL5aABPV6/q/z8JmoUuLu4f1FSFxS4awu4wZJEey2dAGEKX/FOR/4ZVqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610884; 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=6ETeU6q1Cg2qGL+IF9wO5kex3MYlYCa0n3SN/2pi1rs=; b=JC3AWIi5OLAIAIRxsfrpVuhLfvJQOsKyc7g7Nzt+3fasifdQW9QUb0IVDmIZSG1YUan976WFUn1LUU86GHWDS2TzCWn67tIbxLwT94F/voZPpTYeMLZY6Wd+AtEmoYmp9b630gaIU/TBksgHNb7PLtAt1AO+yjRMvKnpojG/W8o= 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 156561088407577.04690855120941; Mon, 12 Aug 2019 04:54:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC3723162916; Mon, 12 Aug 2019 11:54:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C976828DED; Mon, 12 Aug 2019 11:54:42 +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 8E85F24F3A; Mon, 12 Aug 2019 11:54:42 +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 x7CBsa10016181 for ; Mon, 12 Aug 2019 07:54:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 60A721001944; Mon, 12 Aug 2019 11:54:36 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id E16A11001B17 for ; Mon, 12 Aug 2019 11:54:35 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:22 +0200 Message-Id: <73b631fab9680a9c322f8bc714c0a03fd54901b6.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 6/9] virhostdevtest: Drop useless VIR_TEST_DEBUG 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 12 Aug 2019 11:54:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Michal Privoznik The virTestRun() already reports the same. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/virhostdevtest.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 713e0ff9a6..f6ea4c54fd 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -509,7 +509,6 @@ mymain(void) =20 # define DO_TEST(fnc) \ do { \ - VIR_DEBUG("Testing: %s", #fnc); \ if (virTestRun(#fnc, fnc, NULL) < 0) \ ret =3D -1; \ } while (0) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 09:59:03 2024 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=1565610887; cv=none; d=zoho.com; s=zohoarc; b=ZFL3g606YuRDMh0ykDCGYRXojUq8056RNI4nE6SlGcMrpyu8G2nxEiyi87oDQUfyAfg0N2qAhSsu1xddLu3YbvNv/VbsdzthJKCWdlWVFMq1LRJL0GlosT6i6hlsLg8DLyg0ROO+HGRg7nSFK3zE3o7SHWEYYSPUVMCVQdbQaHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610887; 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=GUZrGKReTW08Bg5zJvHnFAw9clZZyLFI5KRfKfZPJDo=; b=Iusicm+Y7aosUHDlE8TOOxOHOIezjsd8Fqeyv4BCHCZofQ1iTBAb+UkcWRDrFwAFmMGhkeqN1Qn8SdDkjz2w9wK3BU06RrQFDC3Sky0RbAa3B/K7lZ4eIyLb3ehSFHMu+1T3vhlSRAh1OiaYzZlyl/AaXp2fSobgLT2XYvO13aU= 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 1565610887670765.9217755202354; Mon, 12 Aug 2019 04:54:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C61530615C5; Mon, 12 Aug 2019 11:54:46 +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 41FA163B8A; Mon, 12 Aug 2019 11:54:46 +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 069FF180B536; Mon, 12 Aug 2019 11:54:46 +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 x7CBscvb016200 for ; Mon, 12 Aug 2019 07:54:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id ED6EC1001B1A; Mon, 12 Aug 2019 11:54:38 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77F721001947 for ; Mon, 12 Aug 2019 11:54:36 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:23 +0200 Message-Id: <54b5c8538940c50fe0fb3fd3ce179decc85cc46b.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 7/9] virhostdevtest: s/VIR_DEBUG/VIR_TEST_DEBUG/ 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 12 Aug 2019 11:54:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Michal Privoznik There's no need to have VIR_DEBUG() really. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/virhostdevtest.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index f6ea4c54fd..248a5493f3 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -141,7 +141,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); =20 /* Test normal functionality */ - VIR_DEBUG("Test 0 hostdevs"); + VIR_TEST_DEBUG("Test 0 hostdevs"); if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, NULL, 0, 0) < 0) return -1; @@ -149,7 +149,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 /* Test unmanaged hostdevs */ - VIR_DEBUG("Test >=3D1 unmanaged hostdevs"); + VIR_TEST_DEBUG("Test >=3D1 unmanaged hostdevs"); if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, hostdevs, nhostdevs, 0) < 0) return -1; @@ -159,21 +159,21 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) /* Test conflict */ active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); - VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again"); + VIR_TEST_DEBUG("Test: prepare same hostdevs for same driver/domain aga= in"); if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, &hostdevs[0], 1, 0) =3D=3D 0) return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain ag= ain"); + VIR_TEST_DEBUG("Test: prepare same hostdevs for same driver, diff doma= in again"); if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, &hostdevs[1], 1, 0) =3D=3D 0) return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again"); + VIR_TEST_DEBUG("Test: prepare same hostdevs for diff driver/domain aga= in"); if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, &hostdevs[2], 1, 0) =3D=3D 0) return -1; @@ -190,7 +190,7 @@ testVirHostdevReAttachPCIHostdevs_unmanaged(void) =20 for (i =3D 0; i < nhostdevs; i++) { if (hostdevs[i]->managed !=3D false) { - VIR_DEBUG("invalid test"); + VIR_TEST_DEBUG("invalid test"); return -1; } } @@ -198,12 +198,12 @@ testVirHostdevReAttachPCIHostdevs_unmanaged(void) active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); =20 - VIR_DEBUG("Test 0 hostdevs"); + VIR_TEST_DEBUG("Test 0 hostdevs"); virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, NULL, 0, NULL); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - VIR_DEBUG("Test >=3D1 unmanaged hostdevs"); + VIR_TEST_DEBUG("Test >=3D1 unmanaged hostdevs"); virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, hostdevs, nhostdevs, NULL); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count - nhostdevs); @@ -224,7 +224,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); =20 /* Test normal functionality */ - VIR_DEBUG("Test >=3D1 hostdevs"); + VIR_TEST_DEBUG("Test >=3D1 hostdevs"); if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, hostdevs, nhostdevs, 0) < 0) return -1; @@ -240,21 +240,21 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) /* Test conflict */ active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); - VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again"); + VIR_TEST_DEBUG("Test: prepare same hostdevs for same driver/domain aga= in"); if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, &hostdevs[0], 1, 0) =3D=3D 0) return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain ag= ain"); + VIR_TEST_DEBUG("Test: prepare same hostdevs for same driver, diff doma= in again"); if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, &hostdevs[1], 1, 0) =3D=3D 0) return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again"); + VIR_TEST_DEBUG("Test: prepare same hostdevs for diff driver/domain aga= in"); if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, &hostdevs[2], 1, 0) =3D=3D 0) return -1; @@ -271,7 +271,7 @@ testVirHostdevReAttachPCIHostdevs_managed(bool mixed) =20 for (i =3D 0; i < nhostdevs; i++) { if (hostdevs[i]->managed !=3D true) { - VIR_DEBUG("invalid test"); + VIR_TEST_DEBUG("invalid test"); return -1; } } @@ -279,12 +279,12 @@ testVirHostdevReAttachPCIHostdevs_managed(bool mixed) active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); =20 - VIR_DEBUG("Test 0 hostdevs"); + VIR_TEST_DEBUG("Test 0 hostdevs"); virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, NULL, 0, NULL); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - VIR_DEBUG("Test >=3D1 hostdevs"); + VIR_TEST_DEBUG("Test >=3D1 hostdevs"); virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, hostdevs, nhostdevs, NULL); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count - nhostdevs); @@ -357,14 +357,14 @@ testVirHostdevUpdateActivePCIHostdevs(void) active_count =3D virPCIDeviceListCount(mgr->activePCIHostdevs); inactive_count =3D virPCIDeviceListCount(mgr->inactivePCIHostdevs); =20 - VIR_DEBUG("Test 0 hostdevs"); + VIR_TEST_DEBUG("Test 0 hostdevs"); if (virHostdevUpdateActivePCIDevices(mgr, NULL, 0, drv_name, dom_name) < 0) return -1; CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 - VIR_DEBUG("Test >=3D1 hostdevs"); + VIR_TEST_DEBUG("Test >=3D1 hostdevs"); if (virHostdevUpdateActivePCIDevices(mgr, hostdevs, nhostdevs, drv_name, dom_name) < 0) return -1; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 09:59:03 2024 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=1565610890; cv=none; d=zoho.com; s=zohoarc; b=OoyoE2TCmj1+rgH9gzTDWMpZq+APY7dvPp2W5+xID2337H7PdWJshLuue3t8ucnWHlPETF3PdbqCeMn6CrWTdI2aqD8aJNk9leIiKtc0QdiKv+M+DvsK2QqKkyE3rci1LL6NfazezdWcy+XP0IZEu+D8oTfJYXEkGyoYoOZ27Oc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610890; 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=nzNyqh5idYZaRhbLxiBdUrT9WFVLEXnTxSkEEq1kQt0=; b=gMRYyOv3gF5sVWbTNCyzvOBoN1tZyWxJGXIARcEvZaB6ZZVPbHmNGjDudDh7jRcRsG17bVRKNNz80wtTts2OkLVhqt02oqC9V9c0RBBWfRI7NKm/lrA0yMwlFJcBvzRWTsM5sSus9OuVsbsuiozgyh7+k7y8yDePQQkwDIwxdFw= 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 1565610890775733.510102830924; Mon, 12 Aug 2019 04:54:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8278219CF8E; Mon, 12 Aug 2019 11:54:49 +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 637EC5D9CA; Mon, 12 Aug 2019 11:54:49 +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 2E74C180BA9C; Mon, 12 Aug 2019 11:54:49 +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 x7CBsd3K016207 for ; Mon, 12 Aug 2019 07:54:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id BA84E1001947; Mon, 12 Aug 2019 11:54:39 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 446271001B1A for ; Mon, 12 Aug 2019 11:54:39 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:24 +0200 Message-Id: <2ecd87bc11da2d5c49a0f4d14cf8453c1968a1e2.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 8/9] virhostdevtest: Reset libvirt error on expected failure 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 12 Aug 2019 11:54:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If a libvirt error occurred during a test, then virTestRun() reports it (regardless of test returning success or failure). For instance, in this specific case, a hostdev is detached twice and the second attempt is expected to fail. It does fail and libvirt error is reported which is then printed onto stderr. Insert virResetLastError() calls on appropriate places to avoid that. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/virhostdevtest.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 248a5493f3..b64ba58923 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -163,6 +163,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, &hostdevs[0], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -170,6 +171,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, &hostdevs[1], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -177,6 +179,7 @@ testVirHostdevPreparePCIHostdevs_unmanaged(void) if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, &hostdevs[2], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -244,6 +247,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid, &hostdevs[0], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -251,6 +255,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) if (virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid, &hostdevs[1], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 @@ -258,6 +263,7 @@ testVirHostdevPreparePCIHostdevs_managed(bool mixed) if (virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid, &hostdevs[2], 1, 0) =3D=3D 0) return -1; + virResetLastError(); CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, active_count); CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, inactive_count); =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 09:59:03 2024 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=1565610894; cv=none; d=zoho.com; s=zohoarc; b=cyCx/TPFoBZZBVYU7hSAhFNFt8mwI/dYIXYPZ6OIfyJxTp7fbGxMicyGGbRFXjaMa80okOYsuNbNIekonMdMMY3zJ22cOC0MyyPlTAWTlmh6hdAJqILTTf8pA0yAugGinb0m38WLDOlTFMEWNuxe7K7f+SX1+pb5eWQdsdmtHgc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565610894; 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=NXfXFCPhwiV4z1UvYCkadVy1Zixhv8JQoMPsV6NrQ74=; b=Ctp9TyXnT0cFZRHbTBZOrTlzI1IxxktQzE12aZWkQWbLq3VDxXDtRpnJALlewHT23E2WI/MmhcU0Nb5vFle2HpfC4Kb009/lDT4JqKMnWdG+hUckPkLGhfk9niFCgyEicMpTv920M8Ic5iLRg+albKfki5Qnc5eXt4KWiu8cOvA= 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 1565610894692241.2217317535907; Mon, 12 Aug 2019 04:54:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6EE6A3001839; Mon, 12 Aug 2019 11:54:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F28B18E2F; Mon, 12 Aug 2019 11:54:53 +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 0B61624BC3; Mon, 12 Aug 2019 11:54:53 +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 x7CBsegI016217 for ; Mon, 12 Aug 2019 07:54:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8729C1001B20; Mon, 12 Aug 2019 11:54:40 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1303C1001B17 for ; Mon, 12 Aug 2019 11:54:39 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 13:54:25 +0200 Message-Id: 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 9/9] virhostdevtest: s/virReportError/fprintf/ 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 12 Aug 2019 11:54:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If a test fails, it's stderr is caught in the logs. That's how our CI works. But virReportError() is not. Signed-off-by: Michal Privoznik --- tests/virhostdevtest.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index b64ba58923..209cde5419 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -38,9 +38,8 @@ VIR_LOG_INIT("tests.hostdevtest"); do { \ size_t actualCount; \ if ((actualCount =3D cb(list)) !=3D cnt) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - "Unexpected count of items in " #list ": %zu, "= \ - "expecting %zu", actualCount, (size_t) cnt); \ + fprintf(stderr, "Unexpected count of items in " #list ": %zu, = " \ + "expecting %zu", actualCount, (size_t) cnt); \ return -1; \ } \ } while (0) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list