From 5c3fd50a751a93acf5ad7bb69d01261267a53a1e Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Fri, 4 Feb 2011 22:05:20 +0000 Subject: 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. --- tests/fiemap-capable | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/fiemap-capable (limited to 'tests/fiemap-capable') 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) -- cgit v1.2.3-54-g00ecf