public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH] test: Account for variations in error messages
Date: Tue,  7 Oct 2025 18:39:50 -0400	[thread overview]
Message-ID: <20251007223950.31241-1-eugene.loh@oracle.com> (raw)

From: Eugene Loh <eugene.loh@oracle.com>

Clearly,
    test/unittest/enum/err.*RepeatIdentifiers.d
    test/unittest/types/err.*dupenum.d
are impacted, but so are
    test/unittest/offsetof/err.D_UNKNOWN.OffsetofNULL.d
    test/unittest/types/err.D_UNKNOWN.dupstruct.d
    test/unittest/union/err.D_DECL_INCOMPLETE.circular.d
    test/unittest/union/err.D_DECL_INCOMPLETE.order.d
    test/unittest/union/err.D_DECL_INCOMPLETE.simple.d
due to symlinks to libctf.r.p.  And dupstruct needed a fix.

Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
 .../enum/err.D_DECL_IDRED.RepeatIdentifiers.r |  2 --
 ...tIdentifiers.d => err.RepeatIdentifiers.d} |  7 +++----
 test/unittest/enum/err.RepeatIdentifiers.r    |  2 ++
 ...ntifiers.r.p => err.RepeatIdentifiers.r.p} |  0
 .../unittest/types/err.D_DECL_IDRED.dupenum.r |  2 --
 ...r.D_DECL_IDRED.dupenum.d => err.dupenum.d} |  4 +++-
 test/unittest/types/err.dupenum.r             |  2 ++
 ...DECL_IDRED.dupenum.r.p => err.dupenum.r.p} |  0
 test/utils/libctf.r.p                         | 19 +++++++++++++++++++
 9 files changed, 29 insertions(+), 9 deletions(-)
 delete mode 100644 test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r
 rename test/unittest/enum/{err.D_DECL_IDRED.RepeatIdentifiers.d => err.RepeatIdentifiers.d} (78%)
 create mode 100644 test/unittest/enum/err.RepeatIdentifiers.r
 rename test/unittest/enum/{err.D_DECL_IDRED.RepeatIdentifiers.r.p => err.RepeatIdentifiers.r.p} (100%)
 delete mode 100644 test/unittest/types/err.D_DECL_IDRED.dupenum.r
 rename test/unittest/types/{err.D_DECL_IDRED.dupenum.d => err.dupenum.d} (74%)
 create mode 100644 test/unittest/types/err.dupenum.r
 rename test/unittest/types/{err.D_DECL_IDRED.dupenum.r.p => err.dupenum.r.p} (100%)

diff --git a/test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r b/test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r
deleted file mode 100644
index 424d6b077..000000000
--- a/test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r
+++ /dev/null
@@ -1,2 +0,0 @@
--- @@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_DECL_IDRED.RepeatIdentifiers.d b/test/unittest/enum/err.RepeatIdentifiers.d
similarity index 78%
rename from test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.d
rename to test/unittest/enum/err.RepeatIdentifiers.d
index 43837c78a..0dfd7b86c 100644
--- a/test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.d
+++ b/test/unittest/enum/err.RepeatIdentifiers.d
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2025, 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.
  */
@@ -11,11 +11,10 @@
  * error.
  *
  * SECTION: Type and Constant Definitions/Enumerations
- *
- * NOTES:
- *
  */
 
+/* @@runtest-opts: -xerrtags */
+
 #pragma D option quiet
 
 enum colors {
diff --git a/test/unittest/enum/err.RepeatIdentifiers.r b/test/unittest/enum/err.RepeatIdentifiers.r
new file mode 100644
index 000000000..860ffb5c7
--- /dev/null
+++ b/test/unittest/enum/err.RepeatIdentifiers.r
@@ -0,0 +1,2 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/enum/err.RepeatIdentifiers.d: expected error
diff --git a/test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r.p b/test/unittest/enum/err.RepeatIdentifiers.r.p
similarity index 100%
rename from test/unittest/enum/err.D_DECL_IDRED.RepeatIdentifiers.r.p
rename to test/unittest/enum/err.RepeatIdentifiers.r.p
diff --git a/test/unittest/types/err.D_DECL_IDRED.dupenum.r b/test/unittest/types/err.D_DECL_IDRED.dupenum.r
deleted file mode 100644
index 0b6369e52..000000000
--- a/test/unittest/types/err.D_DECL_IDRED.dupenum.r
+++ /dev/null
@@ -1,2 +0,0 @@
--- @@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_DECL_IDRED.dupenum.d b/test/unittest/types/err.dupenum.d
similarity index 74%
rename from test/unittest/types/err.D_DECL_IDRED.dupenum.d
rename to test/unittest/types/err.dupenum.d
index dfc74f250..22001e5d6 100644
--- a/test/unittest/types/err.D_DECL_IDRED.dupenum.d
+++ b/test/unittest/types/err.dupenum.d
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2025, 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.
  */
@@ -12,6 +12,8 @@
  * SECTION: Type and Constant Definitions/Enumerations
  */
 
+/* @@runtest-opts: -xerrtags */
+
 enum foo {
 	x = 3,
 	x = 4
diff --git a/test/unittest/types/err.dupenum.r b/test/unittest/types/err.dupenum.r
new file mode 100644
index 000000000..153985568
--- /dev/null
+++ b/test/unittest/types/err.dupenum.r
@@ -0,0 +1,2 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/types/err.dupenum.d: expected error
diff --git a/test/unittest/types/err.D_DECL_IDRED.dupenum.r.p b/test/unittest/types/err.dupenum.r.p
similarity index 100%
rename from test/unittest/types/err.D_DECL_IDRED.dupenum.r.p
rename to test/unittest/types/err.dupenum.r.p
diff --git a/test/utils/libctf.r.p b/test/utils/libctf.r.p
index a2b4602cf..c81e1b709 100755
--- a/test/utils/libctf.r.p
+++ b/test/utils/libctf.r.p
@@ -1,7 +1,26 @@
 #!/usr/bin/gawk -f
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
+
+# Possible "enumerator" label.
+/Duplicate member, enumerator, or variable name/ {
+    sub(/member, enumerator, or variable/, "member or variable");
+}
+
+# Possible trailing '.'.
 /Duplicate member or variable name\.$/ { sub(/\.$/, ""); }
 /Member name not found\.$/ { sub(/\.$/, ""); }
+
+# Could be union or struct.
 /enum union pirate:/ { sub(/enum union pirate/, "enum struct pirate"); }
+
+# Older or newer libctf diags.
+/\[D_DECL_IDRED\] line [1-9][0-9]*: identifier redeclared: [a-zA-Z]*$/ {
+    sub(/\[D_DECL_IDRED\] line [1-9][0-9]*: .*$/, "expected error");
+}
+/\[D_UNKNOWN\] line [1-9][0-9]*: failed to define enumerator '[a-zA-Z]*': Duplicate member or variable name$/ {
+    sub(/\[D_UNKNOWN\] line [1-9][0-9]*: .*$/, "expected error");
+}
+
+# Print.
 { print; }
-- 
2.47.3


             reply	other threads:[~2025-10-07 22:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-07 22:39 eugene.loh [this message]
2025-10-08 18:18 ` [PATCH] test: Account for variations in error messages 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=20251007223950.31241-1-eugene.loh@oracle.com \
    --to=eugene.loh@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    /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