summaryrefslogtreecommitdiffstats
path: root/test/istore.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2012-03-26 20:44:47 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2012-03-26 20:44:47 (GMT)
commitdb1dedef500f358f6e2451f4775de11371749355 (patch)
tree0f0ee70e2c702be3614c7eeaa0ccfafd378b7a34 /test/istore.c
parent35a903680e19430f0206f4aefcd9ff28a852ff1a (diff)
downloadhdf5-db1dedef500f358f6e2451f4775de11371749355.zip
hdf5-db1dedef500f358f6e2451f4775de11371749355.tar.gz
hdf5-db1dedef500f358f6e2451f4775de11371749355.tar.bz2
[svn-r22150] Merged trunk rev 22103 which fixes HDFFV-7769 (Windows tests time out when the core VFD is set).
Tested on: jam, koala, ostrich, loyalty, 64-bit Windows 7
Diffstat (limited to 'test/istore.c')
-rw-r--r--test/istore.c48
1 files changed, 47 insertions, 1 deletions
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;
}