From nobody Mon Feb 9 12:09:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1629296280163986.4810201989721; Wed, 18 Aug 2021 07:18:00 -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-473-AmKqAQm4PaiZcS9V7BT-aA-1; Wed, 18 Aug 2021 10:17:57 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B9D4C100A606; Wed, 18 Aug 2021 14:17:50 +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 7D0FD369A; Wed, 18 Aug 2021 14:17:50 +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 178964BB7C; Wed, 18 Aug 2021 14:17:50 +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 17IEHm8Y008885 for ; Wed, 18 Aug 2021 10:17:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id D875A21EE573; Wed, 18 Aug 2021 14:17:48 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D0F362166B25 for ; Wed, 18 Aug 2021 14:17:48 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 B215E85828D for ; Wed, 18 Aug 2021 14:17:48 +0000 (UTC) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-573-KounW4xdN7yNzXpLDJkU6A-1; Wed, 18 Aug 2021 10:17:46 -0400 Received: by mail-pj1-f48.google.com with SMTP id nt11so2719555pjb.2 for ; Wed, 18 Aug 2021 07:17:46 -0700 (PDT) Received: from localhost ([38.94.109.214]) by smtp.gmail.com with ESMTPSA id k197sm6954419pfd.190.2021.08.18.07.17.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 07:17:44 -0700 (PDT) X-MC-Unique: AmKqAQm4PaiZcS9V7BT-aA-1 X-MC-Unique: KounW4xdN7yNzXpLDJkU6A-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:in-reply-to :references:mime-version:content-transfer-encoding; bh=CtoAt0SRO05d/IWEDtAQbdV6UM8j3+pFH+F2EhdABbU=; b=FSXVMH7ZHsv9u+G0WkJnTVZld4B3xQWVB6nE+C294hN58UN4dd7LzuzRzwaiVAv3zQ 3jgsyzymtJ2nJA50sPq3bhiI1BGV2GDchMZMYxPyT6N7/xcX36QZJ+QCt2ccfcMhdJjp sQ3TWd+OAsP5r2hMoR+tSnf0rXBXSHfbDJYEv2+gjyDv2sbeDg+e95W+d12eUKEOVh4+ uCvVafqmoP4wiAEHMHqCjEd/ihKJ16T8zFj1ZgPBcvZzwPZ1IguSlO9tNg6Nn44Cbkdb EobM3jbnzQhHIPPNSrusRhXHEjFjBveldbqA1drix6SsT/D86Li2NQ/rQav+pv56cYJ5 jgrA== X-Gm-Message-State: AOAM5332x2QQfYD5O18/EkkNF1NX1C4na1SpA8+xh6LslUJ3nCJGsLts /VnORSpSC8TNfMvRdPPA46MY0ACcz3xI0Apuvps= X-Google-Smtp-Source: ABdhPJyRjafn63Iw/PfUcCFVBvNbylB5PBMy9kEIiSTsjL80JoYotWLUIoYVF24t1TqrSyXRZlAWKA== X-Received: by 2002:a17:90a:2802:: with SMTP id e2mr9776164pjd.215.1629296265351; Wed, 18 Aug 2021 07:17:45 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v3 4/5] test_driver: Introduce testDomainSetDummyData Date: Wed, 18 Aug 2021 22:17:28 +0800 Message-Id: <20210818141729.191578-5-lukedyue@gmail.com> In-Reply-To: <20210818141729.191578-1-lukedyue@gmail.com> References: <20210818141729.191578-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.11 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-ZM-MESSAGEID: 1629296281083100003 Content-Type: text/plain; charset="utf-8" We can't adjust all info of a domain in XML and it's hard to adjust some with current API coverage, so use this function to set some dummy data to specific domains, thus we can get different results in virsh tests. Currently, only domain fc5's priv->jobState and priv->jobOperation are being changed, in order to test virDomainGetJobInfo and virDomainGetJobStats (domjobinfo in virsh). Signed-off-by: Luke Yue --- src/test/test_driver.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 35350edda9..372de8ba53 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -663,6 +663,32 @@ testDomObjFromDomain(virDomainPtr domain) return vm; } =20 +/** + * We can't adjust all info of a domain in XML and it's hard to + * adjust some with current API coverage, so use this function to + * set some dummy data to specific domains, thus we can get different + * results in virshtest. + */ +static int +testDomainSetDummyData(virDomainObj *obj) +{ + virDomainDef *def; + testDomainObjPrivate *priv; + + priv =3D obj->privateData; + + if (!(def =3D virDomainObjGetOneDef(obj, VIR_DOMAIN_AFFECT_LIVE))) + return -1; + + if (STREQ(def->name, "fc5")) { + /* For testing domjobinfo */ + priv->jobState =3D VIR_DOMAIN_JOB_BOUNDED; + priv->jobOperation =3D VIR_DOMAIN_JOB_OPERATION_BACKUP; + } + + return 0; +} + static char * testDomainGenerateIfname(virDomainDef *domdef) { @@ -1055,6 +1081,9 @@ testParseDomains(testDriver *privconn, =20 testDomainObjCheckTaint(obj); =20 + if (testDomainSetDummyData(obj) < 0) + VIR_DEBUG("Failed to set dummy data"); + virDomainObjEndAPI(&obj); } =20 --=20 2.32.0