* [PATCH] test: Fix post processing of return-action override-pid tests
@ 2025-08-05 18:12 eugene.loh
2025-08-06 18:18 ` Kris Van Hees
0 siblings, 1 reply; 2+ messages in thread
From: eugene.loh @ 2025-08-05 18:12 UTC (permalink / raw)
To: dtrace, dtrace-devel
From: Eugene Loh <eugene.loh@oracle.com>
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 <eugene.loh@oracle.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] test: Fix post processing of return-action override-pid tests
2025-08-05 18:12 [PATCH] test: Fix post processing of return-action override-pid tests eugene.loh
@ 2025-08-06 18:18 ` Kris Van Hees
0 siblings, 0 replies; 2+ messages in thread
From: Kris Van Hees @ 2025-08-06 18:18 UTC (permalink / raw)
To: eugene.loh; +Cc: dtrace, dtrace-devel
On Tue, Aug 05, 2025 at 02:12:21PM -0400, eugene.loh@oracle.com wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> 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 <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-06 18:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-05 18:12 [PATCH] test: Fix post processing of return-action override-pid tests eugene.loh
2025-08-06 18:18 ` Kris Van Hees
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.