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.
This commit is contained in:
Дмитрий Левин 2016-04-18 13:45:36 +00:00
parent 8f0e41afb7
commit cf273016fe
4 changed files with 34 additions and 0 deletions

1
tests/.gitignore vendored
View File

@ -142,6 +142,7 @@ semop
sendfile
sendfile64
set_ptracer_any
setgid
sethostname
setuid
setuid32

View File

@ -192,6 +192,7 @@ check_PROGRAMS = \
sendfile \
sendfile64 \
set_ptracer_any \
setgid \
sethostname \
setuid \
setuid32 \
@ -401,6 +402,7 @@ DECODER_TESTS = \
semop.test \
sendfile.test \
sendfile64.test \
setgid.test \
sethostname.test \
setuid.test \
setuid32.test \

25
tests/setgid.c Normal file
View File

@ -0,0 +1,25 @@
#include "tests.h"
#include <sys/syscall.h>
#ifdef __NR_setgid
# define SYSCALL_NR __NR_setgid
# define SYSCALL_NAME "setgid"
# if defined __NR_setgid32 && __NR_setgid != __NR_setgid32
# 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 "setugid.c"
#else
SKIP_MAIN_UNDEFINED("__NR_setgid")
#endif

6
tests/setgid.test Executable file
View File

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