Re: [PATCH] test: Fix post processing of return-action override-pid tests
Kris Van Hees <[email protected]>
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Aug 05, 2025 at 02:12:21PM -0400, [email protected] wrote: > From: Eugene Loh <[email protected]> > > In commit ee8c066e8 ("rawfbt: selectively allow return() in clauses"), > tests were introduced to check that return values are overwritten. A > pid check value is output and used to facilitate comparisons to a .r > results file. > > The post processing logic was flawed in two respects: > > 1 The check value was being pulled from the "01" entry. Therefore, > the "00" entry, typically appearing first, would not be converted. > > 2 Values were not sorted. Sometimes this means the disorder just > described would be avoided and the test would pass. Mostly, > it means that behavior can be erratic. > > Sort results and use the "00" pid value for converting test results. > Add $dt_flags to the $dtrace line while we're at it. > > Signed-off-by: Eugene Loh <[email protected]> Reviewed-by: Kris Van Hees <[email protected]> Not sure what happened - other than that I must have forgotten to add the corrected .r.p files because I did notice this issue and thought I had committed the fix for it. Oh well... > --- > test/unittest/actions/return/tst.override-getpid-entry.r.p | 2 +- > test/unittest/actions/return/tst.override-getpid-entry.sh | 4 ++-- > test/unittest/actions/return/tst.override-getpid-return.r.p | 2 +- > test/unittest/actions/return/tst.override-getpid-return.sh | 4 ++-- > 4 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/test/unittest/actions/return/tst.override-getpid-entry.r.p b/test/unittest/actions/return/tst.override-getpid-entry.r.p > index c838391a4..1a9b7b1bf 100755 > --- a/test/unittest/actions/return/tst.override-getpid-entry.r.p > +++ b/test/unittest/actions/return/tst.override-getpid-entry.r.p > @@ -4,7 +4,7 @@ BEGIN { > mypid = -1 > } > > -/^01 [1-9][0-9]*$/ { > +/^00 pid is [1-9][0-9]*$/ { > mypid = $NF; > } > > diff --git a/test/unittest/actions/return/tst.override-getpid-entry.sh b/test/unittest/actions/return/tst.override-getpid-entry.sh > index 2282305e7..d9436a532 100755 > --- a/test/unittest/actions/return/tst.override-getpid-entry.sh > +++ b/test/unittest/actions/return/tst.override-getpid-entry.sh > @@ -38,7 +38,7 @@ fi > > # Trace the trigger. On the 2nd and 5th getpid() calls, modify the result. > > -$dtrace -c ./a.out -w -q -n ' > +$dtrace $dt_flags -c ./a.out -w -q -n ' > BEGIN { > printf("00 pid is %d\n", $target); > n = 0; > @@ -58,6 +58,6 @@ rawfbt:vmlinux:__*_sys_getpid:entry > { > return(55555); > } > -' > +' | sort > > exit $? > diff --git a/test/unittest/actions/return/tst.override-getpid-return.r.p b/test/unittest/actions/return/tst.override-getpid-return.r.p > index c838391a4..1a9b7b1bf 100755 > --- a/test/unittest/actions/return/tst.override-getpid-return.r.p > +++ b/test/unittest/actions/return/tst.override-getpid-return.r.p > @@ -4,7 +4,7 @@ BEGIN { > mypid = -1 > } > > -/^01 [1-9][0-9]*$/ { > +/^00 pid is [1-9][0-9]*$/ { > mypid = $NF; > } > > diff --git a/test/unittest/actions/return/tst.override-getpid-return.sh b/test/unittest/actions/return/tst.override-getpid-return.sh > index 078d68a4a..835e443dd 100755 > --- a/test/unittest/actions/return/tst.override-getpid-return.sh > +++ b/test/unittest/actions/return/tst.override-getpid-return.sh > @@ -38,7 +38,7 @@ fi > > # Trace the trigger. On the 2nd and 5th getpid() calls, modify the result. > > -$dtrace -c ./a.out -w -q -n ' > +$dtrace $dt_flags -c ./a.out -w -q -n ' > BEGIN { > printf("00 pid is %d\n", $target); > n = 0; > @@ -58,6 +58,6 @@ rawfbt:vmlinux:__*_sys_getpid:return > { > return(55555); > } > -' > +' | sort > > exit $? > -- > 2.43.5 >