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.
This commit is contained in:
Дмитрий Левин 2016-04-18 15:22:34 +00:00
parent 2b42d8e32f
commit 4f6d95dd58
4 changed files with 34 additions and 0 deletions

1
tests/.gitignore vendored
View File

@ -147,6 +147,7 @@ setgid32
sethostname
setregid
setregid32
setresgid
setresuid
setresuid32
setreuid

View File

@ -197,6 +197,7 @@ check_PROGRAMS = \
sethostname \
setregid \
setregid32 \
setresgid \
setresuid \
setresuid32 \
setreuid \
@ -414,6 +415,7 @@ DECODER_TESTS = \
sethostname.test \
setregid.test \
setregid32.test \
setresgid.test \
setresuid.test \
setresuid32.test \
setreuid.test \

25
tests/setresgid.c Normal file
View File

@ -0,0 +1,25 @@
#include "tests.h"
#include <sys/syscall.h>
#ifdef __NR_setresgid
# define SYSCALL_NR __NR_setresgid
# define SYSCALL_NAME "setresgid"
# if defined __NR_setresgid32 && __NR_setresgid != __NR_setresgid32
# define UGID_TYPE short
# define GETUGID syscall(__NR_getegid)
# define CHECK_OVERFLOWUGID(arg) check_overflowgid(arg)
# else
# define UGID_TYPE int
# define GETUGID getegid()
# define CHECK_OVERFLOWUGID(arg)
# endif
# include "setresugid.c"
#else
SKIP_MAIN_UNDEFINED("__NR_setresgid")
#endif

6
tests/setresgid.test Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# Check setresgid syscall decoding.
. "${srcdir=.}/init.sh"
run_strace_match_diff -a19