From: Alan Maguire <alan.maguire@oracle.com>
To: dtrace@lists.linux.dev
Cc: dtrace-devel@oss.oracle.com, Alan Maguire <alan.maguire@oracle.com>
Subject: [PATCH v3 3/9] test: add systemwide stapsdt note test
Date: Tue, 13 Jan 2026 16:51:26 +0000 [thread overview]
Message-ID: <20260113165132.2454591-4-alan.maguire@oracle.com> (raw)
In-Reply-To: <20260113165132.2454591-1-alan.maguire@oracle.com>
Add test verifying that systemwide stapsdt probe firing
is detected and we retrieve arguments correctly.
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
.../usdt/tst.stapsdt-notes-systemwide.r | 2 +
.../usdt/tst.stapsdt-notes-systemwide.sh | 51 +++++++++++++++++++
2 files changed, 53 insertions(+)
create mode 100644 test/unittest/usdt/tst.stapsdt-notes-systemwide.r
create mode 100755 test/unittest/usdt/tst.stapsdt-notes-systemwide.sh
diff --git a/test/unittest/usdt/tst.stapsdt-notes-systemwide.r b/test/unittest/usdt/tst.stapsdt-notes-systemwide.r
new file mode 100644
index 00000000..48ee5472
--- /dev/null
+++ b/test/unittest/usdt/tst.stapsdt-notes-systemwide.r
@@ -0,0 +1,2 @@
+test:args:2:./test:val:18
+
diff --git a/test/unittest/usdt/tst.stapsdt-notes-systemwide.sh b/test/unittest/usdt/tst.stapsdt-notes-systemwide.sh
new file mode 100755
index 00000000..d4de6d2b
--- /dev/null
+++ b/test/unittest/usdt/tst.stapsdt-notes-systemwide.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 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.
+
+# This test covers stapsdt probes fired by the STAP_PROBEn macros,
+# testing various argument forms (constant, register, deref etc).
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+CC=/usr/bin/gcc
+CFLAGS="-I${PWD}/test/unittest/usdt"
+
+DIRNAME="$tmpdir/usdt-notes.$$.$RANDOM"
+mkdir -p $DIRNAME
+cd $DIRNAME
+
+cat > test.c <<EOF
+#include <sdt_notes.h>
+
+int
+main(int argc, char **argv)
+{
+ STAP_PROBE4(test_prov, args, argc, argv[0], argv[1] + 4, 18);
+}
+EOF
+
+${CC} ${CFLAGS} -o test test.c
+if [ $? -ne 0 ]; then
+ echo "failed to compile test.c" >& 2
+ exit 1
+fi
+export PATH=.:$PATH
+
+$dtrace -c './test arg1val' -qs /dev/stdin <<EOF
+test_prov*:test::args
+{
+ printf("%s:%s:%li:%s:%s:%li\n", probemod, probename,
+ arg0, copyinstr(arg1), copyinstr(arg2), arg3);
+}
+
+EOF
+status=$?
+
+exit $status
--
2.43.5
next prev parent reply other threads:[~2026-01-13 16:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 16:51 [PATCH v3 0/9] stapsdt provider: simple system-wide probing Alan Maguire
2026-01-13 16:51 ` [PATCH v3 1/9] dt_lex: support '/' in probe descriptors Alan Maguire
2026-01-15 22:48 ` Kris Van Hees
2026-01-16 10:14 ` Alan Maguire
2026-01-13 16:51 ` [PATCH v3 2/9] stapsdt provider: support systemwide probing Alan Maguire
2026-01-13 16:51 ` Alan Maguire [this message]
2026-01-13 16:51 ` [PATCH v3 4/9] test: add systemwide stapsdt note test using absolute path Alan Maguire
2026-01-13 16:51 ` [PATCH v3 5/9] test: add systemwide stapsdt note test for library Alan Maguire
2026-01-13 16:51 ` [PATCH v3 6/9] stapsdt: add test for listing systemwide probes in object Alan Maguire
2026-01-13 16:51 ` [PATCH v3 7/9] stapsdt: add test for listing systemwide probes in absolute path object Alan Maguire
2026-01-13 16:51 ` [PATCH v3 8/9] stapsdt: add systemwide test for is-enabled probes Alan Maguire
2026-01-13 16:51 ` [PATCH v3 9/9] documentation: update stapsdt docs to describe wildcard support Alan Maguire
2026-01-16 14:48 ` [PATCH v3 0/9] stapsdt provider: simple system-wide probing Kris Van Hees
2026-01-16 15:10 ` Alan Maguire
2026-01-16 15:33 ` Kris Van Hees
2026-01-16 15:36 ` Alan Maguire
2026-01-16 16:22 ` 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=20260113165132.2454591-4-alan.maguire@oracle.com \
--to=alan.maguire@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