From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH 6/6] test: Check declaration (without init) inside a probe
Date: Mon, 30 Mar 2026 21:02:24 -0400 [thread overview]
Message-ID: <20260331010224.16165-6-eugene.loh@oracle.com> (raw)
In-Reply-To: <20260331010224.16165-1-eugene.loh@oracle.com>
From: Eugene Loh <eugene.loh@oracle.com>
We test that declaration (with init) of a variable inside a probe is not
allowed.
Check also that declaration without init inside a probe is also
forbidden.
The related test/unittest/probes/err.D_SYNTAX/err.D_SYNTAX.declare*.d
tests are left alone.
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
.../scalars/err.D_SYNTAX.declare-init.d | 20 +++++++++++++++++++
test/unittest/scalars/err.D_SYNTAX.declare.d | 4 ++--
2 files changed, 22 insertions(+), 2 deletions(-)
create mode 100644 test/unittest/scalars/err.D_SYNTAX.declare-init.d
diff --git a/test/unittest/scalars/err.D_SYNTAX.declare-init.d b/test/unittest/scalars/err.D_SYNTAX.declare-init.d
new file mode 100644
index 000000000..fd8dca6c0
--- /dev/null
+++ b/test/unittest/scalars/err.D_SYNTAX.declare-init.d
@@ -0,0 +1,20 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2006, 2026, 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:
+ *
+ * Declare and init a variable Inside Begin and make sure compilation fails.
+ *
+ * SECTION: Variables/Scalar Variables
+ *
+ */
+
+BEGIN
+{
+ int x = 123;
+}
diff --git a/test/unittest/scalars/err.D_SYNTAX.declare.d b/test/unittest/scalars/err.D_SYNTAX.declare.d
index f5b2ea914..b26acd04a 100644
--- a/test/unittest/scalars/err.D_SYNTAX.declare.d
+++ b/test/unittest/scalars/err.D_SYNTAX.declare.d
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2026, 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.
*/
@@ -16,5 +16,5 @@
BEGIN
{
- int x = 123;
+ int x;
}
--
2.47.3
prev parent reply other threads:[~2026-03-31 1:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 1:02 [PATCH 1/6] test: Skip tst.depth.sh eugene.loh
2026-03-31 1:02 ` [PATCH 2/6] Simple typo in comment eugene.loh
2026-03-31 1:02 ` [PATCH 3/6] Check if the BPF PROG_LOAD is either -1 or else non-negative eugene.loh
2026-03-31 1:02 ` [PATCH 4/6] test: Remove unnecessary "destructive" pragma eugene.loh
2026-03-31 1:02 ` [PATCH 5/6] Possible uninitialized 'last' variable in usdt_copyin_data() eugene.loh
2026-03-31 1:02 ` eugene.loh [this message]
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=20260331010224.16165-6-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