From 9f18db936fcb588325bfb63a60a6804972d91d70 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 20 Mar 2012 16:42:38 -0500 Subject: [svn-r22103] Fix for HDFFV-7769 (HDF5 tests time out on Windows when core VFD is set). This occurs due to the istore test creating very large files on systems which do not have POSIX-like sparse file semantics. The large amount of I/O causes the test to run for a very long period of time. The fix was to copy the "big" test's sparse file check and only run the largest sparse file test when POSIX-like sparse file semantics are found. Tested on: jam (nfs) ostrich (nfs) loyalty (ufs) 64-bit linux VM (ext4) 64-bit OS-X Lion (hfs, detected as not POSIX sparse) 64-bit Windows 7 (NTFS, detected as not POSIX sparse) The OS-X failure to pass the sparse check is likely an error and will be entered as a new bug. --- test/istore.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/test/istore.c b/test/istore.c index 3ae8da7..0c970bc 100644 --- a/test/istore.c +++ b/test/istore.c @@ -54,6 +54,42 @@ hsize_t zero[H5O_LAYOUT_NDIMS]; /*------------------------------------------------------------------------- + * Function: is_sparse + * + * Purpose: Determines if the file system of the current working + * directory supports holes. + * + * Return: Success: Non-zero if holes are supported; zero + * otherwise. + * + * Failure: zero + * + * Programmer: Robb Matzke + * Wednesday, July 15, 1998 + * + *------------------------------------------------------------------------- + */ +static int +is_sparse(void) +{ + int fd; + h5_stat_t sb; + + if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0; + if (HDlseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0; + if (5!=HDwrite(fd, "hello", (size_t)5)) return 0; + if (HDclose(fd) < 0) return 0; + if (HDstat("x.h5", &sb) < 0) return 0; + if (HDremove("x.h5") < 0) return 0; +#ifdef H5_HAVE_STAT_ST_BLOCKS + return ((unsigned long)sb.st_blocks*512 < (unsigned long)sb.st_size); +#else + return (0); +#endif +} + + +/*------------------------------------------------------------------------- * Function: print_array * * Purpose: Prints the values in an array @@ -565,6 +601,7 @@ main(int argc, char *argv[]) unsigned size_of_test; unsigned u; /* Local index variable */ char filename[1024]; + int has_sparse_support = 0; /* Parse arguments or assume these tests (`small', `medium' ) */ if (1 == argc) { @@ -598,6 +635,12 @@ main(int argc, char *argv[]) /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); + /* Check to see if the file system supports POSIX-style sparse files. + * Windows NTFS does not, so we want to avoid tests which create + * very large files. + */ + has_sparse_support = is_sparse(); + /* Reset library */ h5_reset(); fapl = h5_fileaccess(); @@ -656,7 +699,10 @@ main(int argc, char *argv[]) status = test_sparse(file, "sparse", (size_t)2000, (size_t)4, (size_t)2, (size_t)3); nerrors += status < 0 ? 1 : 0; } - if (size_of_test & TEST_LARGE) { + if (has_sparse_support && size_of_test & TEST_LARGE) { + /* This test is skipped if there is no POSIX-style sparse file support + * e.g.: Windows NTFS filesystems + */ status = test_sparse(file, "sparse", (size_t)800, (size_t)50, (size_t)50, (size_t)50); nerrors += status < 0 ? 1 : 0; } -- cgit v0.12