From nobody Tue Feb 10 01:59:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1591739062; cv=none; d=zohomail.com; s=zohoarc; b=eju0b1FXseRYzvKJqX+QjWV2/ITOgAIi+XbOqTyeqo2reSeSaTwKKb5XUQWVoZGesgohzkd+RJYCdkgH0hPQiw/QvTuGAi8ZtRJWb8pNHT6tAiG4cnGyuYTefP8N/ejOSYUxUpB2VsEn7y1kFeLagQLyO8hX+Ao7Fdczgw4zA5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591739062; 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=Lmo/CAPhHHPjnc9G2kGb/geS2zxx7eChy819ql1P6uM=; b=Pv74L+8VyNWyRJzX74O64mu0J0khDhxruuZVqXxvzmLLlGZUUOmujwiG2fPJoN8oXHVMA5zNVWF/yQGXvozGC9t9eOM1/VysdSHVV5Zm758unxUQ4fRRthgJgBaErzisGRLHk82gYWQVEOHDktr5Y5beWdmieqLkhliOeWK3vWk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 159173906279512.941167303785846; Tue, 9 Jun 2020 14:44:22 -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-44-BCS6Zk54MG6bWm4nl7t4Dw-1; Tue, 09 Jun 2020 17:44:19 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id C02341005510; Tue, 9 Jun 2020 21:44:13 +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 9DED860BF3; Tue, 9 Jun 2020 21:44:13 +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 6F520B34A1; Tue, 9 Jun 2020 21:44:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 059Lhu9x030122 for ; Tue, 9 Jun 2020 17:43:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 787697BFE9; Tue, 9 Jun 2020 21:43:56 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-115-112.phx2.redhat.com [10.3.115.112]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C3117BFE3 for ; Tue, 9 Jun 2020 21:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591739061; 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=Lmo/CAPhHHPjnc9G2kGb/geS2zxx7eChy819ql1P6uM=; b=OCeI/B8xJj8NEDZV4chmK9wJEKxXIrL1d7pyVsjsfnRqeakzgAfvD1GdkR6IGyaxcsSe5D mM317p1Zcmjggt8JAqouls5H/gPBs0H+0hVzICskps3yFw/10dnHgswqpUD9IP+fMUHvSR sX6moPKV3pYn0blimE9agNOOjLgjePE= X-MC-Unique: BCS6Zk54MG6bWm4nl7t4Dw-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v2 09/10] nodedev: Add testing for 'mdevctl stop' Date: Tue, 9 Jun 2020 16:43:49 -0500 Message-Id: <20200609214350.14156-10-jjongsma@redhat.com> In-Reply-To: <20200609214350.14156-1-jjongsma@redhat.com> References: <20200609214350.14156-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.79 on 10.5.11.12 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" Test that we run 'mdevctl' with the proper arguments when we destroy mediated devices with virNodeDeviceDestroy() Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctldata/mdevctl-stop.argv | 1 + tests/nodedevmdevctltest.c | 43 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/nodedevmdevctldata/mdevctl-stop.argv diff --git a/tests/nodedevmdevctldata/mdevctl-stop.argv b/tests/nodedevmdev= ctldata/mdevctl-stop.argv new file mode 100644 index 0000000000..25ee7145ce --- /dev/null +++ b/tests/nodedevmdevctldata/mdevctl-stop.argv @@ -0,0 +1 @@ +/usr/sbin/mdevctl stop -u e2451f73-c95b-4124-b900-e008af37c576 diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index 32a22246c2..58ebf976e2 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -98,6 +98,42 @@ testMdevctlStartHelper(const void *data) jsonfile); } =20 +static int +testMdevctlStopHelper(const void *data) +{ + const char *uuid =3D data; + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + const char *actualCmdline =3D NULL; + int ret =3D -1; + g_autoptr(virCommand) cmd =3D NULL; + + g_autofree char *cmdlinefile =3D + g_strdup_printf("%s/nodedevmdevctldata/mdevctl-stop.argv", + abs_srcdir); + + cmd =3D nodeDeviceGetMdevctlStopCommand(uuid, false); + + if (!cmd) + goto cleanup; + + virCommandSetDryRun(&buf, NULL, NULL); + if (virCommandRun(cmd, NULL) < 0) + goto cleanup; + + if (!(actualCmdline =3D virBufferCurrentContent(&buf))) + goto cleanup; + + if (virTestCompareToFile(actualCmdline, cmdlinefile) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virBufferFreeAndReset(&buf); + virCommandSetDryRun(NULL, NULL, NULL); + return ret; +} + static void nodedevTestDriverFree(virNodeDeviceDriverStatePtr drv) { @@ -248,6 +284,13 @@ mymain(void) DO_TEST("mdev_fedc4916_1ca8_49ac_b176_871d16c13076"); DO_TEST("mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9"); =20 + // Test mdevctl stop command, pass an arbitrary uuid + if (virTestRun("mdevctl stop", testMdevctlStopHelper, + "e2451f73-c95b-4124-b900-e008af37c576") < 0) + + + ret =3D -1; + done: nodedevTestDriverFree(driver); =20 --=20 2.21.3