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.
diff --git a/tests/.gitignore b/tests/.gitignore
index 3c37023..b7b9df7 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -142,6 +142,7 @@
sendfile
sendfile64
set_ptracer_any
+setgid
sethostname
setuid
setuid32
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 592c2b7..4c51f57 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -192,6 +192,7 @@
sendfile \
sendfile64 \
set_ptracer_any \
+ setgid \
sethostname \
setuid \
setuid32 \
@@ -401,6 +402,7 @@
semop.test \
sendfile.test \
sendfile64.test \
+ setgid.test \
sethostname.test \
setuid.test \
setuid32.test \
diff --git a/tests/setgid.c b/tests/setgid.c
new file mode 100644
index 0000000..aa3f898
--- /dev/null
+++ b/tests/setgid.c
@@ -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
diff --git a/tests/setgid.test b/tests/setgid.test
new file mode 100755
index 0000000..a3a9004
--- /dev/null
+++ b/tests/setgid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setgid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a10