[PATCH 4/4] tests: add mkdirat.test

Fei Jie feij.fnst at cn.fujitsu.com
Wed Apr 6 06:18:51 UTC 2016


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

diff --git a/tests/.gitignore b/tests/.gitignore
index c488409..ea67040 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -73,6 +73,7 @@ lstat64
 membarrier
 memfd_create
 mincore
+mkdirat
 mknod
 mlock2
 mmap
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c2bb592..3d0b5d1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -122,6 +122,7 @@ check_PROGRAMS = \
 	membarrier \
 	memfd_create \
 	mincore \
+	mkdirat \
 	mknod \
 	mlock2 \
 	mmap \
@@ -317,6 +318,7 @@ DECODER_TESTS = \
 	membarrier.test \
 	memfd_create.test \
 	mincore.test \
+	mkdirat.test \
 	mknod.test \
 	mlock2.test \
 	mmap.test \
diff --git a/tests/mkdirat.c b/tests/mkdirat.c
new file mode 100644
index 0000000..d919b4d
--- /dev/null
+++ b/tests/mkdirat.c
@@ -0,0 +1,29 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_mkdirat
+
+# include <errno.h>
+# include <sys/stat.h>
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char sample[] = "mkdirat.sample";
+	const long int fd = (long int) 0xdeadbeefffffffff;
+	int rc = syscall(__NR_mkdirat, fd, sample, 0600);
+	printf("mkdirat(%d, \"%s\", 0600) = %d %s (%m)\n",
+	       (int) fd, sample, rc,
+	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_mkdirat")
+
+#endif
diff --git a/tests/mkdirat.test b/tests/mkdirat.test
new file mode 100755
index 0000000..e41ce35
--- /dev/null
+++ b/tests/mkdirat.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check mkdirat syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a36
-- 
1.8.3.1







More information about the Strace-devel mailing list