summaryrefslogtreecommitdiff
path: root/tests/fiemap-capable
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2011-02-04 22:05:20 +0000
committerPádraig Brady <P@draigBrady.com>2011-02-08 22:46:25 +0000
commit5c3fd50a751a93acf5ad7bb69d01261267a53a1e (patch)
tree4bfb77b4702a9068f774a9cb9fa9b64e4deec4a3 /tests/fiemap-capable
parent480c0dc9e7c1890b11797c0e7704bd0e2e9821b7 (diff)
downloadcoreutils-5c3fd50a751a93acf5ad7bb69d01261267a53a1e.tar.xz
test: improve the cp fiemap tests
* tests/cp/fiemap-2: Enable the fiemap check for files, which will enable the test for files on ext3. * tests/cp/fiemap-perf: Comment why we're not enabling for ext3. * tests/cp/sparse-fiemap: Ditto. Also sync the files before doing a fiemap which was needed for ext4 loop back at least. Add a comment that FIEMAP_FLAG_SYNC is ineffective, thus requiring the explicit syncs. * tests/fiemap-capable: A new python script to determine if a specified path supports fiemap. * tests/init.cfg (fiemap_capable_): Use the new python script. * tests/Makefile.am (EXTRA_DIST): Include the new python script.
Diffstat (limited to 'tests/fiemap-capable')
-rw-r--r--tests/fiemap-capable16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/fiemap-capable b/tests/fiemap-capable
new file mode 100644
index 000000000..05c6926a7
--- /dev/null
+++ b/tests/fiemap-capable
@@ -0,0 +1,16 @@
+import struct, fcntl, sys, os
+
+def sizeof(t): return struct.calcsize(t)
+IOCPARM_MASK = 0x7f
+IOC_OUT = 0x40000000
+IOC_IN = 0x80000000
+IOC_INOUT = (IOC_IN|IOC_OUT)
+def _IOWR(x,y,t): return (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|y)
+
+try:
+ fd = os.open (len (sys.argv) == 2 and sys.argv[1] or '.', os.O_RDONLY)
+ struct_fiemap = '=qqllll'
+ FS_IOC_FIEMAP = _IOWR (ord ('f'), 11, struct_fiemap)
+ fcntl.ioctl (fd, FS_IOC_FIEMAP, struct.pack(struct_fiemap, 0,~0,0,0,0,0))
+except:
+ sys.exit (1)