From nobody Sat May 4 05:20:25 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 1623676421435206.2984874865374; Mon, 14 Jun 2021 06:13:41 -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-318-RILNfK3DMpGxcFyjdQILnw-1; Mon, 14 Jun 2021 09:13:38 -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 1362F8005A2; Mon, 14 Jun 2021 13:13:34 +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 E170861093; Mon, 14 Jun 2021 13:13:33 +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 8EC1D46F82; Mon, 14 Jun 2021 13:13:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15EDDVf1030137 for ; Mon, 14 Jun 2021 09:13:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id CD0122157427; Mon, 14 Jun 2021 13:13:31 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C91522157424 for ; Mon, 14 Jun 2021 13:13:29 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 62534811E9C for ; Mon, 14 Jun 2021 13:13:29 +0000 (UTC) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-182-kED1jrI-Ml-qIjhPuPtw5g-1; Mon, 14 Jun 2021 09:13:27 -0400 Received: by mail-pl1-f169.google.com with SMTP id h12so6529275plf.4 for ; Mon, 14 Jun 2021 06:13:27 -0700 (PDT) Received: from localhost ([103.142.141.217]) by smtp.gmail.com with ESMTPSA id 1sm18136976pjm.8.2021.06.14.06.13.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 06:13:25 -0700 (PDT) X-MC-Unique: RILNfK3DMpGxcFyjdQILnw-1 X-MC-Unique: kED1jrI-Ml-qIjhPuPtw5g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=IDqINEDS58b2zN8lJaGY2xbeos+1sDPE7tLgeFq9RPw=; b=Cr6BvkCWnxGlg/wd8gglXnK8b9bLjUoxqO/otczEhKEDhhkcE8HwMiOyV2Nudtrkjc EPQr0U0wpel/Q9ssfC/XHdJ1NLW0VK8I4P+buNICFYz93DsO5Pw1ZnmkCrX41JwnV3fA 4QtlVQEMUz39qtZ3OP3CbMYjLTqd0xDQ9Xmzx/Lnip++7FOvBcGeJT/40CDIFQaeDTxF AGiz7PLaLHWj2llS2v+SpNQLMJCPUy4vCaE+8AImS1a4W414Ed4BXzvvY4GVuuNZ8B0u GJZRaBGxcLx6UefAfsLpIH2pxGLadIQILivPf7qZQMOYzoi7U/YM8CG+oPKTidSJKf/Z HCaA== X-Gm-Message-State: AOAM532xajL3EFqKuxsNnulek4EEoXQvcIk7bcrR0FtuR/lcR/uuqk56 /lz/SN7kfNUZSGt+Nwg81F1TfUBTHn2OCo54LzI= X-Google-Smtp-Source: ABdhPJySeyW9nJVqeilDi3uCRWFu6DuehDxpsHiHI91ZlFRwJDPxiXqZPCke6WU8aG26aIs1meOIbA== X-Received: by 2002:a17:902:860b:b029:103:b23b:f1c3 with SMTP id f11-20020a170902860bb0290103b23bf1c3mr16763492plo.34.1623676405943; Mon, 14 Jun 2021 06:13:25 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH] test_driver: Implement virDomainGetMessages Date: Mon, 14 Jun 2021 21:13:17 +0800 Message-Id: <20210614131317.32352-1-lukedyue@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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 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 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue --- src/test/test_driver.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index ae1b8ebc23..a7ea05464d 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -9331,6 +9331,58 @@ testDomainCheckpointDelete(virDomainCheckpointPtr ch= eckpoint, return ret; } =20 +static int +testDomainGetMessages(virDomainPtr dom, + char ***msgs, + unsigned int flags) +{ + virDomainObj *vm =3D NULL; + int rv =3D -1; + size_t i, n; + int nmsgs; + + virCheckFlags(VIR_DOMAIN_MESSAGE_DEPRECATION | + VIR_DOMAIN_MESSAGE_TAINTING, -1); + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + *msgs =3D NULL; + nmsgs =3D 0; + n =3D 0; + + if (!flags || (flags & VIR_DOMAIN_MESSAGE_TAINTING)) { + nmsgs +=3D __builtin_popcount(vm->taint); + *msgs =3D g_renew(char *, *msgs, nmsgs+1); + + for (i =3D 0; i < VIR_DOMAIN_TAINT_LAST; i++) { + if (vm->taint & (1 << i)) { + (*msgs)[n++] =3D g_strdup_printf( + _("tainted: %s"), + _(virDomainTaintMessageTypeToString(i))); + } + } + } + + if (!flags || (flags & VIR_DOMAIN_MESSAGE_DEPRECATION)) { + nmsgs +=3D vm->ndeprecations; + *msgs =3D g_renew(char *, *msgs, nmsgs+1); + + for (i =3D 0; i < vm->ndeprecations; i++) { + (*msgs)[n++] =3D g_strdup_printf( + _("deprecated configuration: %s"), + vm->deprecations[i]); + } + } + + (*msgs)[nmsgs] =3D NULL; + + rv =3D nmsgs; + + virDomainObjEndAPI(&vm); + return rv; +} + /* * Test driver */ @@ -9489,6 +9541,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainCheckpointLookupByName =3D testDomainCheckpointLookupByName, /*= 5.6.0 */ .domainCheckpointGetParent =3D testDomainCheckpointGetParent, /* 5.6.0= */ .domainCheckpointDelete =3D testDomainCheckpointDelete, /* 5.6.0 */ + .domainGetMessages =3D testDomainGetMessages, /* 7.5.0 */ }; =20 static virNetworkDriver testNetworkDriver =3D { --=20 2.32.0