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.
This commit is contained in:
parent
f954c48f4b
commit
ec75764697
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user