[DTrace-devel] [PATCH] test: Fix -lm tests

eugene.loh at oracle.com eugene.loh at oracle.com
Fri Apr 8 20:49:10 UTC 2022


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

Test tst.InvalidModule4.sh was introduced as part of the DTrace port to
Linux.  It assumed that including a predicate and clause would invalidate
the module name, but that is not the case.  Rather, the module name was not
recognized in the legacy port simply because the named module did not exist.

This ill-constructed test was XFAIL, but that annotation was lifted in
patch 9574434662d0
"Remove @@xfail markers from tests that should pass with assoc support",
leading to some test failures.  Note that there is no connection between
this test and associative support.

Remove the test.

Add a -lm test for nonexisting names to match corresponding "Empty" tests.

Also add a -lm test to confirm that including a predicate and clause does
not invalidate the module name.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 .../dtrace-util/man.ListProbesWithModules     |  7 +-----
 .../unittest/dtrace-util/tst.InvalidModule4.r |  5 -----
 .../dtrace-util/tst.ListProbesModuleClause.r  |  1 +
 ...dule4.sh => tst.ListProbesModuleClause.sh} | 22 ++++---------------
 .../dtrace-util/tst.ListProbesModuleEmpty.r   |  3 +++
 .../dtrace-util/tst.ListProbesModuleEmpty.sh  | 20 +++++++++++++++++
 6 files changed, 29 insertions(+), 29 deletions(-)
 delete mode 100644 test/unittest/dtrace-util/tst.InvalidModule4.r
 create mode 100644 test/unittest/dtrace-util/tst.ListProbesModuleClause.r
 rename test/unittest/dtrace-util/{tst.InvalidModule4.sh => tst.ListProbesModuleClause.sh} (57%)
 create mode 100644 test/unittest/dtrace-util/tst.ListProbesModuleEmpty.r
 create mode 100755 test/unittest/dtrace-util/tst.ListProbesModuleEmpty.sh

diff --git a/test/unittest/dtrace-util/man.ListProbesWithModules b/test/unittest/dtrace-util/man.ListProbesWithModules
index 0b880df0..a08fc170 100644
--- a/test/unittest/dtrace-util/man.ListProbesWithModules
+++ b/test/unittest/dtrace-util/man.ListProbesWithModules
@@ -1,7 +1,7 @@
 
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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.
  */
@@ -65,9 +65,4 @@
  * 12)
  * /usr/sbin/dtrace -lm unix '{printf("FOUND");}'
  * RESULT: List of only unix probes.
- *
- * 13) automated in tst.InvalidModule4.d.ksh
- * /usr/sbin/dtrace -lm
- * unix'/probefunc == "preempt"/{printf("FOUND");}'
- * RESULT: not a valid probe description.
  */
diff --git a/test/unittest/dtrace-util/tst.InvalidModule4.r b/test/unittest/dtrace-util/tst.InvalidModule4.r
deleted file mode 100644
index 71563854..00000000
--- a/test/unittest/dtrace-util/tst.InvalidModule4.r
+++ /dev/null
@@ -1,5 +0,0 @@
-   ID   PROVIDER            MODULE                          FUNCTION NAME
-0
-test/unittest/dtrace-util/tst.InvalidModule4: dtrace failed
--- @@stderr --
-dtrace: failed to match :unix::: No probe matches description
diff --git a/test/unittest/dtrace-util/tst.ListProbesModuleClause.r b/test/unittest/dtrace-util/tst.ListProbesModuleClause.r
new file mode 100644
index 00000000..2e9ba477
--- /dev/null
+++ b/test/unittest/dtrace-util/tst.ListProbesModuleClause.r
@@ -0,0 +1 @@
+success
diff --git a/test/unittest/dtrace-util/tst.InvalidModule4.sh b/test/unittest/dtrace-util/tst.ListProbesModuleClause.sh
similarity index 57%
rename from test/unittest/dtrace-util/tst.InvalidModule4.sh
rename to test/unittest/dtrace-util/tst.ListProbesModuleClause.sh
index c46938ce..e1344f49 100755
--- a/test/unittest/dtrace-util/tst.InvalidModule4.sh
+++ b/test/unittest/dtrace-util/tst.ListProbesModuleClause.sh
@@ -10,29 +10,15 @@
 #
 # ASSERTION:
 # The -lm option can be used to list the probes from their module names.
-# Invalid module names result in error.
+# The presence of a (predicate or) clause is ignored.
 #
 # SECTION: dtrace Utility/-l Option;
 # 	dtrace Utility/-m Option
-#
 ##
 
-if [ $# != 1 ]; then
-	echo expected one argument: '<'dtrace-path'>'
-	exit 2
-fi
-
 dtrace=$1
 
-$dtrace $dt_flags -lm unix'/probefunc == "preempt"/{printf("FOUND");}'
-
-status=$?
-
-echo $status
-
-if [ "$status" -ne 0 ]; then
-	exit 0
-fi
+$dtrace $dt_flags -lm vmlinux'/probefunc == "read"/{printf("FOUND");}' \
+| awk 'NF == 5 && $3 == "vmlinux" { print "success"; exit }'
 
-echo $tst: dtrace failed
-exit $status
+exit 0
diff --git a/test/unittest/dtrace-util/tst.ListProbesModuleEmpty.r b/test/unittest/dtrace-util/tst.ListProbesModuleEmpty.r
new file mode 100644
index 00000000..853acc81
--- /dev/null
+++ b/test/unittest/dtrace-util/tst.ListProbesModuleEmpty.r
@@ -0,0 +1,3 @@
+   ID   PROVIDER            MODULE                          FUNCTION NAME
+-- @@stderr --
+dtrace: failed to match :foobar::: No probe matches description
diff --git a/test/unittest/dtrace-util/tst.ListProbesModuleEmpty.sh b/test/unittest/dtrace-util/tst.ListProbesModuleEmpty.sh
new file mode 100755
index 00000000..0ea0a437
--- /dev/null
+++ b/test/unittest/dtrace-util/tst.ListProbesModuleEmpty.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# 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.
+#
+
+##
+#
+# ASSERTION: The -lm option indicates nonexistent module names.
+#
+# SECTION: dtrace Utility/-lm Option
+#
+##
+
+dtrace=$1
+
+$dtrace $dt_flags -lm foobar
+exit $?
-- 
2.18.4




More information about the DTrace-devel mailing list