[PATCH v3 3/3] Add tests for the -l/--syscall-limit option

Sahil Siddiq icegambit91 at gmail.com
Thu Mar 2 15:53:06 UTC 2023


Hi,

On Thursday, 2 March 2023 16:24:38 IST Dmitry V. Levin wrote:
> On Thu, Mar 02, 2023 at 03:08:44AM +0530, Sahil Siddiq wrote:
> [...]
> 
> > --- a/tests/gen_tests.in
> > +++ b/tests/gen_tests.in
> > @@ -1006,6 +1006,9 @@ strace--strings-in-hex-all		--
trace=chdir
> > --strings-in-hex=all --columns=18> 
> >  strace--strings-in-hex-non-ascii	--trace=chdir --strings-in-hex=non-
ascii
> >  --columns=12 strace--strings-in-hex-non-ascii-chars	--trace=chdir
> >  --strings-in-hex=non-ascii-chars --columns=12
> >  strace--strings-in-hex-none		--trace=chdir --strings-in-
hex=none
> >  --columns=12> 
> > +strace--syscall-limit	--syscall-limit=3 --trace=chdir,getpid
> > --signal='!SIGCHLD,SIGCONT' --quiet=attach,exit -f -a 9
> > +strace--syscall-limit-path	--syscall-limit=2 --trace=all --trace-
path=.
> > --signal='!SIGCHLD,SIGCONT' --quiet=attach,exit,path-resolution -f -a 9
> > +strace--syscall-limit-status	--syscall-limit=2 --trace=chdir,openat
> > --status=failed --signal='!SIGCHLD,SIGCONT' --quiet=attach,exit -f -a 9
> By the way, why have you decided to silence attach/detach messages?
> When you are testing how strace detaches from its tracees,
> this could be really meaningful.

I am not sure why I silenced it. I'll fix this.

> > diff --git a/tests/strace--syscall-limit-path.c
> > b/tests/strace--syscall-limit-path.c new file mode 100644
> > index 000000000..3501124bf
> > --- /dev/null
> > +++ b/tests/strace--syscall-limit-path.c
> > @@ -0,0 +1,2 @@
> > +#define TRACE 2
> > +#include "strace--syscall-limit.c"
> > \ No newline at end of file
> > diff --git a/tests/strace--syscall-limit-status.c
> > b/tests/strace--syscall-limit-status.c new file mode 100644
> > index 000000000..aff6c255f
> > --- /dev/null
> > +++ b/tests/strace--syscall-limit-status.c
> > @@ -0,0 +1,2 @@
> > +#define TRACE 3
> > +#include "strace--syscall-limit.c"
> > \ No newline at end of file
> 
> To be honest, I don't see the benefit of organising the code this way:
> 
> [...]
> 
> > +int
> > +main()
> > +{
> > +	int ret;
> > +
> > +	#if TRACE == 1
> > +		ret = syscall_limit__trace();
> > +	#elif TRACE == 2
> > +		ret = syscall_limit__trace_path();
> > +	#elif TRACE == 3
> > +		ret = syscall_limit__status();
> > +	#endif
> > +
> > +	return ret;
> > +}
> 
> As all three cases have very little in common, wouldn't it be easier
> just to have three independent source files?

Right, that makes sense. I'll fix this too.

Thanks,
Sahil





More information about the Strace-devel mailing list