]> granicus.if.org Git - strace/commitdiff
tests: extend coverage of syslog tests
authorBharath Vedartham <linux.bhar@gmail.com>
Thu, 28 Feb 2019 12:51:13 +0000 (18:21 +0530)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 16 Jul 2019 11:41:18 +0000 (11:41 +0000)
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 <evgsyr@gmail.com>
tests/syslog.c

index 363fdf967b7c3f396306f4a995e798d46b35fb5e..88acfdc8c1cd327537679717f4e7589b7b4b1e0f 100644 (file)
 # 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());
+       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;