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 2/4] test: Skip trace() of a 1-byte struct
Date: Tue, 25 Mar 2025 18:25:19 -0400	[thread overview]
Message-ID: <20250325222521.15224-2-eugene.loh@oracle.com> (raw)
In-Reply-To: <20250325222521.15224-1-eugene.loh@oracle.com>

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

With commit 3a551bfd ("trace: fix char-array handling"), this test
started to FAIL.  Meanwhile, the behavior of trace() on a 1-byte
struct is poorly defined.  Users wishing clear semantics should use
print() or other actions.

Skip the test.

Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
 .../actions/trace/tst.struct-1-byte.d         | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/test/unittest/actions/trace/tst.struct-1-byte.d b/test/unittest/actions/trace/tst.struct-1-byte.d
index 36de485f8..8bfcbdd53 100644
--- a/test/unittest/actions/trace/tst.struct-1-byte.d
+++ b/test/unittest/actions/trace/tst.struct-1-byte.d
@@ -5,6 +5,30 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
+/*
+ * With Solaris or legacy DTrace on Linux, the script gives
+ *       52
+ * That is, contents are dumped as an integer because the trace()
+ * argument is 1, 2, 4, or 8 bytes -- specifically, it is 1 byte.
+ *
+ * Before commit 3a551bfd ("trace: fix char-array handling"), we got
+ *           0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+ *       0: 34                                               4
+ * That is, contents were dumped as raw bytes.
+ *
+ * With that patch, we get:
+ *       4
+ * That is, contents are dumped as the string "4" since the contents
+ * are a printable char followed optionally by NUL bytes.
+ *
+ * The truth is that the semantics of trace() are poorly defined.
+ * So we are hard-pressed to say what is correct.  The test has
+ * little value.  Skip it.
+ *
+ * Users who want type-aware printing can use the print() action.
+ */
+/* @@skip: poorly defined semantics */
+
 /*
  * ASSERTION: The trace() action prints a struct { int8_t } correctly.
  *
-- 
2.43.5


  reply	other threads:[~2025-03-25 22:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 22:25 [PATCH 1/4] Remove orphaned dtrace_recdesc_t component dtrd_uarg eugene.loh
2025-03-25 22:25 ` eugene.loh [this message]
2025-07-22 13:46   ` [PATCH 2/4] test: Skip trace() of a 1-byte struct Nick Alcock
2025-08-13 20:20     ` Eugene Loh
2025-03-25 22:25 ` [PATCH 3/4] test: Update some char-array results files eugene.loh
2025-07-22 13:51   ` Nick Alcock
2025-07-22 21:53     ` Eugene Loh
2025-03-25 22:25 ` [PATCH 4/4] Pad strings in the output buffer with NUL bytes after terminating byte eugene.loh
2025-07-22 14:05   ` Nick Alcock
2025-04-11 20:38 ` [PATCH 1/4] Remove orphaned dtrace_recdesc_t component dtrd_uarg 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=20250325222521.15224-2-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