[DTrace-devel] [PATCH 10/14] test: Check strjoin() for addresses that are not DTrace pointers

eugene.loh at oracle.com eugene.loh at oracle.com
Thu Nov 3 19:52:22 UTC 2022


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

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 .../funcs/strjoin/tst.strjoin_nonDPTR.d       | 24 +++++++++++++++++++
 .../funcs/strjoin/tst.strjoin_nonDPTR.r       |  2 ++
 2 files changed, 26 insertions(+)
 create mode 100644 test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.d
 create mode 100644 test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.r

diff --git a/test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.d b/test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.d
new file mode 100644
index 00000000..433ceeb9
--- /dev/null
+++ b/test/unittest/funcs/strjoin/tst.strjoin_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("|%s|\n", strjoin((void *)arg1, (void *)arg1));
+	exit(0);
+}
+
+ERROR { exit(1); }
diff --git a/test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.r b/test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.r
new file mode 100644
index 00000000..89fb09b7
--- /dev/null
+++ b/test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.r
@@ -0,0 +1,2 @@
+|abcdefabcdef|
+
-- 
2.18.4




More information about the DTrace-devel mailing list