summaryrefslogtreecommitdiffstats
path: root/test/big.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2007-04-23 18:57:51 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2007-04-23 18:57:51 (GMT)
commit156f8bc690dfa1ca70d82553c35eeeda4ca7356c (patch)
tree6b84d8fda52c513ceb1ec8c303c1e804a29ce57a /test/big.c
parentf68c5d9849191393ef825508f0cdda56cc0c881d (diff)
downloadhdf5-156f8bc690dfa1ca70d82553c35eeeda4ca7356c.zip
hdf5-156f8bc690dfa1ca70d82553c35eeeda4ca7356c.tar.gz
hdf5-156f8bc690dfa1ca70d82553c35eeeda4ca7356c.tar.bz2
[svn-r13694] 1. changed the HDlseek to be lseek64 and HDfseek to be fseeko if available, to support big
files. 2. added a check in test/big.c to make sure the system supports big file. Tested on smirom because already tested the same changes for v1.6 on liberty, smirom, copper, and sol.
Diffstat (limited to 'test/big.c')
-rw-r--r--test/big.c60
1 files changed, 56 insertions, 4 deletions
diff --git a/test/big.c b/test/big.c
index 026e917..4ae7dff 100644
--- a/test/big.c
+++ b/test/big.c
@@ -31,6 +31,9 @@ const char *FILENAME[] = {
#define WRT_SIZE 4*1024
#define FAMILY_SIZE 1024*1024*1024
+/* Define big file as 2GB */
+#define BIG_FILE 0x80000000UL
+
#define MAX_TRIES 100
#if H5_SIZEOF_LONG_LONG >= 8
@@ -136,6 +139,45 @@ is_sparse(void)
/*-------------------------------------------------------------------------
+ * Function: supports_big
+ *
+ * Purpose: Determines if the file system of the current working
+ * directory supports big files.
+ *
+ * Return: Success: Non-zero if big files are supported; zero
+ * otherwise.
+ *
+ * Failure: zero
+ *
+ * Programmer: Raymond Lu
+ * Wednesday, April 18, 2007
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+supports_big(void)
+{
+ int fd;
+
+ if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666))<0) return 0;
+
+ /* Write a few bytes at 2GB */
+ if (HDlseek(fd, BIG_FILE, SEEK_SET)!=BIG_FILE) return 0;
+ if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
+
+ /* Write a few bytes at 4GB */
+ if (HDlseek(fd, 2*BIG_FILE, SEEK_SET) != 2*BIG_FILE) return 0;
+ if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
+
+ if (HDclose(fd)<0) return 0;
+
+ return (1);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: enough_room
*
* Purpose: Tries to create a bunch of sparse files to see if quotas will
@@ -551,13 +593,24 @@ main (int ac, char **av)
if (writer(filename, fapl, WRT_N)) goto error;
if (reader(filename, fapl)) goto error;
- /* Clean up the test file */
- if (h5_cleanup(FILENAME, fapl)) remove(DNAME);
puts("Test passed with the Family Driver.");
+ /*
+ * We shouldn't run this test if the file system doesn't support big files
+ * because we would generate multi-gigabyte files.
+ */
+ puts("\nChecking if file system supports big files...");
+ if (!supports_big()) {
+ puts("Tests for sec2 and stdio are skipped because file system does not support big files.");
+ usage();
+ goto quit;
+ }
+
+ /* Clean up the test file */
+ if (h5_cleanup(FILENAME, fapl)) remove(DNAME);
/* Test big file with the SEC2 driver */
- puts("\nTesting big file with the SEC2 Driver ");
+ puts("Testing big file with the SEC2 Driver ");
fapl = h5_fileaccess();
if(H5Pset_fapl_sec2(fapl)<0)
@@ -570,7 +623,6 @@ main (int ac, char **av)
puts("Test passed with the SEC2 Driver.");
-
#ifdef H5_HAVE_FSEEKO
/* Clean up the test file */
if (h5_cleanup(FILENAME, fapl)) remove(DNAME);