Commit Graph

4 Commits

Author SHA1 Message Date
7bbf8b54cd tests: fix TEST_SYSCALL_{NR,STR} and STRUCT_STAT_STR macros for musl
The contents of TEST_SYSCALL_NAME and STRUCT_STAT macros was subject
to macro expansion when used in definitions of TEST_SYSCALL_NR,
TEST_SYSCALL_STR, and STRUCT_STAT_STR macros.

As some libcs, e.g. musl libc, define lfs64 names as macros
(stat64 as stat, lstat64 as lstat, etc.), this might result to incorrect
expansion of TEST_SYSCALL_NR, TEST_SYSCALL_STR, and STRUCT_STAT_STR
macros.  To avoid this problem, define these macros directly and remove
TEST_SYSCALL_NAME macro.

* tests/_newselect.c (TEST_SYSCALL_NAME): Remove.
(TEST_SYSCALL_NR, TEST_SYSCALL_STR): New macros.
* tests/fcntl.c: Likewise.
* tests/fcntl64.c: Likewise.
* tests/fstat.c: Likewise.
* tests/fstatat64.c: Likewise.
* tests/lstat.c: Likewise.
* tests/newfstatat.c: Likewise.
* tests/select.c: Likewise.
* tests/stat.c: Likewise.
* tests/fstat64.c (TEST_SYSCALL_NAME): Remove.
(TEST_SYSCALL_NR, TEST_SYSCALL_STR, STRUCT_STAT_STR): New macros.
* tests/lstat64.c: Likewise.
* tests/stat64.c: Likewise.
* tests/fstatx.c (TEST_SYSCALL_NR, nrify, nrify_): Remove.
* tests/lstatx.c: Likewise.
* tests/struct_flock.c (TEST_SYSCALL_NR, TEST_SYSCALL_STR, nrify,
nrify_, stringify, stringify_): Remove.
* tests/xselect.c: Likewise.
* tests/xstatx.c: Check TEST_SYSCALL_STR instead of TEST_SYSCALL_NAME.
(STRUCT_STAT_STR, TEST_SYSCALL_STR, stringify, stringify_): Remove.
[!STRUCT_STAT] (STRUCT_STAT_STR): New macro.
2016-01-12 03:07:39 +00:00
6e65922a32 tests/struct_flock.c: use libtests
* tests/struct_flock.c (create_sample): Return void,
all callers changed.  Use perror_msg_and_fail.
* tests/fcntl.c: Use SKIP_MAIN_UNDEFINED.
* tests/fcntl64.c: Likewise.
2016-01-06 16:06:35 +00:00
0c8853c3c3 tests: include tests.h instead of config.h
Automatically edit tests/*.c files using the following perl one-liner:

perl -0777 -pi -e \
's/#ifdef HAVE_CONFIG_H\n# include "config\.h"\n#endif\n*/#include "tests.h"\n/' \
tests/*.c
2016-01-05 23:17:11 +00:00
2154702865 fcntl: skip F_GETLK64, F_SETLK64, and F_SETLKW64 in fcntl syscall parser
As the kernel recognizes F_GETLK64, F_SETLK64, and F_SETLKW64 commands
in fcntl64 syscall only, do not parse their structures in fcntl parser.

* xlat/fcntlcmds.in: Move F_GETLK64, F_SETLK64, and F_SETLKW64 ...
* xlat/fcntl64cmds.in: ... here.
* fcntl.c: Include "xlat/fcntl64cmds.h".
(print_fcntl): Move printing of first two syscall arguments
and handling of F_GETLK64, F_SETLK64, and F_SETLKW64 commands ...
(SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): ... here.
* tests/fcntl.c: New file, based on struct_flock.c.
* tests/fcntl64.c: Likewise.
* tests/struct_flock.c (test_flock_einval, create_sample): New functions.
(test_flock): Use test_flock_einval.
(test_flock64, main): Remove.
* tests/fcntl.test: New test.
* tests/fcntl64.test: Likewise.
* tests/struct_flock.test: Remove.
* tests/Makefile.am (check_PROGRAMS): Add fcntl and fcntl64,
remove struct_flock.
(TESTS): Add fcntl.test and fcntl64.test, remove struct_flock.test.
(EXTRA_DIST) Add struct_flock.c.
* tests/.gitignore: Add fcntl and fcntl64, remove struct_flock.
2015-12-05 19:35:51 +00:00