From: Kris Van Hees <kris.van.hees@oracle.com>
To: Nick Alcock <nick.alcock@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH 3/4] test: enum tests
Date: Thu, 2 Oct 2025 20:00:54 -0400 [thread overview]
Message-ID: <aN8SNhatY/SesHvE@oracle.com> (raw)
In-Reply-To: <20250918180338.197827-3-nick.alcock@oracle.com>
On Thu, Sep 18, 2025 at 07:03:37PM +0100, Nick Alcock wrote:
> A couple of new tests verifying that type names appearing in enums are
> forbidden, as well as that kernel-visible identifiers are permitted;
> and a renaming of the D_UNKNOWN tests now that libctf can be assumed
> to be everywhere and it's probably more common to have a libctf that
> emits a good description of this failure than the converse.
>
> (The previous commit changes the error messages in this case back to
> what they used to be in the old days, too.)
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> ...iers.d => err.D_DECL_IDRED.RepeatIdentifiers.d} | 0
> .../enum/err.D_DECL_IDRED.RepeatIdentifiers.r | 2 ++
> ....r.p => err.D_DECL_IDRED.RepeatIdentifiers.r.p} | 0
> ...dentifiers.d => err.D_SYNTAX.RepeatTypeNames.d} | 12 +++---------
> .../enum/err.D_UNKNOWN.RepeatIdentifiers.r | 2 --
> ...OWN.RepeatIdentifiers.d => tst.EnumKernelDup.d} | 14 ++++++--------
> test/unittest/enum/tst.EnumKernelDup.r | 1 +
> ...NKNOWN.dupenum.d => err.D_DECL_IDRED.dupenum.d} | 0
> test/unittest/types/err.D_DECL_IDRED.dupenum.r | 2 ++
> ...WN.dupenum.r.p => err.D_DECL_IDRED.dupenum.r.p} | 0
> test/unittest/types/err.D_UNKNOWN.dupenum.r | 2 --
> 11 files changed, 14 insertions(+), 21 deletions(-)
> copy test/unittest/enum/{err.D_UNKNOWN.RepeatIdentifiers.d => err.D_DECL_IDRED.RepeatIdentifiers.d} (100%)
> create mode 100644 test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r
> rename test/unittest/enum/{err.D_UNKNOWN.RepeatIdentifiers.r.p => err.D_DECL_IDRED.RepeatIdentifiers.r.p} (100%)
> copy test/unittest/enum/{err.D_UNKNOWN.RepeatIdentifiers.d => err.D_SYNTAX.RepeatTypeNames.d} (72%)
> delete mode 100644 test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.r
> rename test/unittest/enum/{err.D_UNKNOWN.RepeatIdentifiers.d => tst.EnumKernelDup.d} (57%)
> create mode 100644 test/unittest/enum/tst.EnumKernelDup.r
> rename test/unittest/types/{err.D_UNKNOWN.dupenum.d => err.D_DECL_IDRED.dupenum.d} (100%)
> create mode 100644 test/unittest/types/err.D_DECL_IDRED.dupenum.r
> rename test/unittest/types/{err.D_UNKNOWN.dupenum.r.p => err.D_DECL_IDRED.dupenum.r.p} (100%)
> delete mode 100644 test/unittest/types/err.D_UNKNOWN.dupenum.r
>
> diff --git a/test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.d b/test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.d
> similarity index 100%
> copy from test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.d
> copy to test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.d
> diff --git a/test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r b/test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r
> new file mode 100644
> index 0000000000000..424d6b0775810
> --- /dev/null
> +++ b/test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r
> @@ -0,0 +1,2 @@
> +-- @@stderr --
> +dtrace: failed to compile script test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.d: [D_DECL_IDRED] line 24: identifier redeclared: GREEN
> diff --git a/test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.r.p b/test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r.p
> similarity index 100%
> rename from test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.r.p
> rename to test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r.p
> diff --git a/test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.d b/test/unittest/enum/err.D_SYNTAX.RepeatTypeNames.d
> similarity index 72%
> copy from test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.d
> copy to test/unittest/enum/err.D_SYNTAX.RepeatTypeNames.d
> index 43837c78af9f2..74afdebf98082 100644
> --- a/test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.d
> +++ b/test/unittest/enum/err.D_SYNTAX.RepeatTypeNames.d
> @@ -7,22 +7,16 @@
>
> /*
> * ASSERTION:
> - * Repeating the same identifier in the same enumeration will throw a compiler
> - * error.
> + * Enumerations cannot have the same names as already-existing types.
> *
> * SECTION: Type and Constant Definitions/Enumerations
> - *
> - * NOTES:
> - *
> */
>
> #pragma D option quiet
>
> enum colors {
> - RED,
> - GREEN,
> - GREEN = 2,
> - BLUE
> + int,
> + not_int
> };
>
> BEGIN
> diff --git a/test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.r b/test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.r
> deleted file mode 100644
> index 0bf0acdb0702b..0000000000000
> --- a/test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.r
> +++ /dev/null
> @@ -1,2 +0,0 @@
> --- @@stderr --
> -dtrace: failed to compile script test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.d: [D_UNKNOWN] line 24: failed to define enumerator 'GREEN': Duplicate member or variable name
> diff --git a/test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.d b/test/unittest/enum/tst.EnumKernelDup.d
> similarity index 57%
> rename from test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.d
> rename to test/unittest/enum/tst.EnumKernelDup.d
> index 43837c78af9f2..429e2d0a01f66 100644
> --- a/test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.d
> +++ b/test/unittest/enum/tst.EnumKernelDup.d
> @@ -1,14 +1,14 @@
> /*
> * Oracle Linux DTrace.
> - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2006, 2020, 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.
> */
>
> /*
> * ASSERTION:
> - * Repeating the same identifier in the same enumeration will throw a compiler
> - * error.
> + * Enumerations using names also used for enumerators in the kernel should not
> + * raise errors.
> *
> * SECTION: Type and Constant Definitions/Enumerations
> *
> @@ -18,11 +18,9 @@
>
> #pragma D option quiet
>
> -enum colors {
> - RED,
> - GREEN,
> - GREEN = 2,
> - BLUE
> +enum dirs {
> + UP,
> + DOWN
> };
>
> BEGIN
> diff --git a/test/unittest/enum/tst.EnumKernelDup.r b/test/unittest/enum/tst.EnumKernelDup.r
> new file mode 100644
> index 0000000000000..8b137891791fe
> --- /dev/null
> +++ b/test/unittest/enum/tst.EnumKernelDup.r
> @@ -0,0 +1 @@
> +
> diff --git a/test/unittest/types/err.D_UNKNOWN.dupenum.d b/test/unittest/types/err.D_DECL_IDRED.dupenum.d
> similarity index 100%
> rename from test/unittest/types/err.D_UNKNOWN.dupenum.d
> rename to test/unittest/types/err.D_DECL_IDRED.dupenum.d
> diff --git a/test/unittest/types/err.D_DECL_IDRED.dupenum.r b/test/unittest/types/err.D_DECL_IDRED.dupenum.r
> new file mode 100644
> index 0000000000000..0b6369e523cb2
> --- /dev/null
> +++ b/test/unittest/types/err.D_DECL_IDRED.dupenum.r
> @@ -0,0 +1,2 @@
> +-- @@stderr --
> +dtrace: failed to compile script test/unittest/types/err.D_DECL_IDRED.dupenum.d: [D_DECL_IDRED] line 18: identifier redeclared: x
> diff --git a/test/unittest/types/err.D_UNKNOWN.dupenum.r.p b/test/unittest/types/err.D_DECL_IDRED.dupenum.r.p
> similarity index 100%
> rename from test/unittest/types/err.D_UNKNOWN.dupenum.r.p
> rename to test/unittest/types/err.D_DECL_IDRED.dupenum.r.p
> diff --git a/test/unittest/types/err.D_UNKNOWN.dupenum.r b/test/unittest/types/err.D_UNKNOWN.dupenum.r
> deleted file mode 100644
> index 2d6aa3069b94d..0000000000000
> --- a/test/unittest/types/err.D_UNKNOWN.dupenum.r
> +++ /dev/null
> @@ -1,2 +0,0 @@
> --- @@stderr --
> -dtrace: failed to compile script test/unittest/types/err.D_UNKNOWN.dupenum.d: [D_UNKNOWN] line 18: failed to define enumerator 'x': Duplicate member or variable name
> --
> 2.48.1.283.g18c60a128c
>
next prev parent reply other threads:[~2025-10-03 0:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 18:03 [PATCH 1/4] parser: fix parser debugging yet again Nick Alcock
2025-09-18 18:03 ` [PATCH 2/4] lexer: the things inside an enum { ... } declaration are identifiers Nick Alcock
2025-10-03 0:00 ` [DTrace-devel] " Kris Van Hees
2025-09-18 18:03 ` [PATCH 3/4] test: enum tests Nick Alcock
2025-10-03 0:00 ` Kris Van Hees [this message]
2025-09-18 18:03 ` [PATCH 4/4] test: fix test failure when no /usr/sbin/dtrace exists Nick Alcock
2025-09-18 19:18 ` Eugene Loh
2025-09-23 15:15 ` Nick Alcock
2025-09-23 15:31 ` [PATCH v2 " Nick Alcock
2025-10-03 0:01 ` [DTrace-devel] [PATCH " Kris Van Hees
2025-10-03 0:00 ` [PATCH 1/4] parser: fix parser debugging yet again 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=aN8SNhatY/SesHvE@oracle.com \
--to=kris.van.hees@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
--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 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.