[PATCH 2/4] tests: add setdomainname.test

Fei Jie feij.fnst at cn.fujitsu.com
Mon Apr 25 08:18:21 UTC 2016


* tests/setdomainname.c: New file.
* tests/setdomainname.test: New test.
* tests/.gitignore: Add setdomainname.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setdomainname.test.
---
 tests/.gitignore         |  1 +
 tests/Makefile.am        |  2 ++
 tests/setdomainname.c    | 24 ++++++++++++++++++++++++
 tests/setdomainname.test |  6 ++++++
 4 files changed, 33 insertions(+)
 create mode 100644 tests/setdomainname.c
 create mode 100755 tests/setdomainname.test

diff --git a/tests/.gitignore b/tests/.gitignore
index df8b12f..62425e9 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -166,6 +166,7 @@ semop
 sendfile
 sendfile64
 set_ptracer_any
+setdomainname
 setfsgid
 setfsgid32
 setfsuid
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9dcbbb6..c53bc66 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -217,6 +217,7 @@ check_PROGRAMS = \
 	sendfile \
 	sendfile64 \
 	set_ptracer_any \
+	setdomainname \
 	setfsgid \
 	setfsgid32 \
 	setfsuid \
@@ -464,6 +465,7 @@ DECODER_TESTS = \
 	semop.test \
 	sendfile.test \
 	sendfile64.test \
+	setdomainname.test \
 	setfsgid.test \
 	setfsgid32.test \
 	setfsuid.test \
diff --git a/tests/setdomainname.c b/tests/setdomainname.c
new file mode 100644
index 0000000..1d83ffd
--- /dev/null
+++ b/tests/setdomainname.c
@@ -0,0 +1,24 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setdomainname
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	long rc = syscall(__NR_setdomainname, 0, 63);
+	printf("setdomainname(NULL, 63) = %ld %s (%m)\n",
+	       rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setdomainname")
+
+#endif
diff --git a/tests/setdomainname.test b/tests/setdomainname.test
new file mode 100755
index 0000000..2159e7c
--- /dev/null
+++ b/tests/setdomainname.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setdomainname syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a24
-- 
1.8.3.1







More information about the Strace-devel mailing list