From nobody Mon Feb 9 11:07:21 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=1617972770; cv=none; d=zohomail.com; s=zohoarc; b=QeuANzJJ4PLIuh4WUFlvC29g+H5Hh2oeVWVZnJh/8uE3OdV0VZR1wAtVI4INNImAiR+UgmqweBpv0R63H1/MSWgVlHhIwlooUWyIMX0KcsexNIBu6yCp7qbOw608NBY8SXucMmMxJRkXqinLrWfeLL3XEtABFIriBl9U86xxTF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617972770; 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=i+DYohhozx+GI4w6RFqRuzsnkkdY4XS8bsfFfa66LwU=; b=KTyAam0bjY3vHYWAO3ta9w4DBVHpCsPYRinKLnUqw3rUWA3MDK7T5ISBZo0wVAEO+fyi7JuVK5ZoMR8japAgfBZw8ph7ghVRuT5i1nDt1r9GKuYfyZiNDyY9uXaYZidf1pWJ/FjY3b1Jb5K5N6ZG0hW0ppfY+7bfxzxzy1JxC7Q= 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) header.from= 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 1617972770484927.0771909454918; Fri, 9 Apr 2021 05:52:50 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-70-8XX03aV-N62jvbLkZnKc8g-1; Fri, 09 Apr 2021 08:52:46 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFE2B6D4F5; Fri, 9 Apr 2021 12:52:41 +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 AA69710013C1; Fri, 9 Apr 2021 12:52:41 +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 F00F31806D10; Fri, 9 Apr 2021 12:52:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139CqcJo009381 for ; Fri, 9 Apr 2021 08:52:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 779995C1D5; Fri, 9 Apr 2021 12:52:38 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id C71535C1A1 for ; Fri, 9 Apr 2021 12:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617972769; 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=i+DYohhozx+GI4w6RFqRuzsnkkdY4XS8bsfFfa66LwU=; b=atc5PSYBIoavXakKONUaRAAqym4yst6nZ45IyEr3DFrVCr6WuqEglzq+R6YC4BDdXjQOeB 459l7LgQeRTAvAQwm2XIlPtPj74UARj0HxSjm7+7AVN4K/RNQgNXByYmJJfIrCMqdN7No3 oUxOfuiWLF/uePz4EP9tijtYRjFU0OA= X-MC-Unique: 8XX03aV-N62jvbLkZnKc8g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 24/25] nodedevmdevctltest: Use internal linewrapping and variable command path stripping Date: Fri, 9 Apr 2021 14:50:26 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Remove `nodedevCompareToFile` which was stripping the path to mdevctl since it's no longer needed if we use the new features of virCommandSetDryRun. Signed-off-by: Peter Krempa --- ...19_36ea_4111_8f0a_8c9a70e21366-define.argv | 5 +++- ...019_36ea_4111_8f0a_8c9a70e21366-start.argv | 5 +++- ...39_495e_4243_ad9f_beb3f14c23d9-define.argv | 5 +++- ...d39_495e_4243_ad9f_beb3f14c23d9-start.argv | 5 +++- ...16_1ca8_49ac_b176_871d16c13076-define.argv | 5 +++- ...916_1ca8_49ac_b176_871d16c13076-start.argv | 5 +++- tests/nodedevmdevctldata/mdevctl-create.argv | 4 ++- .../mdevctl-list-defined.argv | 5 +++- tests/nodedevmdevctldata/mdevctl-stop.argv | 4 ++- .../nodedevmdevctldata/mdevctl-undefine.argv | 4 ++- tests/nodedevmdevctltest.c | 29 +++++-------------- 11 files changed, 44 insertions(+), 32 deletions(-) diff --git a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2= 1366-define.argv b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c= 9a70e21366-define.argv index 118ec7a8da..b8bb276f9f 100644 --- a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-de= fine.argv +++ b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-de= fine.argv @@ -1,2 +1,5 @@ -$MDEVCTL_BINARY$ define -p 0000:00:02.0 --jsonfile /dev/stdin \ +mdevctl \ +define \ +-p 0000:00:02.0 \ +--jsonfile /dev/stdin \ --uuid=3Dd069d019-36ea-4111-8f0a-8c9a70e21366 diff --git a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2= 1366-start.argv b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9= a70e21366-start.argv index 129f438e4a..73a8046d84 100644 --- a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-st= art.argv +++ b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-st= art.argv @@ -1,2 +1,5 @@ -$MDEVCTL_BINARY$ start -p 0000:00:02.0 --jsonfile /dev/stdin \ +mdevctl \ +start \ +-p 0000:00:02.0 \ +--jsonfile /dev/stdin \ --uuid=3Dd069d019-36ea-4111-8f0a-8c9a70e21366 diff --git a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c= 23d9-define.argv b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_be= b3f14c23d9-define.argv index 773e98b963..bf8637ed57 100644 --- a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-de= fine.argv +++ b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-de= fine.argv @@ -1 +1,4 @@ -$MDEVCTL_BINARY$ define -p 0000:00:02.0 --jsonfile /dev/stdin +mdevctl \ +define \ +-p 0000:00:02.0 \ +--jsonfile /dev/stdin diff --git a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c= 23d9-start.argv b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb= 3f14c23d9-start.argv index eb7262035e..eae63f7a7f 100644 --- a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-st= art.argv +++ b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-st= art.argv @@ -1 +1,4 @@ -$MDEVCTL_BINARY$ start -p 0000:00:02.0 --jsonfile /dev/stdin +mdevctl \ +start \ +-p 0000:00:02.0 \ +--jsonfile /dev/stdin diff --git a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c1= 3076-define.argv b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_87= 1d16c13076-define.argv index 773e98b963..bf8637ed57 100644 --- a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-de= fine.argv +++ b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-de= fine.argv @@ -1 +1,4 @@ -$MDEVCTL_BINARY$ define -p 0000:00:02.0 --jsonfile /dev/stdin +mdevctl \ +define \ +-p 0000:00:02.0 \ +--jsonfile /dev/stdin diff --git a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c1= 3076-start.argv b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871= d16c13076-start.argv index eb7262035e..eae63f7a7f 100644 --- a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-st= art.argv +++ b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-st= art.argv @@ -1 +1,4 @@ -$MDEVCTL_BINARY$ start -p 0000:00:02.0 --jsonfile /dev/stdin +mdevctl \ +start \ +-p 0000:00:02.0 \ +--jsonfile /dev/stdin diff --git a/tests/nodedevmdevctldata/mdevctl-create.argv b/tests/nodedevmd= evctldata/mdevctl-create.argv index 802109340c..f19c9780dc 100644 --- a/tests/nodedevmdevctldata/mdevctl-create.argv +++ b/tests/nodedevmdevctldata/mdevctl-create.argv @@ -1 +1,3 @@ -$MDEVCTL_BINARY$ start -u 8a05ad83-3472-497d-8631-8142f31460e8 +mdevctl \ +start \ +-u 8a05ad83-3472-497d-8631-8142f31460e8 diff --git a/tests/nodedevmdevctldata/mdevctl-list-defined.argv b/tests/nod= edevmdevctldata/mdevctl-list-defined.argv index 72b5906e9e..f6199681fa 100644 --- a/tests/nodedevmdevctldata/mdevctl-list-defined.argv +++ b/tests/nodedevmdevctldata/mdevctl-list-defined.argv @@ -1 +1,4 @@ -$MDEVCTL_BINARY$ list --dumpjson --defined +mdevctl \ +list \ +--dumpjson \ +--defined diff --git a/tests/nodedevmdevctldata/mdevctl-stop.argv b/tests/nodedevmdev= ctldata/mdevctl-stop.argv index 3dbaab671b..cc621191d6 100644 --- a/tests/nodedevmdevctldata/mdevctl-stop.argv +++ b/tests/nodedevmdevctldata/mdevctl-stop.argv @@ -1 +1,3 @@ -$MDEVCTL_BINARY$ stop -u e2451f73-c95b-4124-b900-e008af37c576 +mdevctl \ +stop \ +-u e2451f73-c95b-4124-b900-e008af37c576 diff --git a/tests/nodedevmdevctldata/mdevctl-undefine.argv b/tests/nodedev= mdevctldata/mdevctl-undefine.argv index 54717455f7..f1a59c5242 100644 --- a/tests/nodedevmdevctldata/mdevctl-undefine.argv +++ b/tests/nodedevmdevctldata/mdevctl-undefine.argv @@ -1 +1,3 @@ -$MDEVCTL_BINARY$ undefine -u d76a6b78-45ed-4149-a325-005f9abc5281 +mdevctl \ +undefine \ +-u d76a6b78-45ed-4149-a325-005f9abc5281 diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index 48d4f9e818..27bdc67928 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -40,21 +40,6 @@ testCommandDryRunCallback(const char *const*args G_GNUC_= UNUSED, *stdinbuf =3D g_strdup(input); } -/* We don't want the result of the test to depend on the path to the mdevc= tl - * binary on the developer's machine, so replace the path to mdevctl with a - * placeholder string before comparing to the expected output */ -static int -nodedevCompareToFile(const char *actual, - const char *filename) -{ - g_autofree char *replacedCmdline =3D NULL; - - replacedCmdline =3D virStringReplace(actual, MDEVCTL, "$MDEVCTL_BINARY= $"); - - return virTestCompareToFile(replacedCmdline, filename); -} - - typedef virCommand* (*MdevctlCmdFunc)(virNodeDeviceDef *, char **, char **= ); @@ -87,14 +72,14 @@ testMdevctlStartOrDefine(const char *virt_type, if (!cmd) goto cleanup; - virCommandSetDryRun(dryRunToken, &buf, false, false, testCommandDryRun= Callback, &stdinbuf); + virCommandSetDryRun(dryRunToken, &buf, true, true, testCommandDryRunCa= llback, &stdinbuf); if (virCommandRun(cmd, NULL) < 0) goto cleanup; if (!(actualCmdline =3D virBufferCurrentContent(&buf))) goto cleanup; - if (nodedevCompareToFile(actualCmdline, cmdfile) < 0) + if (virTestCompareToFileFull(actualCmdline, cmdfile, false) < 0) goto cleanup; if (virTestCompareToFile(stdinbuf, jsonfile) < 0) @@ -159,14 +144,14 @@ testMdevctlUuidCommand(const char *uuid, GetStopUndef= ineCmdFunc func, const char if (!cmd) goto cleanup; - virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL); + virCommandSetDryRun(dryRunToken, &buf, true, true, NULL, NULL); if (virCommandRun(cmd, NULL) < 0) goto cleanup; if (!(actualCmdline =3D virBufferCurrentContent(&buf))) goto cleanup; - if (nodedevCompareToFile(actualCmdline, outfile) < 0) + if (virTestCompareToFileFull(actualCmdline, outfile, false) < 0) goto cleanup; ret =3D 0; @@ -221,14 +206,14 @@ testMdevctlListDefined(const void *data G_GNUC_UNUSED) if (!cmd) goto cleanup; - virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL); + virCommandSetDryRun(dryRunToken, &buf, true, true, NULL, NULL); if (virCommandRun(cmd, NULL) < 0) goto cleanup; if (!(actualCmdline =3D virBufferCurrentContent(&buf))) goto cleanup; - if (nodedevCompareToFile(actualCmdline, cmdlinefile) < 0) + if (virTestCompareToFileFull(actualCmdline, cmdlinefile, false) < 0) goto cleanup; ret =3D 0; @@ -270,7 +255,7 @@ testMdevctlParse(const void *data) virBufferAddStr(&xmloutbuf, devxml); } - if (nodedevCompareToFile(virBufferCurrentContent(&xmloutbuf), xmloutfi= le) < 0) + if (virTestCompareToFileFull(virBufferCurrentContent(&xmloutbuf), xmlo= utfile, false) < 0) goto cleanup; ret =3D 0; --=20 2.30.2