[DTrace-devel] [PATCH] test: Clean up tst.errno2.d
Kris Van Hees
kris.van.hees at oracle.com
Sun Dec 8 00:29:06 UTC 2024
On Wed, Dec 04, 2024 at 01:51:52AM -0500, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at 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 at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at 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
>
More information about the DTrace-devel
mailing list