[DTrace-devel] [PATCH] test: Add tests for option "pspec"

eugene.loh at oracle.com eugene.loh at oracle.com
Mon Mar 13 23:49:49 UTC 2023


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

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 test/unittest/options/err.pspec-default.d | 14 ++++++++++++++
 test/unittest/options/err.pspec-default.r |  2 ++
 test/unittest/options/err.pspec-on.d      | 16 ++++++++++++++++
 test/unittest/options/err.pspec-on.r      |  2 ++
 4 files changed, 34 insertions(+)
 create mode 100644 test/unittest/options/err.pspec-default.d
 create mode 100644 test/unittest/options/err.pspec-default.r
 create mode 100644 test/unittest/options/err.pspec-on.d
 create mode 100644 test/unittest/options/err.pspec-on.r

diff --git a/test/unittest/options/err.pspec-default.d b/test/unittest/options/err.pspec-default.d
new file mode 100644
index 00000000..7fcaa827
--- /dev/null
+++ b/test/unittest/options/err.pspec-default.d
@@ -0,0 +1,14 @@
+/*
+ * 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.
+ */
+
+/*
+ * In the absence of "pspec", this ambiguous expression would seem to have
+ * a syntax error near the end -- that is, after what is thought to be a
+ * declaration.
+ */
+
+int*x
diff --git a/test/unittest/options/err.pspec-default.r b/test/unittest/options/err.pspec-default.r
new file mode 100644
index 00000000..d2e0535b
--- /dev/null
+++ b/test/unittest/options/err.pspec-default.r
@@ -0,0 +1,2 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/options/err.pspec-default.d: line 14: syntax error near end-of-input
diff --git a/test/unittest/options/err.pspec-on.d b/test/unittest/options/err.pspec-on.d
new file mode 100644
index 00000000..303a7a50
--- /dev/null
+++ b/test/unittest/options/err.pspec-on.d
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
+
+/*
+ * In the presence of "pspec", this ambiguous expression would seem to be
+ * missing a predicate or action after what is interpreted as a probe
+ * description.
+ */
+
+#pragma D option pspec
+
+int*x
diff --git a/test/unittest/options/err.pspec-on.r b/test/unittest/options/err.pspec-on.r
new file mode 100644
index 00000000..49999851
--- /dev/null
+++ b/test/unittest/options/err.pspec-on.r
@@ -0,0 +1,2 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/options/err.pspec-on.d: line 16: expected predicate and/or actions following probe description
-- 
2.18.4




More information about the DTrace-devel mailing list