From nobody Sun Feb 8 22:50:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1669801707; cv=none; d=zohomail.com; s=zohoarc; b=Me6/L0EVaCXi8ITGfcCNBzcl6eqinrkcPZq/XkLjlVZ9rKs0YYRZysuSgJJGrIxDJCS3gUALtOtBPi/LX2I1hKk4MNs5KWY7utHr+qd9+ali8UF/dpnuHBFrnzc7jBAf95IU2Fr8Dz1/NC72NyKitEPvhroSZoGsJbT7fsEOaPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669801707; 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; bh=ji0+22//VXmoEwPZ9292IPYBWPVzr+pR09lp4x5HKUI=; b=Hc3z3MVSC/cMXiODuJgPNdkqsi+PdHc1DM26FZk3My1WSqqv88IHzhe56VCnDBfXc1DY6KJGZ5WBowykxZmS64Iox4ntBn8ThqQAw6rBpxxx85QL2iHjD+GTBsUVe/HK/JEx1w9ku2xIucXYYExzQVxtkPvWiFOqlsAKDRJ7b3w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1669801707415497.50585386573016; Wed, 30 Nov 2022 01:48:27 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-zfTjJX3QO-22ab7WHYrDxQ-1; Wed, 30 Nov 2022 04:48:22 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D523529DD994; Wed, 30 Nov 2022 09:48:18 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B79561401C2D; Wed, 30 Nov 2022 09:48:18 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7FD771946A40; Wed, 30 Nov 2022 09:48:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6FC9219465A0 for ; Wed, 30 Nov 2022 09:48:17 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 63ABE4B3FCE; Wed, 30 Nov 2022 09:48:17 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 081FB4B3FC8 for ; Wed, 30 Nov 2022 09:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669801705; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ji0+22//VXmoEwPZ9292IPYBWPVzr+pR09lp4x5HKUI=; b=VupwzaWOiGtN4wwxdePn5LSgXUIlzXQJJSd7G4IrxoEe4kszSiSW/i3WaRxe1Do60nfUz7 AEv906iDXEBPa2TvvQOAD4ySzBE5JfR7xMkRKh7uAxSTquRKKnPDunW57YVL0P8+vDYUoV Z7U6d8KTuSgGu3lllVOCT//a0M8JlMw= X-MC-Unique: zfTjJX3QO-22ab7WHYrDxQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 7/9] virbuftest: Cleanup code around virTestDifference() Date: Wed, 30 Nov 2022 10:48:09 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669801708791100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Two things are happening here: 1) Call to virTestDifference() is guarded by '!result || STRNEQ(result, _)' check. This is suboptimal since we have STRNEQ_NULLABLE(). 2) There are couple of VIR_TEST_DEBUG() printings, which are useless. If debug is off they don't print anything, and if it is on, then much more information is printed by subsequent virTestDifference(). This makes the STRNEQ() + virTestDifference() combo look similar to the rest of tests and thus can be picked up by spatch later. Signed-off-by: Michal Privoznik --- tests/virbuftest.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/virbuftest.c b/tests/virbuftest.c index 0ca7927c3f..144df6e66b 100644 --- a/tests/virbuftest.c +++ b/tests/virbuftest.c @@ -92,7 +92,7 @@ static int testBufAutoIndent(const void *data G_GNUC_UNUS= ED) virBufferAddChar(buf, '\n'); =20 result =3D virBufferContentAndReset(buf); - if (!result || STRNEQ(result, expected)) { + if (STRNEQ_NULLABLE(result, expected)) { virTestDifference(stderr, expected, result); ret =3D -1; } @@ -122,7 +122,7 @@ static int testBufTrim(const void *data G_GNUC_UNUSED) virBufferTrim(buf, ",,"); =20 result =3D virBufferContentAndReset(buf); - if (!result || STRNEQ(result, expected)) { + if (STRNEQ_NULLABLE(result, expected)) { virTestDifference(stderr, expected, result); return -1; } @@ -146,7 +146,6 @@ testBufTrimChars(const void *opaque) } =20 if (STRNEQ_NULLABLE(actual, data->expect)) { - VIR_TEST_DEBUG("testBufEscapeStr(): Strings don't match:"); virTestDifference(stderr, data->expect, actual); return -1; } @@ -278,7 +277,6 @@ testBufAddStr(const void *opaque) } =20 if (STRNEQ_NULLABLE(actual, data->expect)) { - VIR_TEST_DEBUG("testBufAddStr(): Strings don't match:"); virTestDifference(stderr, data->expect, actual); return -1; } @@ -306,7 +304,6 @@ testBufEscapeStr(const void *opaque) } =20 if (STRNEQ_NULLABLE(actual, data->expect)) { - VIR_TEST_DEBUG("testBufEscapeStr(): Strings don't match:"); virTestDifference(stderr, data->expect, actual); return -1; } @@ -330,7 +327,6 @@ testBufEscapeRegex(const void *opaque) } =20 if (STRNEQ_NULLABLE(actual, data->expect)) { - VIR_TEST_DEBUG("testBufEscapeRegex: Strings don't match:"); virTestDifference(stderr, data->expect, actual); return -1; } --=20 2.37.4