[DTrace-devel] [PATCH] test: Add test for ldpath

eugene.loh at oracle.com eugene.loh at oracle.com
Tue Jan 31 20:47:30 UTC 2023


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

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 .../options/err.D_PRAGMA_OPTSET.ldpath.d      | 19 +++++++++++++++++++
 .../options/err.D_PRAGMA_OPTSET.ldpath.r      |  2 ++
 test/unittest/options/err.ldpath.d            | 19 +++++++++++++++++++
 test/unittest/options/err.ldpath.r            |  3 +++
 4 files changed, 43 insertions(+)
 create mode 100644 test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.d
 create mode 100644 test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.r
 create mode 100644 test/unittest/options/err.ldpath.d
 create mode 100644 test/unittest/options/err.ldpath.r

diff --git a/test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.d b/test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.d
new file mode 100644
index 00000000..d5457593
--- /dev/null
+++ b/test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.d
@@ -0,0 +1,19 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2023, 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: Option ldpath cannot be used from within a D program.
+ *
+ * SECTION: Options and Tunables/Consumer Options
+ */
+
+#pragma D option ldpath=/nonexistent/directory
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.r b/test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.r
new file mode 100644
index 00000000..a717f859
--- /dev/null
+++ b/test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.r
@@ -0,0 +1,2 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.d: [D_PRAGMA_OPTSET] line 14: failed to set option 'ldpath' to '/nonexistent/directory': Option cannot be used from within a D program
diff --git a/test/unittest/options/err.ldpath.d b/test/unittest/options/err.ldpath.d
new file mode 100644
index 00000000..57f57f26
--- /dev/null
+++ b/test/unittest/options/err.ldpath.d
@@ -0,0 +1,19 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2023, 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 ldpath option changes the ld path.
+ *
+ * SECTION: Options and Tunables/Consumer Options
+ */
+
+/* @@runtest-opts: -G -xldpath=/nonexistent/directory */
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/test/unittest/options/err.ldpath.r b/test/unittest/options/err.ldpath.r
new file mode 100644
index 00000000..5c1e3c9f
--- /dev/null
+++ b/test/unittest/options/err.ldpath.r
@@ -0,0 +1,3 @@
+-- @@stderr --
+sh: /nonexistent/directory: No such file or directory
+dtrace: failed to link script test/unittest/options/err.ldpath: failed to link err.ldpath.o: /nonexistent/directory exited with status 127
-- 
2.18.4




More information about the DTrace-devel mailing list