test: Clean up tst.errno2.d
PATCH 1/1 test: Clean up tst.errno2.d
From: Eugene Loh <[email protected]>
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 <[email protected]>
--- 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
test/unittest/builtinvar/tst.errno2.aarch64.x deleted +0 -2
@@ -1,2 +0,0 @@ -#!/bin/sh -exit 2
test/unittest/builtinvar/tst.errno2.d +5 -1
@@ -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
Signature · 1 line
2.43.5
Quoted 10 lines · On Wed, Dec 04, 2024 at 01:51:52AM -0500, [email protected] wrote:
From: Eugene Loh <[email protected]>
Check only on the process of interest -- that is, /progenyof(parent)/.
Check that
self->fnhas been set before applyingcopyinstr()to it.Add option zdefs in case
open()is deprecated, so that the test will run on aarch64.Signed-off-by Eugene Loh <[email protected]>
Reviewed-by Kris Van Hees <[email protected]>
Quoted 53 lines
--- 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.xtest/unittest/builtinvar/tst.errno2.aarch64.x deleted +0
-2@@ -1,2 +0,0 @@ -#!/bin/sh -exit 2test/unittest/builtinvar/tst.errno2.d +5
-1@@ -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:::exitSignature · 1 line
2.43.5