[PATCH 1/6] tests/bpf-success-long-y: skip when no /proc

Dmitry V. Levin ldv at altlinux.org
Wed May 5 01:23:40 UTC 2021


On Wed, May 05, 2021 at 03:33:23AM +0300, Dmitry V. Levin wrote:
> On Tue, May 04, 2021 at 07:40:53PM +0000, Alyssa Ross wrote:
> > ---
> >  tests/bpf-success-long-y.c    | 2 ++
> >  tests/bpf-success-long-y.test | 4 ++++
> >  tests/bpf.c                   | 6 ++++++
> >  3 files changed, 12 insertions(+)
> > 
> > diff --git a/tests/bpf-success-long-y.c b/tests/bpf-success-long-y.c
> > index d0e9b2a9..02c9466d 100644
> > --- a/tests/bpf-success-long-y.c
> > +++ b/tests/bpf-success-long-y.c
> > @@ -1,3 +1,5 @@
> >  #define INJECT_RETVAL ((long) 0xbadc0de1e55beefULL)
> >  #define FD0_PATH "</dev/full>"
> > +#define SKIP_IF_PROC_IS_UNAVAILABLE skip_if_unavailable("/proc/self/fd/")
> > +
> >  #include "bpf.c"
> > diff --git a/tests/bpf-success-long-y.test b/tests/bpf-success-long-y.test
> > index 0ecc7e01..e78c9978 100755
> > --- a/tests/bpf-success-long-y.test
> > +++ b/tests/bpf-success-long-y.test
> > @@ -12,5 +12,9 @@ case "$SIZEOF_LONG" in
> >  	8) rval=841540765612359407;;
> >  esac
> >  
> > +../bpf-success-long-y || if [ $? -eq 77 ]; then
> > +	skip_ "bpf-success-long-y exited with code 77"
> > +fi
> 
> Note that bpf-success-long-y produces some output.
> I suppose these 3 lines could be replaced with
> run_prog > /dev/null

Apparently, no, the traditional approach won't work here because
bpf-success-long-y normally fails without retval injection.


-- 
ldv


More information about the Strace-devel mailing list