From 4355057cc82d927c76acc858d956b451f74f4363 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Thu, 28 Feb 2019 18:21:13 +0530 Subject: [PATCH] tests: extend coverage of syslog tests The current syslog test covers only those cases where the type parameter is one of SYSLOG_ACTION_READ, SYSLOG_ACTION_READ_ALL, SYSLOG_ACTION_READ_CLEAR as per codecov. Add test case to cover the default case. * tests/syslog.c (SYSLOG_ACTION_SIZE_BUFFER): New macro. (main): Check SYSLOG_ACTION_SIZE_BUFFER decoding. Co-Authored-by: Eugene Syromyatnikov --- tests/syslog.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/syslog.c b/tests/syslog.c index 363fdf96..88acfdc8 100644 --- a/tests/syslog.c +++ b/tests/syslog.c @@ -14,14 +14,20 @@ # include # 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()); + printf("syslog(SYSLOG_ACTION_READ, %#lx, -1) = %s\n", + addr, sprintrc(rc)); + + rc = syscall(__NR_syslog, SYSLOG_ACTION_SIZE_BUFFER, NULL, 10); + printf("syslog(SYSLOG_ACTION_SIZE_BUFFER, NULL, 10) = %s\n", + sprintrc(rc)); puts("+++ exited with 0 +++"); return 0; -- 2.40.0