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

Eugene Syromiatnikov esyr at redhat.com
Fri Mar 1 18:20:11 UTC 2019


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.

> +	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.

> +
>  	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


More information about the Strace-devel mailing list