]> granicus.if.org Git - strace/commitdiff
tests: add mknod.test
authorFei Jie <feij.fnst@cn.fujitsu.com>
Fri, 25 Mar 2016 09:47:13 +0000 (17:47 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 25 Mar 2016 09:47:13 +0000 (09:47 +0000)
* tests/mknod.c: New file.
* tests/mknod.test: New test.
* tests/.gitignore: Add mknod.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mknod.test.

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

index 60b642f4bc01570dff7260693c9cb1dc0925b067..3cc5ca5563e0c6c9b71088aad56c10ffeee8c77b 100644 (file)
@@ -65,6 +65,7 @@ lstat64
 membarrier
 memfd_create
 mincore
+mknod
 mlock2
 mmap
 mmap64
index 06b385453a0f79b9e2fb6df603c22c02287fb19a..f8e4aaf16ddb159c18462afb28c2a084fae4a806 100644 (file)
@@ -114,6 +114,7 @@ check_PROGRAMS = \
        membarrier \
        memfd_create \
        mincore \
+       mknod \
        mlock2 \
        mmap \
        mmap64 \
@@ -282,6 +283,7 @@ DECODER_TESTS = \
        membarrier.test \
        memfd_create.test \
        mincore.test \
+       mknod.test \
        mlock2.test \
        mmap.test \
        mmap64.test \
diff --git a/tests/mknod.c b/tests/mknod.c
new file mode 100644 (file)
index 0000000..7e80582
--- /dev/null
@@ -0,0 +1,29 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_mknod
+
+# include <errno.h>
+# include <stdio.h>
+# include <sys/stat.h>
+# include <unistd.h>
+
+# define TMP_FILE "mknod"
+
+int
+main(void)
+{
+       int rc = syscall(__NR_mknod, TMP_FILE, S_IFREG|0600, 0);
+       printf("mknod(\"%s\", S_IFREG|0600) = %d %s (%m)\n",
+              TMP_FILE, rc,
+              errno == ENOSYS ? "ENOSYS" : "EEXIST");
+
+       puts("+++ exited with 0 +++");
+       return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_mknod")
+
+#endif
diff --git a/tests/mknod.test b/tests/mknod.test
new file mode 100755 (executable)
index 0000000..a780353
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Check mknod syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+OUT="$LOG.out"
+run_strace -emknod -a29 $args > "$OUT"
+match_diff "$LOG" "$OUT"
+rm -f "$OUT"