[DTrace-devel] [PATCH v2 11/14] test: caller and stackdepth tests for proc provider

eugene.loh at oracle.com eugene.loh at oracle.com
Wed Jun 25 04:21:04 UTC 2025


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

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
---
 .../unittest/variables/bvar/tst.caller-proc.d | 34 ++++++++++++++++++
 .../unittest/variables/bvar/tst.caller-proc.r |  1 +
 .../variables/bvar/tst.caller-proc.r.p        |  1 +
 .../variables/bvar/tst.stackdepth-proc.d      | 36 +++++++++++++++++++
 .../variables/bvar/tst.stackdepth-proc.r      |  1 +
 .../variables/bvar/tst.stackdepth-proc.r.p    |  1 +
 6 files changed, 74 insertions(+)
 create mode 100644 test/unittest/variables/bvar/tst.caller-proc.d
 create mode 100644 test/unittest/variables/bvar/tst.caller-proc.r
 create mode 120000 test/unittest/variables/bvar/tst.caller-proc.r.p
 create mode 100644 test/unittest/variables/bvar/tst.stackdepth-proc.d
 create mode 100644 test/unittest/variables/bvar/tst.stackdepth-proc.r
 create mode 120000 test/unittest/variables/bvar/tst.stackdepth-proc.r.p

diff --git a/test/unittest/variables/bvar/tst.caller-proc.d b/test/unittest/variables/bvar/tst.caller-proc.d
new file mode 100644
index 000000000..7c3557e2c
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.caller-proc.d
@@ -0,0 +1,34 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 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.
+ */
+/*
+ * @@trigger: periodic_output
+ */
+
+#pragma D option quiet
+
+/*
+ * Some probes are implemented in terms of rawtp probes.  Avoid them
+ * due to stack-skip issues on older kernels.
+ */
+proc:::exec,
+proc:::exec-failure,
+proc:::exec-success,
+proc:::lwp-start,
+proc:::signal-clear,
+proc:::signal-send,
+proc:::start
+{
+	stack(2);
+	sym(caller);
+	exit(0);
+}
+
+ERROR
+{
+	printf("error encountered\n");
+	exit(1);
+}
diff --git a/test/unittest/variables/bvar/tst.caller-proc.r b/test/unittest/variables/bvar/tst.caller-proc.r
new file mode 100644
index 000000000..2e9ba477f
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.caller-proc.r
@@ -0,0 +1 @@
+success
diff --git a/test/unittest/variables/bvar/tst.caller-proc.r.p b/test/unittest/variables/bvar/tst.caller-proc.r.p
new file mode 120000
index 000000000..954ca96aa
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.caller-proc.r.p
@@ -0,0 +1 @@
+check_caller_to_stack2.awk
\ No newline at end of file
diff --git a/test/unittest/variables/bvar/tst.stackdepth-proc.d b/test/unittest/variables/bvar/tst.stackdepth-proc.d
new file mode 100644
index 000000000..75f720370
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.stackdepth-proc.d
@@ -0,0 +1,36 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 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.
+ */
+/*
+ * @@trigger: periodic_output
+ */
+
+#pragma D option quiet
+
+/*
+ * Some probes are implemented in terms of rawtp probes.  Avoid them
+ * due to stack-skip issues on older kernels.
+ */
+proc:::exec,
+proc:::exec-failure,
+proc:::exec-success,
+proc:::lwp-start,
+proc:::signal-clear,
+proc:::signal-send,
+proc:::start
+{
+	printf("DEPTH %d\n", stackdepth);
+	printf("TRACE BEGIN\n");
+	stack(100);
+	printf("TRACE END\n");
+	exit(0);
+}
+
+ERROR
+{
+	printf("error encountered\n");
+	exit(1);
+}
diff --git a/test/unittest/variables/bvar/tst.stackdepth-proc.r b/test/unittest/variables/bvar/tst.stackdepth-proc.r
new file mode 100644
index 000000000..3bd29b8ed
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.stackdepth-proc.r
@@ -0,0 +1 @@
+Stack depth OK
diff --git a/test/unittest/variables/bvar/tst.stackdepth-proc.r.p b/test/unittest/variables/bvar/tst.stackdepth-proc.r.p
new file mode 120000
index 000000000..e50f12822
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.stackdepth-proc.r.p
@@ -0,0 +1 @@
+check_stackdepth_to_stack.awk
\ No newline at end of file
-- 
2.43.5




More information about the DTrace-devel mailing list