]> granicus.if.org Git - strace/commitdiff
tests: add fstat.test and fstat64.test
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 5 Dec 2015 00:02:44 +0000 (00:02 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 5 Dec 2015 00:02:44 +0000 (00:02 +0000)
* tests/fstat.c: New file.
* tests/fstat64.c: Likewise.
* tests/fstatx.c: Likewise.
* tests/fstat.test: New test.
* tests/fstat64.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add fstat and fstat64.
(fstat64_CFLAGS): Define.
(TESTS): Add fstat.test and fstat64.test.
(EXTRA_DIST): Add fstatx.c.
* tests/.gitignore: Add fstat and fstat64.

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

index 5c5c57215f6c50f767c179e07a03047ecef0675b..ffd3bf6c8b0d6258f6bbba3bf38a5faa73d29013 100644 (file)
@@ -11,6 +11,8 @@ execveat
 fanotify_mark
 file_handle
 filter-unavailable
+fstat
+fstat64
 fstatat64
 ftruncate
 ftruncate64
index 69ffbc2144928d3b33ea9c8783f2cf406bdf6def..fdbf3f081b50d6ab7d78844457eec28ef14d4ade 100644 (file)
@@ -24,6 +24,8 @@ check_PROGRAMS = \
        fanotify_mark \
        file_handle \
        filter-unavailable \
+       fstat \
+       fstat64 \
        fstatat64 \
        ftruncate \
        ftruncate64 \
@@ -106,6 +108,7 @@ check_PROGRAMS = \
 
 clock_xettime_LDADD = -lrt
 filter_unavailable_LDADD = -lpthread
+fstat64_CFLAGS = $(AM_CFLAGS) -D_FILE_OFFSET_BITS=64
 fstatat64_CFLAGS = $(AM_CFLAGS) -D_FILE_OFFSET_BITS=64
 ftruncate64_CFLAGS = $(AM_CFLAGS) -D_FILE_OFFSET_BITS=64
 mmap64_CFLAGS = $(AM_CFLAGS) -D_FILE_OFFSET_BITS=64
@@ -138,6 +141,8 @@ TESTS = \
        fanotify_mark.test \
        file_handle.test \
        filter-unavailable.test \
+       fstat.test \
+       fstat64.test \
        fstatat64.test \
        ftruncate.test \
        ftruncate64.test \
@@ -238,6 +243,7 @@ EXTRA_DIST = init.sh run.sh match.awk \
             fanotify_mark.expected \
             filter-unavailable.expected \
             fstatat.c \
+            fstatx.c \
             ip_mreq.expected \
             ipc.sh \
             ipc_msgbuf.expected \
diff --git a/tests/fstat.c b/tests/fstat.c
new file mode 100644 (file)
index 0000000..b75b550
--- /dev/null
@@ -0,0 +1,13 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <sys/syscall.h>
+
+#undef TEST_SYSCALL_NAME
+#ifdef __NR_fstat
+# define TEST_SYSCALL_NAME fstat
+# define SAMPLE_SIZE ((kernel_ulong_t) 43147718418)
+#endif
+
+#include "fstatx.c"
diff --git a/tests/fstat.test b/tests/fstat.test
new file mode 100755 (executable)
index 0000000..696151b
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Check fstat syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+# strace -P is implemented using /proc/self/fd
+[ -d /proc/self/fd/ ] ||
+       framework_skip_ '/proc/self/fd/ is not available'
+
+syscall=${ME_%.test}
+run_prog > /dev/null
+OUT="$LOG.out"
+sample=$syscall.sample
+> "$sample"
+run_strace -ve$syscall -P$sample $args > "$OUT"
+match_diff "$LOG" "$OUT"
+rm -f "$OUT"
+
+exit 0
diff --git a/tests/fstat64.c b/tests/fstat64.c
new file mode 100644 (file)
index 0000000..e64cf08
--- /dev/null
@@ -0,0 +1,14 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <sys/syscall.h>
+
+#undef TEST_SYSCALL_NAME
+#ifdef __NR_fstat64
+# define TEST_SYSCALL_NAME fstat64
+# define STRUCT_STAT struct stat64
+# define SAMPLE_SIZE ((libc_off_t) 43147718418)
+#endif
+
+#include "fstatx.c"
diff --git a/tests/fstat64.test b/tests/fstat64.test
new file mode 100755 (executable)
index 0000000..8b4f5ef
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check fstat64 syscall decoding.
+
+. "${srcdir=.}/fstat.test"
diff --git a/tests/fstatx.c b/tests/fstatx.c
new file mode 100644 (file)
index 0000000..04bb3a6
--- /dev/null
@@ -0,0 +1,14 @@
+#define TEST_SYSCALL_INVOKE(sample, pst) \
+       syscall(TEST_SYSCALL_NR, 0, pst)
+#define PRINT_SYSCALL_HEADER(sample) \
+       printf("%s(0, ", TEST_SYSCALL_STR)
+#define PRINT_SYSCALL_FOOTER \
+       puts(") = 0")
+
+#define TEST_SYSCALL_NR nrify(TEST_SYSCALL_NAME)
+#define nrify(arg) nrify_(arg)
+#define nrify_(arg) __NR_ ## arg
+
+#define USE_ASM_STAT
+
+#include "xstatx.c"