public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] test: Suppress some white space
@ 2025-06-09 18:06 eugene.loh
  2025-06-13 14:10 ` Nick Alcock
  0 siblings, 1 reply; 4+ messages in thread
From: eugene.loh @ 2025-06-09 18:06 UTC (permalink / raw)
  To: dtrace, dtrace-devel

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

The test suite turns pointers into "{ptr}" so that results
comparisons will not be sensitive to particular pointer offset
values.

If these offsets change in width -- say, from 0xf0 to 0x100 --
the amount of white space in the postprocessed output can change.

Add additional postprocessing to a test that sometimes fails due
to this problem.

Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
 test/unittest/aggs/tst.ustack.r   | 32 +++++++++++++++----------------
 test/unittest/aggs/tst.ustack.r.p |  3 +++
 2 files changed, 19 insertions(+), 16 deletions(-)
 create mode 100755 test/unittest/aggs/tst.ustack.r.p

diff --git a/test/unittest/aggs/tst.ustack.r b/test/unittest/aggs/tst.ustack.r
index ed26cc5f3..271a0b30c 100644
--- a/test/unittest/aggs/tst.ustack.r
+++ b/test/unittest/aggs/tst.ustack.r
@@ -1,18 +1,18 @@
-  ustack-tst-basic`myfunc_y+{ptr}                     
-  ustack-tst-basic`myfunc_y                         
-  ustack-tst-basic                                  
-  ustack-tst-basic`myfunc_y                         
+ ustack-tst-basic`myfunc_y+{ptr} 
+ ustack-tst-basic`myfunc_y 
+ ustack-tst-basic 
+ ustack-tst-basic`myfunc_y 
 
-              ustack-tst-basic`myfunc_z+{ptr}
-              ustack-tst-basic`myfunc_y+{ptr}
-              ustack-tst-basic`myfunc_x+{ptr}
-              ustack-tst-basic`myfunc_w+{ptr}
-              ustack-tst-basic`myfunc_v+{ptr}
+ ustack-tst-basic`myfunc_z+{ptr}
+ ustack-tst-basic`myfunc_y+{ptr}
+ ustack-tst-basic`myfunc_x+{ptr}
+ ustack-tst-basic`myfunc_w+{ptr}
+ ustack-tst-basic`myfunc_v+{ptr}
 
-       97  ustack-tst-basic`myfunc_y+{ptr}                       ustack-tst-basic`myfunc_y                           ustack-tst-basic                                    ustack-tst-basic`myfunc_y                         
-              ustack-tst-basic`myfunc_z+{ptr}
-              ustack-tst-basic`myfunc_y+{ptr}
-              ustack-tst-basic`myfunc_x+{ptr}
-              ustack-tst-basic`myfunc_w+{ptr}
-              ustack-tst-basic`myfunc_v+{ptr}
-        4             1234
+ 97 ustack-tst-basic`myfunc_y+{ptr} ustack-tst-basic`myfunc_y ustack-tst-basic ustack-tst-basic`myfunc_y 
+ ustack-tst-basic`myfunc_z+{ptr}
+ ustack-tst-basic`myfunc_y+{ptr}
+ ustack-tst-basic`myfunc_x+{ptr}
+ ustack-tst-basic`myfunc_w+{ptr}
+ ustack-tst-basic`myfunc_v+{ptr}
+ 4 1234
diff --git a/test/unittest/aggs/tst.ustack.r.p b/test/unittest/aggs/tst.ustack.r.p
new file mode 100755
index 000000000..16a0451c4
--- /dev/null
+++ b/test/unittest/aggs/tst.ustack.r.p
@@ -0,0 +1,3 @@
+#!/usr/bin/gawk -f
+
+{ gsub(/ +/, " "); print; }
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] test: Suppress some white space
  2025-06-09 18:06 [PATCH] test: Suppress some white space eugene.loh
@ 2025-06-13 14:10 ` Nick Alcock
  2025-06-23 20:33   ` Eugene Loh
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Alcock @ 2025-06-13 14:10 UTC (permalink / raw)
  To: eugene.loh; +Cc: dtrace, dtrace-devel

On 9 Jun 2025, eugene loh spake thusly:

> From: Eugene Loh <eugene.loh@oracle.com>
>
> The test suite turns pointers into "{ptr}" so that results
> comparisons will not be sensitive to particular pointer offset
> values.
>
> If these offsets change in width -- say, from 0xf0 to 0x100 --
> the amount of white space in the postprocessed output can change.
>
> Add additional postprocessing to a test that sometimes fails due
> to this problem.

Hmm... this would work for this test, but maybe we should change the
{ptr} substitution in runtest.sh itself so that it gets this right in
the general case?

Something like

diff --git a/runtest.sh b/runtest.sh
index 156e7dec8a1c3..c5703a81bc6d4 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -509,7 +509,7 @@ postprocess()
     # TODO: may need adjustment or making optional if scripts emit hex
     # values which are not continuously variable.
 
-    sed -e '/^==[0-9][0-9]*== /!s,0x[0-9a-f][0-9a-f]*,{ptr},g' \
+    sed -e '/^==[0-9][0-9]*== /!s,0x[0-9a-f][0-9a-f]*\([ \t]*\),{ptr}\1,g' \
 	-e 's,at BPF pc [1-9][0-9]*,at BPF pc NNN,' < $tmpdir/pp.out > $final
 
     return $retval

might work. (Obviously the lines would no longer line up, but the number
of spaces would remain the same as they were before the substitution.)

Lots and lots of expected results would need regenerating after this,
of course...

-- 
NULL && (void)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] test: Suppress some white space
  2025-06-13 14:10 ` Nick Alcock
@ 2025-06-23 20:33   ` Eugene Loh
  2025-07-22 13:41     ` Nick Alcock
  0 siblings, 1 reply; 4+ messages in thread
From: Eugene Loh @ 2025-06-23 20:33 UTC (permalink / raw)
  To: Nick Alcock; +Cc: dtrace, dtrace-devel

On 6/13/25 10:10, Nick Alcock wrote:

> On 9 Jun 2025, eugene loh spake thusly:
>
>> From: Eugene Loh <eugene.loh@oracle.com>
>>
>> The test suite turns pointers into "{ptr}" so that results
>> comparisons will not be sensitive to particular pointer offset
>> values.
>>
>> If these offsets change in width -- say, from 0xf0 to 0x100 --
>> the amount of white space in the postprocessed output can change.
>>
>> Add additional postprocessing to a test that sometimes fails due
>> to this problem.
> Hmm... this would work for this test, but maybe we should change the
> {ptr} substitution in runtest.sh itself so that it gets this right in
> the general case?
>
> Something like
>
> diff --git a/runtest.sh b/runtest.sh
> index 156e7dec8a1c3..c5703a81bc6d4 100755
> --- a/runtest.sh
> +++ b/runtest.sh
> @@ -509,7 +509,7 @@ postprocess()
>       # TODO: may need adjustment or making optional if scripts emit hex
>       # values which are not continuously variable.
>   
> -    sed -e '/^==[0-9][0-9]*== /!s,0x[0-9a-f][0-9a-f]*,{ptr},g' \
> +    sed -e '/^==[0-9][0-9]*== /!s,0x[0-9a-f][0-9a-f]*\([ \t]*\),{ptr}\1,g' \
>   	-e 's,at BPF pc [1-9][0-9]*,at BPF pc NNN,' < $tmpdir/pp.out > $final
>   
>       return $retval
>
> might work. (Obviously the lines would no longer line up, but the number
> of spaces would remain the same as they were before the substitution.)
>
> Lots and lots of expected results would need regenerating after this,
> of course...

I agree that one can make a case for a broader change, but I'm not 
convinced that that would be the better way.  FWIW, there were these two 
commits
         6f398f229 test: Make tests more resilient to different prid widths
         72a79b784 test: Improve resilience of tests to ptr widths
that took the narrower, more tactical approach to such a problem.

I vote for the expedient route:  a "Reviewed-by" and we move on. But 
then, in this case, my vote doesn't count!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] test: Suppress some white space
  2025-06-23 20:33   ` Eugene Loh
@ 2025-07-22 13:41     ` Nick Alcock
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Alcock @ 2025-07-22 13:41 UTC (permalink / raw)
  To: Eugene Loh; +Cc: dtrace, dtrace-devel

On 23 Jun 2025, Eugene Loh outgrape:

> On 6/13/25 10:10, Nick Alcock wrote:
>
>> On 9 Jun 2025, eugene loh spake thusly:
>>
>>> From: Eugene Loh <eugene.loh@oracle.com>
>>>
>>> The test suite turns pointers into "{ptr}" so that results
>>> comparisons will not be sensitive to particular pointer offset
>>> values.
>>>
>>> If these offsets change in width -- say, from 0xf0 to 0x100 --
>>> the amount of white space in the postprocessed output can change.
>>>
>>> Add additional postprocessing to a test that sometimes fails due
>>> to this problem.
>> Hmm... this would work for this test, but maybe we should change the
>> {ptr} substitution in runtest.sh itself so that it gets this right in
>> the general case?
>>
>> Something like
>>
>> diff --git a/runtest.sh b/runtest.sh
>> index 156e7dec8a1c3..c5703a81bc6d4 100755
>> --- a/runtest.sh
>> +++ b/runtest.sh
>> @@ -509,7 +509,7 @@ postprocess()
>>       # TODO: may need adjustment or making optional if scripts emit hex
>>       # values which are not continuously variable.
>>   -    sed -e '/^==[0-9][0-9]*== /!s,0x[0-9a-f][0-9a-f]*,{ptr},g' \
>> +    sed -e '/^==[0-9][0-9]*== /!s,0x[0-9a-f][0-9a-f]*\([ \t]*\),{ptr}\1,g' \
>>   	-e 's,at BPF pc [1-9][0-9]*,at BPF pc NNN,' < $tmpdir/pp.out > $final
>>         return $retval
>>
>> might work. (Obviously the lines would no longer line up, but the number
>> of spaces would remain the same as they were before the substitution.)
>>
>> Lots and lots of expected results would need regenerating after this,
>> of course...
>
> I agree that one can make a case for a broader change, but I'm not convinced that that would be the better way.  FWIW, there were
> these two commits
>         6f398f229 test: Make tests more resilient to different prid widths
>         72a79b784 test: Improve resilience of tests to ptr widths
> that took the narrower, more tactical approach to such a problem.
>
> I vote for the expedient route:  a "Reviewed-by" and we move on. But then, in this case, my vote doesn't count!

I think doing the narrow approach for now makes sense, but doing the
wider one makes more sense in future :) I tried and it's a nest of
thorns, though, unlike hex number replacement there are many places
where we don't want to totally ignore the amount of whitespace in use.
So...

Reviewed-by: Nick Alcock <nick.alcock@oracle.com>

-- 
NULL && (void)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-22 13:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-09 18:06 [PATCH] test: Suppress some white space eugene.loh
2025-06-13 14:10 ` Nick Alcock
2025-06-23 20:33   ` Eugene Loh
2025-07-22 13:41     ` Nick Alcock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox