summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2006-10-10 20:07:16 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2006-10-10 20:07:16 (GMT)
commit65d30cc9c36b782c704daeb4b3f75cdbc7bff680 (patch)
tree58c05fd5f6ef6ee6082acc681599d0ed001c7991 /test
parent176f59f0f4aaadf3c5fe8637b9478a627b43c076 (diff)
downloadhdf5-65d30cc9c36b782c704daeb4b3f75cdbc7bff680.zip
hdf5-65d30cc9c36b782c704daeb4b3f75cdbc7bff680.tar.gz
hdf5-65d30cc9c36b782c704daeb4b3f75cdbc7bff680.tar.bz2
[svn-r12739] Added Direct I/O driver to VFD. It's only supported by SGI Altix (cobalt). There's a configure
option --enable-direct-vfd/--disable-direct-vfd to enable/disable Direct I/O support. The default is enabled. There's a small test in test/vfd.c. Another way to test it is to set environment variable HDF5_DRIVER to "direct" and run "make check" in the test/ directory. There'll be some further improvement in the following checkin including allowing user to provide memory boundary value, file block size, and copying buffer size.
Diffstat (limited to 'test')
-rw-r--r--test/h5test.c5
-rwxr-xr-xtest/reserved.c1
-rw-r--r--test/vfd.c84
3 files changed, 90 insertions, 0 deletions
diff --git a/test/h5test.c b/test/h5test.c
index acc7630..5ca5d13 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -577,6 +577,11 @@ h5_fileaccess(void)
if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
return -1;
+ } else if (!HDstrcmp(name, "direct")) {
+#ifdef H5_HAVE_DIRECT
+ /* Linux direct read() and write() system calls */
+ if (H5Pset_fapl_direct(fapl)<0) return -1;
+#endif
} else {
/* Unknown driver */
return -1;
diff --git a/test/reserved.c b/test/reserved.c
index 769cfb5..8033618 100755
--- a/test/reserved.c
+++ b/test/reserved.c
@@ -54,6 +54,7 @@ rsrv_heap(void)
/* Create a new file. */
fapl = h5_fileaccess();
+
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Set file address sizes to be very small. */
fcpl = H5Pcreate(H5P_FILE_CREATE);
diff --git a/test/vfd.c b/test/vfd.c
index a67f18f..952ed4d 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -33,6 +33,7 @@ const char *FILENAME[] = {
"core_file",
"family_file",
"multi_file",
+ "direct_file",
NULL
};
@@ -118,6 +119,88 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_direct
+ *
+ * Purpose: Tests the file handle interface for DIRECT I/O driver
+ *
+ * Return: Success: exit(0)
+ *
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * Wednesday, 20 September 2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_direct(void)
+{
+#ifdef H5_HAVE_DIRECT
+ hid_t file=(-1), fapl, access_fapl = -1;
+ char filename[1024];
+ int *fhandle=NULL;
+ hsize_t file_size;
+#endif /*H5_HAVE_DIRECT*/
+
+ TESTING("Direct I/O file driver");
+
+#ifndef H5_HAVE_DIRECT
+ SKIPPED();
+ return 0;
+#else /*H5_HAVE_DIRECT*/
+
+ /* Set property list and file name for SEC2 driver. */
+ fapl = h5_fileaccess();
+ if(H5Pset_fapl_direct(fapl)<0)
+ TEST_ERROR;
+ h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
+
+ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ TEST_ERROR;
+
+ /* Retrieve the access property list... */
+ if ((access_fapl = H5Fget_access_plist(file)) < 0)
+ TEST_ERROR;
+
+ /* ...and close the property list */
+ if (H5Pclose(access_fapl) < 0)
+ TEST_ERROR;
+
+ /* Check file handle API */
+ if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle)<0)
+ TEST_ERROR;
+ if(*fhandle<0)
+ TEST_ERROR;
+
+ /* Check file size API */
+ if(H5Fget_filesize(file, &file_size) < 0)
+ TEST_ERROR;
+
+ /* There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable. It's 2KB right now.
+ */
+ if(file_size<1*KB || file_size>4*KB)
+ TEST_ERROR;
+
+ if(H5Fclose(file)<0)
+ TEST_ERROR;
+ h5_cleanup(FILENAME, fapl);
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose (fapl);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return -1;
+#endif /*H5_HAVE_DIRECT*/
+}
+
+
+/*-------------------------------------------------------------------------
* Function: test_core
*
* Purpose: Tests the file handle interface for CORE driver
@@ -736,6 +819,7 @@ main(void)
nerrors += test_family()<0 ?1:0;
nerrors += test_family_compat()<0 ?1:0;
nerrors += test_multi()<0 ?1:0;
+ nerrors += test_direct()<0 ?1:0;
if (nerrors){
printf("***** %d Virtual File Driver TEST%s FAILED! *****\n",