[RFC/PATCH] tests/syslog: GSOC Microproject: Extend coverage of syslog tests

Bharath Vedartham linux.bhar at gmail.com
Fri Mar 1 18:41:04 UTC 2019


On Fri, Mar 01, 2019 at 07:20:11PM +0100, Eugene Syromiatnikov wrote:
> On Thu, Feb 28, 2019 at 06:21:13PM +0530, Bharath Vedartham wrote:
> > The current syslog test covers only cases where the type parameter is
> > SYSLOG_ACTION_READ, SYSLOG_ACTION_READ_ALL, SYSLOG_ACTION_READ_CLEAR as
> > per codecov.
> > 
> > Add test case to cover rest of the default cases.
> > 
> > PS: I am looking to apply for Gsoc. This is my first patch to strace.
> > ---
> >  tests/syslog.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/tests/syslog.c b/tests/syslog.c
> > index 363fdf9..00b8245 100644
> > --- a/tests/syslog.c
> > +++ b/tests/syslog.c
> > @@ -14,15 +14,21 @@
> >  # include <unistd.h>
> >  
> >  # define SYSLOG_ACTION_READ 2
> > +# define SYSLOG_ACTION_SIZE_BUFFER 10
> >  
> >  int
> >  main(void)
> >  {
> >  	const long addr = (long) 0xfacefeeddeadbeefULL;
> > +
> >  	int rc = syscall(__NR_syslog, SYSLOG_ACTION_READ, addr, -1);
> >  	printf("syslog(SYSLOG_ACTION_READ, %#lx, -1) = %d %s (%m)\n",
> >  	       addr, rc, errno2name());
> >  
> > +	rc = syscall(__NR_syslog, SYSLOG_ACTION_SIZE_BUFFER, NULL, 10);
> 
> Note that the call may fail due to imposed LSM configuration.
>
Is that because of passing NULL to the buffer parameter?
> > +	printf("syslog(SYSLOG_ACTION_SIZE_BUFFER, NULL, 10) = %d\n",
> > +			               rc);
> 
> The alignment of the line continuation differs from the one used in the
> strace code base.
> 
Will fix the formatting issue. It passed checkpatch.pl from the kernel,
so I was confident.
> > +
> >  	puts("+++ exited with 0 +++");
> >  	return 0;
> >  }
> > -- 
> > 2.7.4
> > 
> > -- 
> > Strace-devel mailing list
> > Strace-devel at lists.strace.io
> > https://lists.strace.io/mailman/listinfo/strace-devel
> -- 
> Strace-devel mailing list
> Strace-devel at lists.strace.io
> https://lists.strace.io/mailman/listinfo/strace-devel


More information about the Strace-devel mailing list