All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Tao Xu <tao3.xu@intel.com>
Cc: lvivier@redhat.com, thuth@redhat.com, ehabkost@redhat.com,
	mst@redhat.com, jonathan.cameron@huawei.com, sw@weilnetz.de,
	fan.du@intel.com, mdroth@linux.vnet.ibm.com,
	qemu-devel@nongnu.org, jingqi.liu@intel.com, imammedo@redhat.com
Subject: Re: [PATCH v19 7/8] tests/numa: Add case for QMP build HMAT
Date: Thu, 28 Nov 2019 12:49:34 +0100	[thread overview]
Message-ID: <87pnhcnru9.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20191128082109.30081-8-tao3.xu@intel.com> (Tao Xu's message of "Thu, 28 Nov 2019 16:21:08 +0800")

Tao Xu <tao3.xu@intel.com> writes:

> Check configuring HMAT usecase
>
> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> Suggested-by: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Tao Xu <tao3.xu@intel.com>
> ---
>
> Changes in v19:
>     - Add some fail cases for hmat-cache when level=0
>
> Changes in v18:
>     - Rewrite the lines over 80 characters
>
> Chenges in v17:
>     - Add some fail test cases (Igor)
> ---
>  tests/numa-test.c | 213 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 213 insertions(+)
>
> diff --git a/tests/numa-test.c b/tests/numa-test.c
> index 8de8581231..aed7b2f31b 100644
> --- a/tests/numa-test.c
> +++ b/tests/numa-test.c
> @@ -327,6 +327,216 @@ static void pc_dynamic_cpu_cfg(const void *data)
>      qtest_quit(qs);
>  }
>  
> +static void pc_hmat_build_cfg(const void *data)
> +{
> +    QTestState *qs = qtest_initf("%s -nodefaults --preconfig -machine hmat=on "
> +                     "-smp 2,sockets=2 "
> +                     "-m 128M,slots=2,maxmem=1G "
> +                     "-object memory-backend-ram,size=64M,id=m0 "
> +                     "-object memory-backend-ram,size=64M,id=m1 "
> +                     "-numa node,nodeid=0,memdev=m0 "
> +                     "-numa node,nodeid=1,memdev=m1,initiator=0 "
> +                     "-numa cpu,node-id=0,socket-id=0 "
> +                     "-numa cpu,node-id=0,socket-id=1",
> +                     data ? (char *)data : "");
> +
> +    /* Fail: Initiator should be less than the number of nodes */
> +    g_assert(qmp_rsp_is_err(qtest_qmp(qs, "{ 'execute': 'set-numa-node',"
> +        " 'arguments': { 'type': 'hmat-lb', 'initiator': 2, 'target': 0,"
> +        " 'hierarchy': \"memory\", 'data-type': \"access-latency\" } }")));

Code smell: side effect within assert().

Harmless here, because compiling tests with NDEBUG is pointless.  Still,
it sets a bad example.  Not your idea, the pattern seems to go back to
commit c35665e1ee3 and fb1e58f72ba.

The non-smelly pattern would be

    resp = qtest_qmp(...);
    g_assert(resp);
    g_assert(qdict_haskey(rsp, "error"));
    qobject_unref(resp);

It's a bit longwinded.  We could create a suitable function, but then
the assertion points to the function, which is less useful than pointing
to the test.  A macro could avoid that.

Can be cleaned up on top.

[...]



  reply	other threads:[~2019-11-28 11:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28  8:21 [PATCH v19 0/8] Build ACPI Heterogeneous Memory Attribute Table (HMAT) Tao Xu
2019-11-28  8:21 ` [PATCH v19 1/8] numa: Extend CLI to provide initiator information for numa nodes Tao Xu
2019-11-28  8:21 ` [PATCH v19 2/8] numa: Extend CLI to provide memory latency and bandwidth information Tao Xu
2019-11-28 11:50   ` Markus Armbruster
2019-11-29  2:01     ` Tao Xu
2019-11-28  8:21 ` [PATCH v19 3/8] numa: Extend CLI to provide memory side cache information Tao Xu
2019-11-28 11:50   ` Markus Armbruster
2019-11-28 13:57     ` Igor Mammedov
2019-11-29  1:53       ` Tao Xu
2019-11-29  2:05     ` Tao Xu
2019-11-28  8:21 ` [PATCH v19 4/8] hmat acpi: Build Memory Proximity Domain Attributes Structure(s) Tao Xu
2019-11-28  8:21 ` [PATCH v19 5/8] hmat acpi: Build System Locality Latency and Bandwidth Information Structure(s) Tao Xu
2019-11-28  8:21 ` [PATCH v19 6/8] hmat acpi: Build Memory Side Cache " Tao Xu
2019-11-28  8:21 ` [PATCH v19 7/8] tests/numa: Add case for QMP build HMAT Tao Xu
2019-11-28 11:49   ` Markus Armbruster [this message]
2019-11-28 11:53     ` Thomas Huth
2019-11-29  3:17       ` Tao Xu
2019-11-28  8:21 ` [PATCH v19 8/8] tests/bios-tables-test: add test cases for ACPI HMAT Tao Xu
2019-11-28 11:54 ` [PATCH v19 0/8] Build ACPI Heterogeneous Memory Attribute Table (HMAT) Markus Armbruster
2019-11-29  1:43 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pnhcnru9.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=fan.du@intel.com \
    --cc=imammedo@redhat.com \
    --cc=jingqi.liu@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=lvivier@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    --cc=tao3.xu@intel.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.