From ec757646976f3866ed48112dface4dea11062bfd Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 16 Feb 2017 12:51:00 +0000 Subject: [PATCH] tests: use sprintrc in tests of fcntl and fcntl64 syscalls * tests/struct_flock.c (EINVAL_STR): Remove. (test_flock_einval, test_flock): Use sprintrc instead of EINVAL_STR. * tests/fcntl.c (test_flock64_einval): Likewise. * tests/fcntl64.c (test_flock64_einval, test_flock64): Likewise. --- tests/fcntl.c | 4 ++-- tests/fcntl64.c | 6 +++--- tests/struct_flock.c | 7 +++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/fcntl.c b/tests/fcntl.c index f060cdf8..9e8dd24b 100644 --- a/tests/fcntl.c +++ b/tests/fcntl.c @@ -44,9 +44,9 @@ test_flock64_einval(const int cmd, const char *name) .l_start = 0xdefaced1facefeedULL, .l_len = 0xdefaced2cafef00dULL }; - invoke_test_syscall(cmd, &fl); + long rc = invoke_test_syscall(cmd, &fl); printf("%s(0, %s, %p) = %s\n", - TEST_SYSCALL_STR, name, &fl, EINVAL_STR); + TEST_SYSCALL_STR, name, &fl, sprintrc(rc)); } static void diff --git a/tests/fcntl64.c b/tests/fcntl64.c index 5ecd6eb9..d1511547 100644 --- a/tests/fcntl64.c +++ b/tests/fcntl64.c @@ -44,10 +44,10 @@ test_flock64_einval(const int cmd, const char *name) .l_start = 0xdefaced1facefeedULL, .l_len = 0xdefaced2cafef00dULL }; - invoke_test_syscall(cmd, &fl); + long rc = invoke_test_syscall(cmd, &fl); printf("%s(0, %s, {l_type=F_RDLCK, l_whence=SEEK_SET" ", l_start=%jd, l_len=%jd}) = %s\n", TEST_SYSCALL_STR, name, - (intmax_t) fl.l_start, (intmax_t) fl.l_len, EINVAL_STR); + (intmax_t) fl.l_start, (intmax_t) fl.l_len, sprintrc(rc)); } static void @@ -67,7 +67,7 @@ test_flock64(void) long rc = invoke_test_syscall(F_SETLK64, &fl); printf("%s(0, F_SETLK64, {l_type=F_RDLCK, l_whence=SEEK_SET" ", l_start=0, l_len=%d}) = %s\n", - TEST_SYSCALL_STR, FILE_LEN, rc ? EINVAL_STR : "0"); + TEST_SYSCALL_STR, FILE_LEN, sprintrc(rc)); if (rc) return; diff --git a/tests/struct_flock.c b/tests/struct_flock.c index 34cf58e6..bebd9d20 100644 --- a/tests/struct_flock.c +++ b/tests/struct_flock.c @@ -32,7 +32,6 @@ #include "flock.h" #define FILE_LEN 4096 -#define EINVAL_STR "-1 EINVAL (Invalid argument)" #define TEST_FLOCK_EINVAL(cmd) test_flock_einval(cmd, #cmd) @@ -58,10 +57,10 @@ test_flock_einval(const int cmd, const char *name) .l_start = (TYPEOF_FLOCK_OFF_T) 0xdefaced1facefeedULL, .l_len = (TYPEOF_FLOCK_OFF_T) 0xdefaced2cafef00dULL }; - invoke_test_syscall(cmd, &fl); + long rc = invoke_test_syscall(cmd, &fl); printf("%s(0, %s, {l_type=F_RDLCK, l_whence=SEEK_SET" ", l_start=%jd, l_len=%jd}) = %s\n", TEST_SYSCALL_STR, name, - (intmax_t) fl.l_start, (intmax_t) fl.l_len, EINVAL_STR); + (intmax_t) fl.l_start, (intmax_t) fl.l_len, sprintrc(rc)); } static void @@ -77,7 +76,7 @@ test_flock(void) long rc = invoke_test_syscall(F_SETLK, &fl); printf("%s(0, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET" ", l_start=0, l_len=%d}) = %s\n", - TEST_SYSCALL_STR, FILE_LEN, rc ? EINVAL_STR : "0"); + TEST_SYSCALL_STR, FILE_LEN, sprintrc(rc)); if (rc) return; -- 2.40.0