[DTrace-devel] [PATCH] test: Fix tst.InvalidModule4.sh

eugene.loh at oracle.com eugene.loh at oracle.com
Mon Apr 4 05:30:06 UTC 2022


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

This test has had a mysterious history.  It was apparently introduced
as part of the DTrace port to Linux.  It presumed the probe description
was not valid, but the reasoning is unclear why.  More specifically, the
probe description was seemingly valid under Solaris and matched multiple
probes.  With the port to Linux, there were no module-unix probes.  Thus,
the probe description ended up not matching any probes, but perhaps not
for the originally intended reason.

With the port to DTrace on BPF, there are now module-unix probes.  So
DTrace finds matching probes, which causes the test to FAIL, but for
dubious reasons.

The test also perhaps assumed that DTrace would return a nonzero value
if the probe description fits no probes.  If no probes are found,
however, DTrace simply indicates so while still returning a 0 value --
whether on Solaris, legacy DTrace on Linux, or now DTrace on BPF.

The next intriguing development was that the XFAIL annotation was lifted
in patch 9574434662d0
"Remove @@xfail markers from tests that should pass with assoc support".
Again, the reasoning is unclear.  Specifically, there is no connection
between this test and associative support.

Fix the test so that it clearly references an invalid module:  foounix.
Ignore the return value of the command.  Now, the test should correctly
find no matching probes for the invalid module;  the test should now
pass.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 .../dtrace-util/man.ListProbesWithModules     |  5 -----
 .../unittest/dtrace-util/tst.InvalidModule4.r |  4 +---
 .../dtrace-util/tst.InvalidModule4.sh         | 19 ++-----------------
 3 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/test/unittest/dtrace-util/man.ListProbesWithModules b/test/unittest/dtrace-util/man.ListProbesWithModules
index 0b880df0..c6305296 100644
--- a/test/unittest/dtrace-util/man.ListProbesWithModules
+++ b/test/unittest/dtrace-util/man.ListProbesWithModules
@@ -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
index 71563854..42515c55 100644
--- a/test/unittest/dtrace-util/tst.InvalidModule4.r
+++ b/test/unittest/dtrace-util/tst.InvalidModule4.r
@@ -1,5 +1,3 @@
    ID   PROVIDER            MODULE                          FUNCTION NAME
-0
-test/unittest/dtrace-util/tst.InvalidModule4: dtrace failed
 -- @@stderr --
-dtrace: failed to match :unix::: No probe matches description
+dtrace: failed to match :foounix::: No probe matches description
diff --git a/test/unittest/dtrace-util/tst.InvalidModule4.sh b/test/unittest/dtrace-util/tst.InvalidModule4.sh
index c46938ce..83fcf3dc 100755
--- a/test/unittest/dtrace-util/tst.InvalidModule4.sh
+++ b/test/unittest/dtrace-util/tst.InvalidModule4.sh
@@ -17,22 +17,7 @@
 #
 ##
 
-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
-
-echo $tst: dtrace failed
-exit $status
+$dtrace $dt_flags -lm foounix'/probefunc == "preempt"/{printf("FOUND");}'
+exit 0
-- 
2.18.4




More information about the DTrace-devel mailing list