Commit Graph

3843 Commits

Author SHA1 Message Date
65dea4b1e4 tests/dup2.c: print syscall() result using %ld format 2016-04-21 20:52:41 +00:00
89b575d3c5 tests/dup.c: cleanup 2016-04-21 20:52:41 +00:00
b0a647f4d4 tests/creat.c: stop using sys/stat.h 2016-04-21 20:52:41 +00:00
0d8361fc80 tests/copy_file_range.c: stop using assert 2016-04-21 20:52:41 +00:00
adbbc2d288 tests/chroot.c: use errno2name 2016-04-21 20:52:41 +00:00
5327e9c179 tests/aio.c: use errno2name 2016-04-21 20:52:41 +00:00
dd02f09f4b tests: cleanup acct.test
* tests/acct.c (main): Use errno2name, stop using assert,
change sample file name.
* tests/acct.test: Update.
2016-04-21 20:20:42 +00:00
9f6611bb31 tests: use errno2name()
Automatically change tests/*.c files using the following sed regexp:
sed -i 's/errno == E[[:alnum:]]\+ ? "E[[:alnum:]]\+" : "E[[:alnum:]]\+"/errno2name()/g'
2016-04-21 18:16:50 +00:00
57b5f55a2a tests/dup.c: include "tests.h"
This is going to be necessary for the following commit.
2016-04-21 18:16:10 +00:00
Fei Jie
ef6b4262bb tests: add getpgrp.test
* tests/getpgrp.c: New file.
* tests/getpgrp.test: New test.
* tests/.gitignore: Add getpgrp.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getpgrp.test.
2016-04-21 17:37:44 +00:00
Fei Jie
f914194fc3 tests: add access.test
* tests/access.c: New file.
* tests/access.test: New test.
* tests/.gitignore: Add access.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add access.test.
2016-04-21 17:37:43 +00:00
Fei Jie
e0057a578f tests: add fchdir.test
* tests/fchdir.c: New file.
* tests/fchdir.test: New test.
* tests/.gitignore: Add fchdir.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fchdir.test.
2016-04-21 17:35:39 +00:00
Fei Jie
5c1776fe00 tests: add mkdir.test
* tests/mkdir.c: New file.
* tests/mkdir.test: New test.
* tests/.gitignore: Add mkdir.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mkdir.test.
2016-04-21 17:34:38 +00:00
Fei Jie
8bfe0d5e22 tests: add getsid.test
* tests/getsid.c: New file.
* tests/getsid.test: New test.
* tests/.gitignore: Add getsid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getsid.test.
2016-04-21 17:31:05 +00:00
2b69fd4c43 tests: add errno2name function to libtests
Add a simple translator of errno to its name, so one could
simply use errno2name() instead of complex expressions like
errno == EINVAL ? "EINVAL" : "EFAULT".

* tests.h (errno2name): New prototype.
* errno2name.c: New file.
* Makefile.am (libtests_a_SOURCES): Add it.
2016-04-21 04:08:55 +03:00
769c98af34 hppa: rename ECANCELLED to ECANCELED
hppa seems to be the only architecture that defines ECANCELLED synonym
for ECANCELED constant, other architectures just define ECANCELED.
Change the way how this constant is printed on hppa to be in line
with other architectures.

* linux/hppa/errnoent.h [253]: Rename ECANCELLED to ECANCELED.
2016-04-20 21:36:46 +00:00
126464566d Remove parser of unimplemented timerfd syscall
timerfd syscall was introduced in v2.6.22-rc1, but in v2.6.25-rc1
it was replaced by timerfd_* syscall family.

* linux/avr32/syscallent.h (timerfd): Fix nargs.
* linux/dummy.h (sys_timerfd): Add stub alias.
* time.c (SYS_FUNC(timerfd)): Remove.
2016-04-20 17:15:05 +00:00
e8a8f6d6e8 tests: workaround kernel bugs in seccomp-strict.test and prctl-seccomp-strict.test
If kernel implementation of strict seccomp mode is buggy, test programs
will be killed by SIGKILL.  This is a known problem at least on
x32 and mips.  Skip affected tests if this is the case.

This change partially revert commit 9c1a72cd3f.

* tests/seccomp-strict.c (main): Remove workaround for x32.
* tests/prctl-seccomp-strict.c: Likewise.
* tests/seccomp-strict.test: Skip the test if the test program
has been killed by SIGKILL.
* tests/prctl-seccomp-strict.test: Likewise.
2016-04-20 14:30:43 +00:00
bea707377d tests/shmxt.c: do not use SHM_RND, it is unreliable
* tests/shmxt.c (main): Do not set SHM_RND flag.
2016-04-20 05:40:58 +00:00
c8cc0f2a87 tests/rt_sigpending.c: fix for systems where _NSIG > 16 * sizeof(long)
* tests/rt_sigsuspend.c (iterate): Do not assume that size will be less
than sizeof(long) on the second iteration.
2016-04-20 04:35:25 +00:00
d424c765f7 prctl-seccomp-strict.test: robustify against unrelated prctl invocations
* tests/prctl-seccomp-strict.test: Filter out PR_GET_* prctl calls.
2016-04-20 01:08:13 +00:00
fdb2a1867e tests: adjust rt_sigpending to older kernels
With linux kernels older than v3.9-rc1, compat rt_sigpending syscall
could fail with EFAULT in cases where on later kernels it succeeds.
Adjust the test to handle both cases properly.

* tests/rt_sigpending.c (iterate): Stop iterations if rt_sigpending
failed with EFAULT.
2016-04-20 01:08:13 +00:00
f73a3a44dd tests: adjust readv/writev and preadv/pwritev tests to older kernels
With linux kernels older than v3.16-rc1, iovec based compat syscalls may
return EINVAL in some cases where on later kernels they return EFAULT.
Adjust tests to handle both cases properly.

* tests/preadv-pwritev.c: Include <errno.h>.
(main): Print either "EINVAL" or "EFAULT" depending on errno.
* tests/pwritev.c: Likewise.
* tests/readv.c: Likewise.
2016-04-20 01:08:13 +00:00
87c0b56a77 tests: remove obsolete non-strict uid tests
Recently added strict tests for uid/gid related syscalls
made old uid tests obsolete.

* tests/uid.awk: Remove.
* tests/uid.c: Remove.
* tests/uid.test: Remove.
* tests/uid16.c: Remove.
* tests/uid16.test: Remove.
* tests/uid32.c: Remove.
* tests/uid32.test: Remove.
* tests/.gitignore: Remove uid, uid16, and uid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Remove uid.test, uid16.test, and uid32.test.
(EXTRA_DIST): Remove uid.awk.
2016-04-20 01:08:13 +00:00
f096422882 tests: extend test coverage of getuid/getgid family syscalls
Add strict tests for getuid, getuid32, getgid, getgid32, geteuid,
geteuid32, getegid, and getegid32 syscalls.

* tests/getegid.c: New file.
* tests/getegid.test: New test.
* tests/getegid32.c: New file.
* tests/getegid32.test: New test.
* tests/geteuid.c: New file.
* tests/geteuid.test: New test.
* tests/geteuid32.c: New file.
* tests/geteuid32.test: New test.
* tests/getgid.c: New file.
* tests/getgid.test: New test.
* tests/getgid32.c: New file.
* tests/getgid32.test: New test.
* tests/getuid.c: New file.
* tests/getuid.test: New test.
* tests/getuid32.c: New file.
* tests/getuid32.test: New test.
* tests/.gitignore: Add getuid, getuid32, getgid, getgid32, geteuid,
* geteuid32, getegid, and getegid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getegid.test, getegid32.test, geteuid.test,
geteuid32.test, getgid.test, getgid32.test, getuid.test,
and getuid32.test.
2016-04-20 01:08:13 +00:00
7f3da2ff4c tests: extend test coverage of getresgid32 syscall
* tests/getresgid32.c: New file.
* tests/getresgid32.test: New test.
* tests/.gitignore: Add getresgid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getresgid32.test.
2016-04-20 01:08:13 +00:00
91119e5306 tests: extend test coverage of getresgid syscall
* tests/getresgid.c: New file.
* tests/getresgid.test: New test.
* tests/.gitignore: Add getresgid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getresgid.test.
2016-04-20 01:08:13 +00:00
dcc6660256 tests: extend test coverage of getresuid32 syscall
* tests/getresuid32.c: New file.
* tests/getresuid32.test: New test.
* tests/.gitignore: Add getresuid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getresuid32.test.
2016-04-20 01:08:13 +00:00
fbe1a9ec6e tests: extend test coverage of getresuid syscall
* tests/getresugid.c: New file.
* tests/getresuid.c: New file.
* tests/getresuid.test: New test.
* tests/.gitignore: Add getresuid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getresuid.test.
(EXTRA_DIST): Add getresugid.c.
2016-04-20 01:08:13 +00:00
Fei Jie
bff70d4311 tests: add symlinkat.test
* tests/symlinkat.c: New file.
* tests/symlinkat.test: New test.
* tests/.gitignore: Add symlinkat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add symlinkat.test.
2016-04-20 01:08:13 +00:00
Fei Jie
1eb0051663 tests: add iopl.test
* tests/iopl.c: New file.
* tests/iopl.test: New test.
* tests/.gitignore: Add iopl.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add iopl.test.
2016-04-20 01:08:13 +00:00
ef2007eccc mips o32, powerpc, powerpc64: fix decoding of iopl syscall
* linux/mips/syscallent-o32.h (iopl): Fix nargs.
* linux/powerpc/syscallent.h (iopl): Fix nargs and sys_func.
* linux/powerpc64/syscallent.h (iopl): Likewise.
2016-04-20 01:08:13 +00:00
Fei Jie
2e069fcc0d tests: add ioperm.test
* tests/ioperm.c: New file.
* tests/ioperm.test: New test.
* tests/.gitignore: Add ioperm.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioperm.test.
2016-04-20 01:08:13 +00:00
5e9944df2c Fix corner cases of getgroups and setgroups syscall decoders
* uid.c (print_groups): New function.
(SYS_FUNC(setgroups), SYS_FUNC(getgroups)): Use it.
Print first syscall argument using %u format.
* tests/getgroups.c: New file.
* tests/getgroups.test: New test.
* tests/getgroups32.c: New file.
* tests/getgroups32.test: New test.
* tests/setgroups.c: New file.
* tests/setgroups.test: New test.
* tests/setgroups32.c: New file.
* tests/setgroups32.test: New test.
* tests/.gitignore: Add getgroups, getgroups32, setgroups,
and setgroups32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getgroups.test, getgroups32.test,
setgroups.test, and setgroups32.test.
2016-04-20 01:08:13 +00:00
ba210af060 Cleanup setfsuid syscall decoder
* uid.c (SYS_FUNC(setfsuid)): Remove redundant check.
2016-04-20 01:08:13 +00:00
f184989593 tests: check decoding of setfsgid32 syscall
* tests/setfsgid32.c: New file.
* tests/setfsgid32.test: New test.
* tests/.gitignore: Add setfsgid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setfsgid32.test.
2016-04-20 01:08:13 +00:00
fba762db71 tests: check decoding of setfsgid syscall
* tests/setfsugid.c: New file.
* tests/setfsgid.c: New file.
* tests/setfsgid.test: New test.
* tests/.gitignore: Add setfsgid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setfsgid.test.
(EXTRA_DIST): Add setfsugid.c.
2016-04-20 01:08:13 +00:00
2def3d4a04 tests: check decoding of setfsuid32 syscall
* tests/setfsuid32.c: New file.
* tests/setfsuid32.test: New test.
* tests/.gitignore: Add setfsuid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setfsuid32.test.
2016-04-20 01:08:13 +00:00
281e4578dd tests: check decoding of setfsuid syscall
* tests/setfsugid.c: New file.
* tests/setfsuid.c: New file.
* tests/setfsuid.test: New test.
* tests/.gitignore: Add setfsuid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setfsuid.test.
(EXTRA_DIST): Add setfsugid.c.
2016-04-20 01:08:13 +00:00
fa7c988bd9 tests: extend test coverage of setresgid32 syscall
* tests/setresgid32.c: New file.
* tests/setresgid32.test: New test.
* tests/.gitignore: Add setresgid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setresgid32.test.
2016-04-20 01:08:13 +00:00
4f6d95dd58 tests: extend test coverage of setresgid syscall
* tests/setresgid.c: New file.
* tests/setresgid.test: New test.
* tests/.gitignore: Add setresgid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setresgid.test.
2016-04-20 01:08:12 +00:00
2b42d8e32f tests: extend test coverage of setresuid32 syscall
* tests/setresuid32.c: New file.
* tests/setresuid32.test: New test.
* tests/.gitignore: Add setresuid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setresuid32.test.
2016-04-20 01:08:12 +00:00
0eac88a00a tests: extend test coverage of setresuid syscall
* tests/setresugid.c: New file.
* tests/setresuid.c: New file.
* tests/setresuid.test: New test.
* tests/.gitignore: Add setresuid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setresuid.test.
(EXTRA_DIST): Add setresugid.c.
2016-04-20 01:08:12 +00:00
7d7dfbede8 tests: extend test coverage of setregid32 syscall
* tests/setregid32.c: New file.
* tests/setregid32.test: New test.
* tests/.gitignore: Add setregid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setregid32.test.
2016-04-20 01:08:12 +00:00
28d02ea6f3 tests: extend test coverage of setregid syscall
* tests/setregid.c: New file.
* tests/setregid.test: New test.
* tests/.gitignore: Add setregid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setregid.test.
2016-04-20 01:08:12 +00:00
619a96a295 tests: extend test coverage of setreuid32 syscall
* tests/setreuid32.c: New file.
* tests/setreuid32.test: New test.
* tests/.gitignore: Add setreuid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setreuid32.test.
2016-04-20 01:08:12 +00:00
e6d8473850 tests: extend test coverage of setreuid syscall
* tests/setreugid.c: New file.
* tests/setreuid.c: New file.
* tests/setreuid.test: New test.
* tests/.gitignore: Add setreuid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setreuid.test.
(EXTRA_DIST): Add setreugid.c.
2016-04-20 01:08:12 +00:00
6511b2df01 tests: extend test coverage of setgid32 syscall
* tests/setgid32.c: New file.
* tests/setgid32.test: New test.
* tests/.gitignore: Add setgid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setgid32.test.
2016-04-20 01:08:12 +00:00
cf273016fe tests: extend test coverage of setgid syscall
* tests/setgid.c: New file.
* tests/setgid.test: New test.
* tests/.gitignore: Add setgid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setgid.test.
2016-04-20 01:08:12 +00:00
8f0e41afb7 tests: extend test coverage of setuid32 syscall
* tests/setuid32.c: New file.
* tests/setuid32.test: New test.
* tests/.gitignore: Add setuid32.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setuid32.test.
2016-04-20 01:08:12 +00:00