[DTrace-devel] [PATCH 09/14] test: Check rindex() for addresses that are not DTrace pointers
eugene.loh at oracle.com
eugene.loh at oracle.com
Thu Nov 3 19:52:21 UTC 2022
From: Eugene Loh <eugene.loh at oracle.com>
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
test/unittest/funcs/tst.rindex_nonDPTR.d | 24 ++++++++++++++++++++++++
test/unittest/funcs/tst.rindex_nonDPTR.r | 2 ++
2 files changed, 26 insertions(+)
create mode 100644 test/unittest/funcs/tst.rindex_nonDPTR.d
create mode 100644 test/unittest/funcs/tst.rindex_nonDPTR.r
diff --git a/test/unittest/funcs/tst.rindex_nonDPTR.d b/test/unittest/funcs/tst.rindex_nonDPTR.d
new file mode 100644
index 00000000..0b193eb0
--- /dev/null
+++ b/test/unittest/funcs/tst.rindex_nonDPTR.d
@@ -0,0 +1,24 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2022, 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
+#pragma D option destructive
+
+BEGIN
+{
+ /* "abcdef" */
+ system("printf '\x61\x62\x63\x64\x65\x66' > /dev/null 2>&1");
+}
+
+syscall::write:entry
+/ppid == $pid/
+{
+ printf("rindex is %d, should be 0\n", rindex((void *)arg1, (void *)arg1));
+ exit(0);
+}
+
+ERROR { exit(1); }
diff --git a/test/unittest/funcs/tst.rindex_nonDPTR.r b/test/unittest/funcs/tst.rindex_nonDPTR.r
new file mode 100644
index 00000000..fd3329d1
--- /dev/null
+++ b/test/unittest/funcs/tst.rindex_nonDPTR.r
@@ -0,0 +1,2 @@
+rindex is 0, should be 0
+
--
2.18.4
More information about the DTrace-devel
mailing list