[PATCH v2] tests: add getsid.test

Fei Jie feij.fnst at cn.fujitsu.com
Wed Apr 20 08:17:22 UTC 2016


* 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.
---
 tests/.gitignore  |  1 +
 tests/Makefile.am |  2 ++
 tests/getsid.c    | 23 +++++++++++++++++++++++
 tests/getsid.test |  6 ++++++
 4 files changed, 32 insertions(+)
 create mode 100644 tests/getsid.c
 create mode 100755 tests/getsid.test

diff --git a/tests/.gitignore b/tests/.gitignore
index 2f5f95e..d89e9e6 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -73,6 +73,7 @@ getresgid32
 getresuid
 getresuid32
 getrusage
+getsid
 getuid
 getuid32
 getxxid
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 295d221..49e4a8b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -125,6 +125,7 @@ check_PROGRAMS = \
 	getresuid \
 	getresuid32 \
 	getrusage \
+	getsid \
 	getuid \
 	getuid32 \
 	getxxid \
@@ -370,6 +371,7 @@ DECODER_TESTS = \
 	getresuid.test \
 	getresuid32.test \
 	getrusage.test \
+	getsid.test \
 	getuid.test \
 	getuid32.test \
 	getxxid.test \
diff --git a/tests/getsid.c b/tests/getsid.c
new file mode 100644
index 0000000..fbe1a56
--- /dev/null
+++ b/tests/getsid.c
@@ -0,0 +1,23 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getsid
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+   pid_t pid = getpid();;
+   printf("getsid(%d) = %d\n", pid, getsid(pid));
+
+   puts("+++ exited with 0 +++");
+   return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getsid")
+
+#endif
diff --git a/tests/getsid.test b/tests/getsid.test
new file mode 100755
index 0000000..3fcf979
--- /dev/null
+++ b/tests/getsid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check getsid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a10
-- 
1.8.3.1







More information about the Strace-devel mailing list