tests: move F_OFD_SETLK* checks from fcntl64.c to fcntl-common.c
This change enables F_OFD_SETLK* tests for fcntl as well. * tests/fcntl64.c (test_flock64): Rename to test_flock64_lk64. [F_OFD_SETLK]: Remove. (test_flock64_einval): Move ... * tests/fcntl-common.c: ... here. (test_flock64_lk64): New protype. (test_flock64_einval, test_flock64): New functions. * tests/fcntl.c (test_flock64_einval): Rename to test_flock64_undecoded. (TEST_FLOCK64_UNDECODED): New macro. (test_flock64): Rename to test_flock64_lk64, replace TEST_FLOCK64_EINVAL with TEST_FLOCK64_UNDECODED.
This commit is contained in:
parent
3160ea8999
commit
9c7052f403
@ -66,6 +66,24 @@ test_flock_einval(const int cmd, const char *name)
|
||||
(intmax_t) fl.l_start, (intmax_t) fl.l_len, sprintrc(rc));
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is not declared static to avoid potential
|
||||
* "defined but not used" warning when included by fcntl.c
|
||||
*/
|
||||
void
|
||||
test_flock64_einval(const int cmd, const char *name)
|
||||
{
|
||||
struct_kernel_flock64 fl = {
|
||||
.l_type = F_RDLCK,
|
||||
.l_start = 0xdefaced1facefeedULL,
|
||||
.l_len = 0xdefaced2cafef00dULL
|
||||
};
|
||||
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, sprintrc(rc));
|
||||
}
|
||||
|
||||
static void
|
||||
test_flock(void)
|
||||
{
|
||||
@ -94,7 +112,18 @@ test_flock(void)
|
||||
TEST_SYSCALL_STR, FILE_LEN);
|
||||
}
|
||||
|
||||
static void test_flock64(void);
|
||||
static void test_flock64_lk64(void);
|
||||
|
||||
static void
|
||||
test_flock64(void)
|
||||
{
|
||||
# ifdef F_OFD_SETLK
|
||||
TEST_FLOCK64_EINVAL(F_OFD_SETLK);
|
||||
TEST_FLOCK64_EINVAL(F_OFD_SETLKW);
|
||||
# endif
|
||||
|
||||
test_flock64_lk64();
|
||||
}
|
||||
|
||||
/*
|
||||
* F_[GS]ETOWN_EX had conflicting values with F_[SG]ETLK64
|
||||
|
@ -36,7 +36,7 @@
|
||||
# include "fcntl-common.c"
|
||||
|
||||
static void
|
||||
test_flock64_einval(const int cmd, const char *name)
|
||||
test_flock64_undecoded(const int cmd, const char *name)
|
||||
{
|
||||
struct_kernel_flock64 fl = {
|
||||
.l_type = F_RDLCK,
|
||||
@ -48,22 +48,24 @@ test_flock64_einval(const int cmd, const char *name)
|
||||
TEST_SYSCALL_STR, name, &fl, sprintrc(rc));
|
||||
}
|
||||
|
||||
#define TEST_FLOCK64_UNDECODED(cmd) test_flock64_undecoded(cmd, #cmd)
|
||||
|
||||
static void
|
||||
test_flock64(void)
|
||||
test_flock64_lk64(void)
|
||||
{
|
||||
/*
|
||||
* F_[GS]ETOWN_EX had conflicting values with F_[GS]ETLK64
|
||||
* in kernel revisions v2.6.32-rc1~96..v2.6.32-rc7~23.
|
||||
*/
|
||||
# if !defined(F_GETOWN_EX) || F_GETOWN_EX != F_SETLK64
|
||||
TEST_FLOCK64_EINVAL(F_SETLK64);
|
||||
TEST_FLOCK64_UNDECODED(F_SETLK64);
|
||||
# endif
|
||||
/* F_GETLK and F_SETLKW64 have conflicting values on mips64 */
|
||||
# if !defined(__mips64) || F_GETLK != F_SETLKW64
|
||||
TEST_FLOCK64_EINVAL(F_SETLKW64);
|
||||
TEST_FLOCK64_UNDECODED(F_SETLKW64);
|
||||
# endif
|
||||
# if !defined(F_SETOWN_EX) || F_SETOWN_EX != F_GETLK64
|
||||
TEST_FLOCK64_EINVAL(F_GETLK64);
|
||||
TEST_FLOCK64_UNDECODED(F_GETLK64);
|
||||
# endif
|
||||
}
|
||||
|
||||
|
@ -36,28 +36,10 @@
|
||||
# include "fcntl-common.c"
|
||||
|
||||
static void
|
||||
test_flock64_einval(const int cmd, const char *name)
|
||||
{
|
||||
struct_kernel_flock64 fl = {
|
||||
.l_type = F_RDLCK,
|
||||
.l_start = 0xdefaced1facefeedULL,
|
||||
.l_len = 0xdefaced2cafef00dULL
|
||||
};
|
||||
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, sprintrc(rc));
|
||||
}
|
||||
|
||||
static void
|
||||
test_flock64(void)
|
||||
test_flock64_lk64(void)
|
||||
{
|
||||
TEST_FLOCK64_EINVAL(F_SETLK64);
|
||||
TEST_FLOCK64_EINVAL(F_SETLKW64);
|
||||
# ifdef F_OFD_SETLK
|
||||
TEST_FLOCK64_EINVAL(F_OFD_SETLK);
|
||||
TEST_FLOCK64_EINVAL(F_OFD_SETLKW);
|
||||
# endif
|
||||
|
||||
struct_kernel_flock64 fl = {
|
||||
.l_type = F_RDLCK,
|
||||
|
Loading…
x
Reference in New Issue
Block a user