[PATCH 2/5] tests: add unlink.test

Fei Jie feij.fnst at cn.fujitsu.com
Tue Apr 26 08:03:08 UTC 2016


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

diff --git a/tests/.gitignore b/tests/.gitignore
index 88dd092..72a2e1d 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -226,6 +226,7 @@ umovestr
 umovestr2
 uname
 unix-pair-send-recv
+unlink
 unlinkat
 userfaultfd
 utime
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 067310f..1baf45b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -278,6 +278,7 @@ check_PROGRAMS = \
 	umovestr2 \
 	uname \
 	unix-pair-send-recv \
+	unlink \
 	unlinkat \
 	userfaultfd \
 	utime \
@@ -530,6 +531,7 @@ DECODER_TESTS = \
 	umovestr.test \
 	umovestr2.test \
 	uname.test \
+	unlink.test \
 	unlinkat.test \
 	userfaultfd.test \
 	utime.test \
diff --git a/tests/unlink.c b/tests/unlink.c
new file mode 100644
index 0000000..f5a1a1a
--- /dev/null
+++ b/tests/unlink.c
@@ -0,0 +1,26 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_unlink
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char sample[] = "unlink_sample";
+
+	long rc = syscall(__NR_unlink, sample);
+	printf("unlink(\"%s\") = %ld %s (%m)\n",
+	       sample, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_unlink")
+
+#endif
diff --git a/tests/unlink.test b/tests/unlink.test
new file mode 100755
index 0000000..09bf79a
--- /dev/null
+++ b/tests/unlink.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check unlink syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a24
-- 
1.8.3.1







More information about the Strace-devel mailing list