[DTrace-devel] [PATCH 08/14] Test: caller and stackdepth tests for ip provider
eugene.loh at oracle.com
eugene.loh at oracle.com
Thu May 22 18:01:12 UTC 2025
From: Eugene Loh <eugene.loh at oracle.com>
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
test/unittest/variables/bvar/perlping.pl | 8 +++++++
test/unittest/variables/bvar/tst.caller-ip.d | 21 ++++++++++++++++
test/unittest/variables/bvar/tst.caller-ip.r | 1 +
.../unittest/variables/bvar/tst.caller-ip.r.p | 1 +
test/unittest/variables/bvar/tst.caller-ip.t | 6 +++++
.../variables/bvar/tst.stackdepth-ip.d | 24 +++++++++++++++++++
.../variables/bvar/tst.stackdepth-ip.r | 1 +
.../variables/bvar/tst.stackdepth-ip.r.p | 1 +
.../variables/bvar/tst.stackdepth-ip.t | 6 +++++
9 files changed, 69 insertions(+)
create mode 100755 test/unittest/variables/bvar/perlping.pl
create mode 100644 test/unittest/variables/bvar/tst.caller-ip.d
create mode 100644 test/unittest/variables/bvar/tst.caller-ip.r
create mode 120000 test/unittest/variables/bvar/tst.caller-ip.r.p
create mode 100755 test/unittest/variables/bvar/tst.caller-ip.t
create mode 100644 test/unittest/variables/bvar/tst.stackdepth-ip.d
create mode 100644 test/unittest/variables/bvar/tst.stackdepth-ip.r
create mode 120000 test/unittest/variables/bvar/tst.stackdepth-ip.r.p
create mode 100755 test/unittest/variables/bvar/tst.stackdepth-ip.t
diff --git a/test/unittest/variables/bvar/perlping.pl b/test/unittest/variables/bvar/perlping.pl
new file mode 100755
index 000000000..97c9b09e9
--- /dev/null
+++ b/test/unittest/variables/bvar/perlping.pl
@@ -0,0 +1,8 @@
+#!/usr/bin/perl -w
+# Oracle Linux DTrace.
+# Copyright (c) 2016, 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.
+use Net::Ping;
+my $p = Net::Ping->new(${ARGV[0]}, 5, 56);
+$p->ping(${ARGV[1]});
diff --git a/test/unittest/variables/bvar/tst.caller-ip.d b/test/unittest/variables/bvar/tst.caller-ip.d
new file mode 100644
index 000000000..83dbcec5e
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.caller-ip.d
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+#pragma D option quiet
+
+ip:::
+{
+ stack(2);
+ sym(caller);
+ exit(0);
+}
+
+ERROR
+{
+ printf("error encountered\n");
+ exit(1);
+}
diff --git a/test/unittest/variables/bvar/tst.caller-ip.r b/test/unittest/variables/bvar/tst.caller-ip.r
new file mode 100644
index 000000000..2e9ba477f
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.caller-ip.r
@@ -0,0 +1 @@
+success
diff --git a/test/unittest/variables/bvar/tst.caller-ip.r.p b/test/unittest/variables/bvar/tst.caller-ip.r.p
new file mode 120000
index 000000000..954ca96aa
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.caller-ip.r.p
@@ -0,0 +1 @@
+check_caller_to_stack2.awk
\ No newline at end of file
diff --git a/test/unittest/variables/bvar/tst.caller-ip.t b/test/unittest/variables/bvar/tst.caller-ip.t
new file mode 100755
index 000000000..836d283da
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.caller-ip.t
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+testdir="$(dirname $_test)"
+local=127.0.0.1
+
+$testdir/perlping.pl icmp $local
diff --git a/test/unittest/variables/bvar/tst.stackdepth-ip.d b/test/unittest/variables/bvar/tst.stackdepth-ip.d
new file mode 100644
index 000000000..eef942b5b
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.stackdepth-ip.d
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+#pragma D option quiet
+
+ip:::
+/stackdepth > 0/
+{
+ 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-ip.r b/test/unittest/variables/bvar/tst.stackdepth-ip.r
new file mode 100644
index 000000000..3bd29b8ed
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.stackdepth-ip.r
@@ -0,0 +1 @@
+Stack depth OK
diff --git a/test/unittest/variables/bvar/tst.stackdepth-ip.r.p b/test/unittest/variables/bvar/tst.stackdepth-ip.r.p
new file mode 120000
index 000000000..e50f12822
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.stackdepth-ip.r.p
@@ -0,0 +1 @@
+check_stackdepth_to_stack.awk
\ No newline at end of file
diff --git a/test/unittest/variables/bvar/tst.stackdepth-ip.t b/test/unittest/variables/bvar/tst.stackdepth-ip.t
new file mode 100755
index 000000000..836d283da
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.stackdepth-ip.t
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+testdir="$(dirname $_test)"
+local=127.0.0.1
+
+$testdir/perlping.pl icmp $local
--
2.43.5
More information about the DTrace-devel
mailing list