From nobody Mon Feb 9 04:29:58 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; 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 1631719988551137.45404075383692; Wed, 15 Sep 2021 08:33:08 -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-154-4QQK_nWtNE2s0dCGW_ZR4A-1; Wed, 15 Sep 2021 11:33:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5011EA40C0; Wed, 15 Sep 2021 15:32:55 +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 75ACE6B555; Wed, 15 Sep 2021 15:32:52 +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 430714EA3E; Wed, 15 Sep 2021 15:32:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18FFVNgj029031 for ; Wed, 15 Sep 2021 11:31:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4F6BE208747C; Wed, 15 Sep 2021 15:31:23 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B6B5208747B for ; Wed, 15 Sep 2021 15:31:23 +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 3103C91C7C7 for ; Wed, 15 Sep 2021 15:31:23 +0000 (UTC) Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-51-36GJQDwAMOemvRhnvxYqsA-1; Wed, 15 Sep 2021 11:31:20 -0400 Received: by mail-pg1-f173.google.com with SMTP id k24so3073003pgh.8 for ; Wed, 15 Sep 2021 08:31:20 -0700 (PDT) Received: from localhost ([103.149.249.103]) by smtp.gmail.com with ESMTPSA id z14sm313121pfr.154.2021.09.15.08.31.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 08:31:18 -0700 (PDT) X-MC-Unique: 4QQK_nWtNE2s0dCGW_ZR4A-1 X-MC-Unique: 36GJQDwAMOemvRhnvxYqsA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NhvD24HWrza6PS/mB19gwNFD7aH4uD6Y5zCd7wbx83I=; b=Zu5hTv0vqNq0CMrYxOYJK/78Y1OVNMcxNhBsoxT176QneMJamSHjh2ouZFs3ui1cW2 GOmnGyyejadorIcrOFkEx209AWpVFesUd4wj7eYD5ktzs6eeI7yrMKC+Ue5OsZvkO8cn 7xQtakhxCJO4wyy9Z5m3TQGmsLJBUH/d4EhfEoOYHUkHFbbu2sMtpKdvpsrnP5M8QIqW NddX4r9ucLocCWXIgcjJHT2bKD6qsDOs9JL24RlQaOk6/K43GVk1uYB7OY51iJP83fbm aq7PP6VIlFRKo8Yw/ERNwUTww6ddM4mXbZhH9M+u0lRUSHlBc9nynuA9h/FNG+EODsTW 9xNQ== X-Gm-Message-State: AOAM5317jysy4O2RRsvfkt5J3BhMcqdf0HLdTvbsv7avHP09yEcmoeHY RNhuFzB5ruJegEzdVcHvShSeejpq9nRcwh06 X-Google-Smtp-Source: ABdhPJzmzc1HkFeiVwwwodMXK6Ns+1ZjehWw/2CfxaGfNvWvStDBqDc2uxZNo5QnS1B6Ahoiy3dkeA== X-Received: by 2002:a62:8801:0:b0:43e:390:295f with SMTP id l1-20020a628801000000b0043e0390295fmr63811pfd.57.1631719879062; Wed, 15 Sep 2021 08:31:19 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v4 11/11] tests: Test IOThread related functions for test driver Date: Wed, 15 Sep 2021 23:30:32 +0800 Message-Id: <20210915153032.121221-12-lukedyue@gmail.com> In-Reply-To: <20210915153032.121221-1-lukedyue@gmail.com> References: <20210915153032.121221-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.4 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.15 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: 1631719989470100001 Content-Type: text/plain; charset="utf-8" testIOThreadAdd tests iothreadinfo and iothreadadd testIOThreadDel tests iothreadinfo and iothreaddel testIOThreadSet tests domstats and iothreadset testIOThreadPin tests iothreadadd, iothreadinfo and iothreadpin Above tests should cover the IOThreads related APIs for test driver Signed-off-by: Luke Yue --- tests/virshtest.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/tests/virshtest.c b/tests/virshtest.c index 87da1f5889..c2c892c60d 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -32,6 +32,7 @@ main(void) deprecated configuration: CPU model Deprecated-Test" # define GET_BLKIO_PARAMETER "/dev/hda,700" # define SET_BLKIO_PARAMETER "/dev/hda,1000" +# define EQUAL "=3D" =20 static const char *dominfo_fc4 =3D "\ Id: 2\n\ @@ -338,6 +339,99 @@ static int testCompareSetBlkioParameters(const void *d= ata G_GNUC_UNUSED) return testCompareOutputLit(exp, NULL, argv); } =20 +static int testIOThreadAdd(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "iothreadinfo --domain fc= 4;\ + iothreadadd --domain fc4 --id 6;\ + iothreadinfo --domain fc4", NULL}; + const char *exp =3D "\ + IOThread ID CPU Affinity\n\ +-----------------------------\n\ + 2 0\n\ + 4 0\n\ +\n\ +\n\ + IOThread ID CPU Affinity\n\ +-----------------------------\n\ + 2 0\n\ + 4 0\n\ + 6 0\n\ +\n"; + return testCompareOutputLit(exp, NULL, argv); +} + +static int testIOThreadDel(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "iothreadinfo --domain fc= 4;\ + iothreaddel --domain fc4 --id 2;\ + iothreadinfo --domain fc4", NULL}; + const char *exp =3D "\ + IOThread ID CPU Affinity\n\ +-----------------------------\n\ + 2 0\n\ + 4 0\n\ +\n\ +\n\ + IOThread ID CPU Affinity\n\ +-----------------------------\n\ + 4 0\n\ +\n"; + return testCompareOutputLit(exp, NULL, argv); +} + +static int testIOThreadSet(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "domstats --domain fc4;\ + iothreadset --domain fc4\ + --id 2 --poll-max-ns 100\ + --poll-shrink 10 --poll-grow 10;\ + domstats --domain fc4", NULL}; + const char *exp =3D "\ +Domain: 'fc4'\n\ + state.state" EQUAL "1\n\ + state.reason" EQUAL "0\n\ + iothread.count" EQUAL "2\n\ + iothread.2.poll-max-ns" EQUAL "32768\n\ + iothread.2.poll-grow" EQUAL "0\n\ + iothread.2.poll-shrink" EQUAL "0\n\ + iothread.4.poll-max-ns" EQUAL "32768\n\ + iothread.4.poll-grow" EQUAL "0\n\ + iothread.4.poll-shrink" EQUAL "0\n\n\ +\n\ +Domain: 'fc4'\n\ + state.state" EQUAL "1\n\ + state.reason" EQUAL "0\n\ + iothread.count" EQUAL "2\n\ + iothread.2.poll-max-ns" EQUAL "100\n\ + iothread.2.poll-grow" EQUAL "10\n\ + iothread.2.poll-shrink" EQUAL "10\n\ + iothread.4.poll-max-ns" EQUAL "32768\n\ + iothread.4.poll-grow" EQUAL "0\n\ + iothread.4.poll-shrink" EQUAL "0\n\n"; + return testCompareOutputLit(exp, NULL, argv); +} + +static int testIOThreadPin(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, + "iothreadadd --domain fc5 --id 2;\ + iothreadinfo --domain fc5;\ + iothreadpin --domain fc5 --iothread 2\ + --cpulist 0;\ + iothreadinfo --domain fc5", NULL}; + const char *exp =3D "\n\ + IOThread ID CPU Affinity\n\ +-----------------------------\n\ + 2 0-3\n\ +\n\ +\n\ + IOThread ID CPU Affinity\n\ +-----------------------------\n\ + 2 0\n\ +\n"; + return testCompareOutputLit(exp, NULL, argv); +} + struct testInfo { const char *const *argv; const char *result; @@ -438,6 +532,22 @@ mymain(void) testCompareSetBlkioParameters, NULL) !=3D 0) ret =3D -1; =20 + if (virTestRun("virsh iothreadadd", + testIOThreadAdd, NULL) !=3D 0) + ret =3D -1; + + if (virTestRun("virsh iothreaddel", + testIOThreadDel, NULL) !=3D 0) + ret =3D -1; + + if (virTestRun("virsh iothreadset", + testIOThreadSet, NULL) !=3D 0) + ret =3D -1; + + if (virTestRun("virsh iothreadpin", + testIOThreadPin, NULL) !=3D 0) + ret =3D -1; + /* It's a bit awkward listing result before argument, but that's a * limitation of C99 vararg macros. */ # define DO_TEST(i, result, ...) \ --=20 2.33.0