[DTrace-devel] [PATCH] test: Clean up tst.coverage.d

Eugene Loh eugene.loh at oracle.com
Tue Jan 23 21:13:55 UTC 2024


On 1/23/24 11:55, Kris Van Hees wrote:

> On Thu, Nov 02, 2023 at 06:36:44PM -0400, eugene.loh at oracle.com wrote:
>> The .t file was not executable and therefore not being used.
>> Further, the .d test specifies another @@trigger explicitly.
>> So remove the unused .t file.
>>
>> Clean the .d file up a little, mostly to use aggregations and
>> thereby reduce the volume of output.
> This patch has an issue in the sense that it will actually PASS without the
> support for offset-based pid providers being present even.  In fact, if the
> only probe that ever fires is the tick probe, this test will report PASS.
>
> That's an issue.

Well, I suppose so.  But that was an issue in the original test. This 
patch fixes some things in the test -- notably, reducing the staggering 
amount of output that was appearing in test logs -- but does not fix 
everything in the test.  The point of the patch was to clean the test up 
some, but not to perfect it.  The test claims to check whether we can 
trace safely, which of course begs the question whether we are tracing 
accurately, etc.  Anyhow, the limitation you point out is arguably 
consistent with the original intent of this very tolerant test.

Now, clearly we would like somewhere to test that every offset is 
getting traced and that the counts are correct.  That is a much more 
stringent test than tst.coverage.d ever was.  This more stringent test 
is provided by the commit "pid: Support probe names specifying offsets", 
in test/unittest/pid/tst.offsets.sh

So how about we go with this patch, let tst.coverage.d continue to be 
the anemic test it always was (without letting it swamp the log file 
anymore), and relying on tst.offsets.sh for the more stringent tests we 
would like to see.


>> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
>> ---
>>   test/unittest/pid/tst.coverage.d | 16 ++++------------
>>   test/unittest/pid/tst.coverage.t |  8 --------
>>   2 files changed, 4 insertions(+), 20 deletions(-)
>>   delete mode 100644 test/unittest/pid/tst.coverage.t
>>
>> diff --git a/test/unittest/pid/tst.coverage.d b/test/unittest/pid/tst.coverage.d
>> index 9670665a..3313d7b5 100644
>> --- a/test/unittest/pid/tst.coverage.d
>> +++ b/test/unittest/pid/tst.coverage.d
>> @@ -1,6 +1,6 @@
>>   /*
>>    * Oracle Linux DTrace.
>> - * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
>> + * Copyright (c) 2006, 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.
>>    */
>> @@ -13,22 +13,14 @@
>>    * ASSERTION: test that we can trace every instruction safely
>>    *
>>    * SECTION: pid provider
>> - *
>>    */
>>   
>> -BEGIN
>> +pid$1:a.out::
>>   {
>> -	/*
>> -	 * Let's just do this for 2 seconds.
>> -	 */
>> -	timeout = timestamp + 2000000000;
>> +	@[probename] = count();
>>   }
>>   
>> -pid$1:a.out::
>> -{}
>> -
>> -profile:::tick-4
>> -/timestamp > timeout/
>> +profile:::tick-2sec
>>   {
>>   	exit(0);
>>   }
>> diff --git a/test/unittest/pid/tst.coverage.t b/test/unittest/pid/tst.coverage.t
>> deleted file mode 100644
>> index ac05014b..00000000
>> --- a/test/unittest/pid/tst.coverage.t
>> +++ /dev/null
>> @@ -1,8 +0,0 @@
>> -#!/bin/bash
>> -#
>> -# Oracle Linux DTrace.
>> -# Copyright (c) 2006, 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.
>> -#
>> -while true; do env > /dev/null; done
>> -- 
>> 2.18.4
>>
>>



More information about the DTrace-devel mailing list