* [PATCH] test: Clean up tst.errno2.d
@ 2024-12-04 6:51 eugene.loh
2024-12-08 0:29 ` Kris Van Hees
0 siblings, 1 reply; 2+ messages in thread
From: eugene.loh @ 2024-12-04 6:51 UTC (permalink / raw)
To: dtrace, dtrace-devel
From: Eugene Loh <eugene.loh@oracle.com>
Check only on the process of interest -- that is, /progenyof(parent)/.
Check that self->fn has been set before applying copyinstr() to it.
Add option zdefs in case open() is deprecated, so that the test will
run on aarch64.
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
test/unittest/builtinvar/tst.errno2.aarch64.x | 2 --
test/unittest/builtinvar/tst.errno2.d | 6 +++++-
2 files changed, 5 insertions(+), 3 deletions(-)
delete mode 100755 test/unittest/builtinvar/tst.errno2.aarch64.x
diff --git a/test/unittest/builtinvar/tst.errno2.aarch64.x b/test/unittest/builtinvar/tst.errno2.aarch64.x
deleted file mode 100755
index 5c66540d1..000000000
--- a/test/unittest/builtinvar/tst.errno2.aarch64.x
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exit 2
diff --git a/test/unittest/builtinvar/tst.errno2.d b/test/unittest/builtinvar/tst.errno2.d
index 22fe8b4a2..939f4c7d7 100644
--- a/test/unittest/builtinvar/tst.errno2.d
+++ b/test/unittest/builtinvar/tst.errno2.d
@@ -15,6 +15,7 @@
#pragma D option quiet
#pragma D option destructive
+#pragma D option zdefs
BEGIN
{
@@ -27,19 +28,22 @@ BEGIN
* Record file name pointer arg1 for the 'openat' function and arg0 for 'open'.
*/
syscall::open:entry
+/progenyof(parent)/
{
self->fn = arg0; /* 'open' arg0 holds a pointer to the file name */
}
syscall::openat:entry
+/progenyof(parent)/
{
self->fn = arg1; /* 'openat' arg1 holds a pointer to the file name */
}
syscall::open*:return
-/copyinstr(self->fn) == "/non/existant/file" && errno != 0/
+/self->fn && copyinstr(self->fn) == "/non/existant/file" && errno != 0/
{
printf("OPEN FAILED with errno %d\n", errno);
+ self->fn = 0;
}
proc:::exit
--
2.43.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] test: Clean up tst.errno2.d
2024-12-04 6:51 [PATCH] test: Clean up tst.errno2.d eugene.loh
@ 2024-12-08 0:29 ` Kris Van Hees
0 siblings, 0 replies; 2+ messages in thread
From: Kris Van Hees @ 2024-12-08 0:29 UTC (permalink / raw)
To: eugene.loh; +Cc: dtrace, dtrace-devel
On Wed, Dec 04, 2024 at 01:51:52AM -0500, eugene.loh@oracle.com wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> Check only on the process of interest -- that is, /progenyof(parent)/.
>
> Check that self->fn has been set before applying copyinstr() to it.
>
> Add option zdefs in case open() is deprecated, so that the test will
> run on aarch64.
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> test/unittest/builtinvar/tst.errno2.aarch64.x | 2 --
> test/unittest/builtinvar/tst.errno2.d | 6 +++++-
> 2 files changed, 5 insertions(+), 3 deletions(-)
> delete mode 100755 test/unittest/builtinvar/tst.errno2.aarch64.x
>
> diff --git a/test/unittest/builtinvar/tst.errno2.aarch64.x b/test/unittest/builtinvar/tst.errno2.aarch64.x
> deleted file mode 100755
> index 5c66540d1..000000000
> --- a/test/unittest/builtinvar/tst.errno2.aarch64.x
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -#!/bin/sh
> -exit 2
> diff --git a/test/unittest/builtinvar/tst.errno2.d b/test/unittest/builtinvar/tst.errno2.d
> index 22fe8b4a2..939f4c7d7 100644
> --- a/test/unittest/builtinvar/tst.errno2.d
> +++ b/test/unittest/builtinvar/tst.errno2.d
> @@ -15,6 +15,7 @@
>
> #pragma D option quiet
> #pragma D option destructive
> +#pragma D option zdefs
>
> BEGIN
> {
> @@ -27,19 +28,22 @@ BEGIN
> * Record file name pointer arg1 for the 'openat' function and arg0 for 'open'.
> */
> syscall::open:entry
> +/progenyof(parent)/
> {
> self->fn = arg0; /* 'open' arg0 holds a pointer to the file name */
> }
>
> syscall::openat:entry
> +/progenyof(parent)/
> {
> self->fn = arg1; /* 'openat' arg1 holds a pointer to the file name */
> }
>
> syscall::open*:return
> -/copyinstr(self->fn) == "/non/existant/file" && errno != 0/
> +/self->fn && copyinstr(self->fn) == "/non/existant/file" && errno != 0/
> {
> printf("OPEN FAILED with errno %d\n", errno);
> + self->fn = 0;
> }
>
> proc:::exit
> --
> 2.43.5
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-08 0:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-04 6:51 [PATCH] test: Clean up tst.errno2.d eugene.loh
2024-12-08 0:29 ` Kris Van Hees
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox