]> granicus.if.org Git - strace/commitdiff
tests: add testing for FS_IOC_FIEMAP
authorJeff Mahoney <jeffm@suse.com>
Wed, 18 May 2016 22:09:41 +0000 (18:09 -0400)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 24 May 2016 14:52:27 +0000 (14:52 +0000)
This is limited to FIEMAP.  FICLONE* and FIDEDUPERANGE originated in
btrfs and will be tested there.

* tests/file_ioctl.c: New file.
* tests/file_ioctl.test: New test.
* tests/.gitignore: Add file_ioctl.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add file_ioctl.test.

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

index 826aadbb1da1350e9f543a23e5c45f325b476482..c35f2db9e5483ee4eba0d68a89443d6eaf343c5b 100644 (file)
@@ -52,6 +52,7 @@ fcntl
 fcntl64
 fdatasync
 file_handle
+file_ioctl
 filter-unavailable
 flock
 fork-f
index 4aaf7c4badd4a1c02d3a772322eb9c763de4bc53..81ee401d385dd0de21cee97c512a2a52cf1598af 100644 (file)
@@ -107,6 +107,7 @@ check_PROGRAMS = \
        fcntl64 \
        fdatasync \
        file_handle \
+       file_ioctl \
        filter-unavailable \
        flock \
        fork-f \
@@ -398,6 +399,7 @@ DECODER_TESTS = \
        fcntl64.test \
        fdatasync.test \
        file_handle.test \
+       file_ioctl.test \
        flock.test \
        fstat.test \
        fstat64.test \
diff --git a/tests/file_ioctl.c b/tests/file_ioctl.c
new file mode 100644 (file)
index 0000000..3264b90
--- /dev/null
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <linux/fiemap.h>
+#include <linux/fs.h>
+#include "tests.h"
+#include "xlat.h"
+
+#include "xlat/fiemap_flags.h"
+
+static void
+test_fiemap(void)
+{
+       struct fiemap args = {};
+       printf("ioctl(-1, FS_IOC_FIEMAP, {fm_start=%" PRI__u64
+              ", fm_length=%" PRI__u64", fm_flags=",
+              args.fm_start, args.fm_length);
+       printflags(fiemap_flags, args.fm_flags, "FIEMAP_FLAG_???");
+       printf(", fm_extent_count=%u})", args.fm_extent_count);
+       ioctl(-1, FS_IOC_FIEMAP, &args);
+       printf(" = -1 EBADF (%m)\n");
+}
+
+/* clone and dedupe ioctls are in btrfs.c since they originated there */
+
+int
+main(int argc, char *argv[])
+{
+       test_fiemap();
+
+       puts("+++ exited with 0 +++");
+
+       return 0;
+}
diff --git a/tests/file_ioctl.test b/tests/file_ioctl.test
new file mode 100755 (executable)
index 0000000..7b8b8ce
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check FS_IOC_FIEMAP ioctl decoding.
+
+. "${srcdir=.}/ioctl.test"