]> granicus.if.org Git - strace/commitdiff
tests: add mkdir.test
authorFei Jie <feij.fnst@cn.fujitsu.com>
Thu, 21 Apr 2016 07:53:49 +0000 (15:53 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Apr 2016 17:34:38 +0000 (17:34 +0000)
* tests/mkdir.c: New file.
* tests/mkdir.test: New test.
* tests/.gitignore: Add mkdir.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mkdir.test.

tests/.gitignore
tests/Makefile.am
tests/mkdir.c [new file with mode: 0644]
tests/mkdir.test [new file with mode: 0755]

index d89e9e6d625e582677837e32f09e1706d22a68b8..237efa663fc6202f7b569fd30c78288aa0ed4355 100644 (file)
@@ -99,6 +99,7 @@ lstat64
 membarrier
 memfd_create
 mincore
+mkdir
 mkdirat
 mknod
 mlock2
index 7662a6d832ffed6d0cbaa868ed1b6d4e73944170..919630e372574561be103397c2fa4f4f9f0ca1fa 100644 (file)
@@ -150,6 +150,7 @@ check_PROGRAMS = \
        membarrier \
        memfd_create \
        mincore \
+       mkdir \
        mkdirat \
        mknod \
        mlock2 \
@@ -395,6 +396,7 @@ DECODER_TESTS = \
        membarrier.test \
        memfd_create.test \
        mincore.test \
+       mkdir.test \
        mkdirat.test \
        mknod.test \
        mlock2.test \
diff --git a/tests/mkdir.c b/tests/mkdir.c
new file mode 100644 (file)
index 0000000..0a810c1
--- /dev/null
@@ -0,0 +1,27 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_mkdir
+
+# include <errno.h>
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+       static const char sample[] = "mkdir";
+
+       long rc = syscall(__NR_mkdir, sample, 0600);
+       printf("mkdir(\"%s\", 0600) = %ld %s (%m)\n",
+              sample, rc, errno == ENOSYS ? "ENOSYS" : "EEXIST");
+
+       puts("+++ exited with 0 +++");
+       return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_mkdir")
+
+#endif
diff --git a/tests/mkdir.test b/tests/mkdir.test
new file mode 100755 (executable)
index 0000000..98d5a52
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check mkdir syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a21