summaryrefslogtreecommitdiffstats
path: root/test/vfd.c
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/vfd.c
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/vfd.c')
-rw-r--r--test/vfd.c84
1 files changed, 84 insertions, 0 deletions
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",