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.
diff --git a/tests/.gitignore b/tests/.gitignore
index 1429c19..cd19268 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -142,6 +142,7 @@
 sendfile
 sendfile64
 set_ptracer_any
+setfsgid
 setfsuid
 setfsuid32
 setgid
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c562f4f..1edd6c4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -192,6 +192,7 @@
 	sendfile \
 	sendfile64 \
 	set_ptracer_any \
+	setfsgid \
 	setfsuid \
 	setfsuid32 \
 	setgid \
@@ -413,6 +414,7 @@
 	semop.test \
 	sendfile.test \
 	sendfile64.test \
+	setfsgid.test \
 	setfsuid.test \
 	setfsuid32.test \
 	setgid.test \
diff --git a/tests/setfsgid.c b/tests/setfsgid.c
new file mode 100644
index 0000000..9f3a279
--- /dev/null
+++ b/tests/setfsgid.c
@@ -0,0 +1,23 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setfsgid
+
+# define SYSCALL_NR	__NR_setfsgid
+# define SYSCALL_NAME	"setfsgid"
+
+# if defined __NR_setfsgid32 && __NR_setfsgid != __NR_setfsgid32
+#  define UGID_TYPE	short
+#  define GETUGID	syscall(__NR_getegid)
+# else
+#  define UGID_TYPE	int
+#  define GETUGID	getegid()
+# endif
+
+# include "setfsugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setfsgid")
+
+#endif
diff --git a/tests/setfsgid.test b/tests/setfsgid.test
new file mode 100755
index 0000000..0ae2b0a
--- /dev/null
+++ b/tests/setfsgid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setfsgid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a12