Linux DTrace development list
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com,
	Nick Alcock <nick.alcock@oracle.com>,
	Eugene Loh <eugene.loh@oracle.com>
Subject: Re: [PATCH v5 2/2] unittest/print: add test covering module-defined type
Date: Fri, 2 Aug 2024 01:20:30 -0400	[thread overview]
Message-ID: <ZqxsnjFKPwD3d1hb@oracle.com> (raw)
In-Reply-To: <20240801212912.2300220-2-alan.maguire@oracle.com>

On Thu, Aug 01, 2024 at 10:29:12PM +0100, Alan Maguire wrote:
> print() action tests do not cover module-defined types.  Add a test
> using a module-defined type that has not changed recently.
> 
> struct tun_page was chosen since it is identical in UEK6U3 and upstream
> and declared in tun.c which is a module on most distros.
> 
> Added tun to test/modules as suggested by Eugene.
> 
> Suggested-by: Nick Alcock <nick.alcock@oracle.com>
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>

> ---
>  test/modules                            |  1 +
>  test/unittest/print/tst.print.modtype.d | 18 ++++++++++++++++++
>  test/unittest/print/tst.print.modtype.r |  6 ++++++
>  3 files changed, 25 insertions(+)
>  create mode 100644 test/unittest/print/tst.print.modtype.d
>  create mode 100644 test/unittest/print/tst.print.modtype.r
> 
> diff --git a/test/modules b/test/modules
> index 53dc5544..0f01d6e0 100644
> --- a/test/modules
> +++ b/test/modules
> @@ -2,3 +2,4 @@ ext4
>  isofs
>  nfs
>  rds
> +tun
> diff --git a/test/unittest/print/tst.print.modtype.d b/test/unittest/print/tst.print.modtype.d
> new file mode 100644
> index 00000000..ed68b492
> --- /dev/null
> +++ b/test/unittest/print/tst.print.modtype.d
> @@ -0,0 +1,18 @@
> +/*
> + * Oracle Linux DTrace.
> + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
> + * Licensed under the Universal Permissive License v 1.0 as shown at
> + * http://oss.oracle.com/licenses/upl.
> + */
> +/* @@nosort */
> +
> +#pragma D option quiet
> +
> +BEGIN
> +{
> +	tun_page = (struct tun_page *)alloca(sizeof (struct tun_page));
> +	tun_page->page = (struct page *)0xfeedfacefeedface;
> +	tun_page->count = 123;
> +	print(tun_page);
> +	exit(0);
> +}
> diff --git a/test/unittest/print/tst.print.modtype.r b/test/unittest/print/tst.print.modtype.r
> new file mode 100644
> index 00000000..b9736607
> --- /dev/null
> +++ b/test/unittest/print/tst.print.modtype.r
> @@ -0,0 +1,6 @@
> +{ptr} = *
> +                                            (struct tun_page) {
> +                                             .page = (struct page *){ptr},
> +                                             .count = (int)123,
> +                                            }
> +
> -- 
> 2.43.5
> 

  reply	other threads:[~2024-08-02  5:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 21:29 [PATCH v5 1/2] print() action: identify ctf object used for print Alan Maguire
2024-08-01 21:29 ` [PATCH v5 2/2] unittest/print: add test covering module-defined type Alan Maguire
2024-08-02  5:20   ` Kris Van Hees [this message]
2024-08-02  5:20 ` [PATCH v5 1/2] print() action: identify ctf object used for print Kris Van Hees

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=ZqxsnjFKPwD3d1hb@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=alan.maguire@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=eugene.loh@oracle.com \
    --cc=nick.alcock@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox