[PATCH 3/4] tests: add rmdir.test

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


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

diff --git a/tests/.gitignore b/tests/.gitignore
index 62425e9..4ce2b06 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -145,6 +145,7 @@ recvmsg
 rename
 renameat
 restart_syscall
+rmdir
 rt_sigpending
 rt_sigprocmask
 rt_sigqueueinfo
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c53bc66..92d4310 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -196,6 +196,7 @@ check_PROGRAMS = \
 	rename \
 	renameat\
 	restart_syscall \
+	rmdir \
 	rt_sigpending \
 	rt_sigprocmask \
 	rt_sigqueueinfo \
@@ -445,6 +446,7 @@ DECODER_TESTS = \
 	recvmsg.test \
 	rename.test \
 	renameat.test \
+	rmdir.test \
 	rt_sigpending.test \
 	rt_sigprocmask.test \
 	rt_sigqueueinfo.test \
diff --git a/tests/rmdir.c b/tests/rmdir.c
new file mode 100644
index 0000000..e5a7f1d
--- /dev/null
+++ b/tests/rmdir.c
@@ -0,0 +1,25 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_rmdir
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char sample[] = "rmdir_sample";
+	long rc = syscall(__NR_rmdir, sample);
+	printf("rmdir(\"%s\") = %ld %s (%m)\n",
+	       sample, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_rmdir")
+
+#endif
diff --git a/tests/rmdir.test b/tests/rmdir.test
new file mode 100755
index 0000000..81ee66b
--- /dev/null
+++ b/tests/rmdir.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check rmdir syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a22
-- 
1.8.3.1







More information about the Strace-devel mailing list