From nobody Tue Feb 10 03:57:38 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 1628765839991171.9565686872512; Thu, 12 Aug 2021 03:57:19 -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-493-NlpXXarTOlacgJmgwhwryg-1; Thu, 12 Aug 2021 06:57:17 -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 242E71008065; Thu, 12 Aug 2021 10:57:12 +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 EE8C466FFF; Thu, 12 Aug 2021 10:57:11 +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 BCE46181A2A9; Thu, 12 Aug 2021 10:57:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17CAomtY015263 for ; Thu, 12 Aug 2021 06:50:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6ADDA117C2D4; Thu, 12 Aug 2021 10:50:48 +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 66542117C2D2 for ; Thu, 12 Aug 2021 10:50:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.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 074658CA953 for ; Thu, 12 Aug 2021 10:50:45 +0000 (UTC) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-589-pVLgJNg4ObyUOIsS5s4Kmw-1; Thu, 12 Aug 2021 06:50:42 -0400 Received: by mail-pl1-f176.google.com with SMTP id t3so6733983plg.9 for ; Thu, 12 Aug 2021 03:50:42 -0700 (PDT) Received: from localhost ([38.94.109.214]) by smtp.gmail.com with ESMTPSA id f9sm6007623pjq.36.2021.08.12.03.50.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 03:50:41 -0700 (PDT) X-MC-Unique: NlpXXarTOlacgJmgwhwryg-1 X-MC-Unique: pVLgJNg4ObyUOIsS5s4Kmw-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=A0CP4ZQJfl5xDKjaQZGAs0+7lkKbrZjthwsb5/TYpwE=; b=kYWlBljHxI3FBAQYJNJllpxAtO94uqXcBE9tVJydAMOEccwXvOkw+78XFOzasL4Nf1 IfvoROqko4D5kyV9nrIqtGhl/xtrahkWt4guc+56cCpkpj/cWVkJLFEDTxD08fuRWeZR sbpEhwZHQloLJ89Y7hcwNgdVSxKDhvg25sL3VF31YQwG7YDM9xg//BBr7cYITraSGoNi Vq/gFTA6thBwypbs8gWOnWRJNBlrBESuqAilTQI4p6nezX4jd8nJcZvu4DNT4AM0F2sC SsSEz0Lwzq2rXT3Qw85kZg/cp6+69h4ynY82H4mP511vnZ0/FIqazmDNDkayGvw5yOPd 7U+Q== X-Gm-Message-State: AOAM530E4Z2JcNYdY6fa/R36nOiCR4vWA8pB2x0uvxuhKjTCK6CEdlnI aeQHwgrW9uLO4CuJViQNJxXSQInTvitoc36hjIU= X-Google-Smtp-Source: ABdhPJxet5QwBzchQLJvZMUDiNt8FbzUHRjkHVneJ1IV8E/OjeQxmiNY0dbLT/dqIW/r8UbZJXTz6A== X-Received: by 2002:a17:90a:2c05:: with SMTP id m5mr3891624pjd.32.1628765441507; Thu, 12 Aug 2021 03:50:41 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v3 11/11] tests: Test IOThread related functions for test driver Date: Thu, 12 Aug 2021 18:50:02 +0800 Message-Id: <20210812105002.197134-12-lukedyue@gmail.com> In-Reply-To: <20210812105002.197134-1-lukedyue@gmail.com> References: <20210812105002.197134-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.3 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: 1628765840688100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue --- tests/virshtest.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/tests/virshtest.c b/tests/virshtest.c index 53db2aa19a..e2d6ddd72b 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -30,6 +30,7 @@ main(void) tainted: custom device tree blob used\n\ tainted: use of deprecated configuration settings\n\ deprecated configuration: CPU model Deprecated-Test" +# define EQUAL "=3D" =20 static const char *dominfo_fc4 =3D "\ Id: 2\n\ @@ -69,6 +70,17 @@ Security DOI: \n\ Security label: " SECURITY_LABEL "\n\ Messages: " FC5_MESSAGES "\n\ \n"; +static const char *domstats_fc4 =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"; =20 static int testFilterLine(char *buffer, const char *toRemove) @@ -291,6 +303,60 @@ static int testCompareDomControlInfoByName(const void = *data 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, "iothreadadd", "--domain", + "fc4", "--id", "1", NULL}; + const char *exp =3D "\n"; + return testCompareOutputLit(exp, NULL, argv); +} + +static int testIOThreadDel(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "iothreaddel", "--domain", + "fc4", "--id", "2", NULL}; + const char *exp =3D "\n"; + return testCompareOutputLit(exp, NULL, argv); +} + +static int testIOThreadInfo(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "iothreadinfo", "--domain= ", + "fc4", NULL}; + const char *exp =3D "\ + IOThread ID CPU Affinity\n\ +-----------------------------\n\ + 2 0\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, "iothreadset", "--domain= ", + "fc4", "--id", "2", "--poll-max-ns", "100= ", + "--poll-shrink", "10", "--poll-grow", + "10", NULL}; + const char *exp =3D "\n"; + return testCompareOutputLit(exp, NULL, argv); +} + +static int testIOThreadPin(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "iothreadpin", "fc4", + "--iothread", "2", "--cpulist", "0", NULL= }; + const char *exp =3D "\n"; + return testCompareOutputLit(exp, NULL, argv); +} + +static int testDomStats(const void *data G_GNUC_UNUSED) +{ + const char *const argv[] =3D { VIRSH_CUSTOM, "domstats", "fc4", NULL }; + const char *exp =3D domstats_fc4; + return testCompareOutputLit(exp, NULL, argv); +} + struct testInfo { const char *const *argv; const char *result; @@ -383,6 +449,30 @@ mymain(void) testCompareDomControlInfoByName, 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 iothreadinfo", + testIOThreadInfo, 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; + + if (virTestRun("virsh domstats (by name)", + testDomStats, 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.32.0