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

Eugene Loh eugene.loh at oracle.com
Fri Apr 8 16:12:59 UTC 2022


On 4/8/22 11:00 AM, Kris Van Hees wrote:

> I suggest we remove this yesy entirely.  It comes from the Solaris testsuite
> where it is mentioned in a list of manual test (with annotation that it has
> been automated):
>
>   * 13) automated in tst.InvalidModule4.d.ksh
>   * /usr/sbin/dtrace -lm
>   * unix'/probefunc == "preempt"/{printf("FOUND");}'
>   * RESULT: not a valid probe description.
>
> But that expected result is simply not true.  DTrace lists probes bsed on the
> probe description portion of the script, and therefore the predicate and
> clause are ignored.  I.e. this test should not fail -- it does not test an
> invalid module specification at all.
Right, but the patch changes the name to foounix, which is an invalid 
name and therefore achieves the desired result.  I agree the test was 
wrong, but this patch fixes it.
> That said, there *is* merit in adding tests that actual exercise the different
> ways you can specify probe list requests, based on provider, module, function,
> and/or probe name.  I do not believe we have extensive tests for that right
> now, although the collection of tests probably exercises some of that anyway.
>
> But this test -- I'd say just submit a patch to remove it.  It makes no sense.
So should all InvalidModule* tests be removed???

Anyhow, I agree the pre-existing test made no sense, but this patch 
fixes that.
> On Mon, Apr 04, 2022 at 01:30:06AM -0400, eugene.loh--- via DTrace-devel wrote:
>> 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
>>
>>
>> _______________________________________________
>> DTrace-devel mailing list
>> DTrace-devel at oss.oracle.com
>> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list