[DTrace-devel] [PATCH v2 05/14] test: caller and stackdepth tests for dtrace provider
eugene.loh at oracle.com
eugene.loh at oracle.com
Wed Jun 25 04:20:58 UTC 2025
From: Eugene Loh <eugene.loh at oracle.com>
Also, a few old tests, which tested caller and stackdepth using the
dtrace provider, are now superfluous given the new, provider-named
tests. The old tests were extremely lenient -- e.g., simply
checking that these built-in variables were not -1, even though
both variables are unsigned anyhow!
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
---
test/unittest/builtinvar/tst.caller.d | 25 -------------------
.../variables/bvar/tst.caller-dtrace.d | 20 +++++++++++++++
.../variables/bvar/tst.caller-dtrace.r | 1 +
test/unittest/variables/bvar/tst.caller.d | 23 -----------------
.../variables/bvar/tst.stackdepth-dtrace.d | 23 +++++++++++++++++
.../variables/bvar/tst.stackdepth-dtrace.r | 5 ++++
test/unittest/variables/bvar/tst.stackdepth.d | 23 -----------------
7 files changed, 49 insertions(+), 71 deletions(-)
delete mode 100644 test/unittest/builtinvar/tst.caller.d
create mode 100644 test/unittest/variables/bvar/tst.caller-dtrace.d
create mode 100644 test/unittest/variables/bvar/tst.caller-dtrace.r
delete mode 100644 test/unittest/variables/bvar/tst.caller.d
create mode 100644 test/unittest/variables/bvar/tst.stackdepth-dtrace.d
create mode 100644 test/unittest/variables/bvar/tst.stackdepth-dtrace.r
delete mode 100644 test/unittest/variables/bvar/tst.stackdepth.d
diff --git a/test/unittest/builtinvar/tst.caller.d b/test/unittest/builtinvar/tst.caller.d
deleted file mode 100644
index 19a4bab9e..000000000
--- a/test/unittest/builtinvar/tst.caller.d
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Oracle Linux DTrace.
- * Copyright (c) 2006, 2021, 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: print 'caller' and make sure it succeeds.
- *
- * SECTION: Variables/Built-in Variables
- */
-
-#pragma D option quiet
-
-BEGIN
-{
- printf("The caller is %u\n", caller);
- exit(0);
-}
-
-ERROR
-{
- exit(1);
-}
diff --git a/test/unittest/variables/bvar/tst.caller-dtrace.d b/test/unittest/variables/bvar/tst.caller-dtrace.d
new file mode 100644
index 000000000..d726f38ac
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.caller-dtrace.d
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+/* Check 'caller'. */
+
+#pragma D option quiet
+
+BEGIN {
+ trace(caller);
+ exit(0);
+}
+
+ERROR
+{
+ printf("error encountered\n");
+ exit(1);
+}
diff --git a/test/unittest/variables/bvar/tst.caller-dtrace.r b/test/unittest/variables/bvar/tst.caller-dtrace.r
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.caller-dtrace.r
@@ -0,0 +1 @@
+0
diff --git a/test/unittest/variables/bvar/tst.caller.d b/test/unittest/variables/bvar/tst.caller.d
deleted file mode 100644
index 3d64fa98c..000000000
--- a/test/unittest/variables/bvar/tst.caller.d
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Oracle Linux DTrace.
- * Copyright (c) 2020, 2021, 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: The 'caller' variable can be accessed and is not -1.
- *
- * SECTION: Variables/Built-in Variables/caller
- */
-
-#pragma D option quiet
-
-BEGIN {
- trace(caller);
- exit(caller != -1 ? 0 : 1);
-}
-
-ERROR {
- exit(1);
-}
diff --git a/test/unittest/variables/bvar/tst.stackdepth-dtrace.d b/test/unittest/variables/bvar/tst.stackdepth-dtrace.d
new file mode 100644
index 000000000..1026006eb
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.stackdepth-dtrace.d
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+/* Check 'stackdepth'. */
+
+#pragma D option quiet
+
+BEGIN {
+ printf("DEPTH %d\n", stackdepth);
+ printf("TRACE BEGIN\n");
+ stack();
+ printf("TRACE END\n");
+ exit(0);
+}
+
+ERROR
+{
+ printf("error encountered\n");
+ exit(1);
+}
diff --git a/test/unittest/variables/bvar/tst.stackdepth-dtrace.r b/test/unittest/variables/bvar/tst.stackdepth-dtrace.r
new file mode 100644
index 000000000..1afb1f057
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.stackdepth-dtrace.r
@@ -0,0 +1,5 @@
+DEPTH 0
+TRACE BEGIN
+
+TRACE END
+
diff --git a/test/unittest/variables/bvar/tst.stackdepth.d b/test/unittest/variables/bvar/tst.stackdepth.d
deleted file mode 100644
index ad728fd85..000000000
--- a/test/unittest/variables/bvar/tst.stackdepth.d
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Oracle Linux DTrace.
- * Copyright (c) 2020, 2021, 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: The 'stackdepth' variable can be accessed and is not -1.
- *
- * SECTION: Variables/Built-in Variables/stackdepth
- */
-
-#pragma D option quiet
-
-BEGIN {
- trace(stackdepth);
- exit(stackdepth != -1 ? 0 : 1);
-}
-
-ERROR {
- exit(1);
-}
--
2.43.5
More information about the DTrace-devel
mailing list