2005-06-24 22:32:05 +08:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* Copyright by The HDF Group. *
|
2005-06-24 22:32:05 +08:00
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
|
* All rights reserved. *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
2017-04-15 00:54:16 +08:00
|
|
|
|
* the COPYING file, which can be found at the root of the source code *
|
|
|
|
|
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
|
|
|
|
|
* If you do not have access to either file, you may request a copy from *
|
|
|
|
|
* help@hdfgroup.org. *
|
2005-06-24 22:32:05 +08:00
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
/*
|
|
|
|
|
* Programmer: Raymond Lu<slu@ncsa.uiuc.edu>
|
|
|
|
|
* Tuesday, Sept 24, 2002
|
|
|
|
|
*
|
2005-06-24 22:32:05 +08:00
|
|
|
|
* Purpose: Tests the basic features of Virtual File Drivers
|
|
|
|
|
*/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
#include "h5test.h"
|
|
|
|
|
|
2007-04-05 03:59:00 +08:00
|
|
|
|
#define KB 1024U
|
2005-06-24 22:32:05 +08:00
|
|
|
|
#define FAMILY_NUMBER 4
|
|
|
|
|
#define FAMILY_SIZE (1*KB)
|
|
|
|
|
#define FAMILY_SIZE2 (5*KB)
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#define MULTI_SIZE 128
|
2016-07-06 09:40:31 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
#define CORE_INCREMENT (4*KB)
|
2016-07-06 09:40:31 +08:00
|
|
|
|
#define CORE_PAGE_SIZE (1024*KB)
|
|
|
|
|
#define CORE_DSET_NAME "core dset"
|
|
|
|
|
#define CORE_DSET_DIM1 1024
|
|
|
|
|
#define CORE_DSET_DIM2 32
|
|
|
|
|
|
2013-02-02 09:53:32 +08:00
|
|
|
|
#define DSET1_NAME "dset1"
|
|
|
|
|
#define DSET1_DIM1 1024
|
|
|
|
|
#define DSET1_DIM2 32
|
|
|
|
|
#define DSET3_NAME "dset3"
|
2006-10-29 05:11:04 +08:00
|
|
|
|
|
2013-02-02 09:53:32 +08:00
|
|
|
|
/* Macros for Direct VFD */
|
|
|
|
|
#ifdef H5_HAVE_DIRECT
|
2011-04-09 05:31:31 +08:00
|
|
|
|
#define MBOUNDARY 512
|
|
|
|
|
#define FBSIZE (4*KB)
|
|
|
|
|
#define CBSIZE (8*KB)
|
|
|
|
|
#define THRESHOLD 1
|
|
|
|
|
#define DSET2_NAME "dset2"
|
|
|
|
|
#define DSET2_DIM 4
|
2013-02-02 09:53:32 +08:00
|
|
|
|
#endif /* H5_HAVE_DIRECT */
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
const char *FILENAME[] = {
|
2011-04-09 05:31:31 +08:00
|
|
|
|
"sec2_file", /*0*/
|
|
|
|
|
"core_file", /*1*/
|
|
|
|
|
"family_file", /*2*/
|
|
|
|
|
"new_family_v16_", /*3*/
|
|
|
|
|
"multi_file", /*4*/
|
|
|
|
|
"direct_file", /*5*/
|
|
|
|
|
"log_file", /*6*/
|
|
|
|
|
"stdio_file", /*7*/
|
|
|
|
|
"windows_file", /*8*/
|
2011-06-22 23:47:57 +08:00
|
|
|
|
"new_multi_file_v16",/*9*/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
NULL
|
2005-06-24 22:32:05 +08:00
|
|
|
|
};
|
2009-04-17 23:52:38 +08:00
|
|
|
|
|
2011-04-09 05:31:31 +08:00
|
|
|
|
#define LOG_FILENAME "log_vfd_out.log"
|
|
|
|
|
|
2007-12-14 02:17:02 +08:00
|
|
|
|
#define COMPAT_BASENAME "family_v16_"
|
2011-06-22 23:47:57 +08:00
|
|
|
|
#define MULTI_COMPAT_BASENAME "multi_file_v16"
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2005-08-14 04:53:35 +08:00
|
|
|
|
* Function: test_sec2
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: Tests the file handle interface for SEC2 driver
|
|
|
|
|
*
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*
|
|
|
|
|
* Programmer: Raymond Lu
|
|
|
|
|
* Tuesday, Sept 24, 2002
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2005-06-24 22:32:05 +08:00
|
|
|
|
test_sec2(void)
|
|
|
|
|
{
|
2016-07-06 09:40:31 +08:00
|
|
|
|
hid_t fid = -1; /* file ID */
|
|
|
|
|
hid_t fapl_id = -1; /* file access property list ID */
|
|
|
|
|
hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
|
2017-06-01 05:45:41 +08:00
|
|
|
|
hid_t driver_id = -1; /* ID for this VFD */
|
|
|
|
|
unsigned long driver_flags = 0; /* VFD feature flags */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
char filename[1024]; /* filename */
|
|
|
|
|
void *os_file_handle = NULL; /* OS file handle */
|
|
|
|
|
hsize_t file_size; /* file size */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
TESTING("SEC2 file driver");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
/* Set property list and file name for SEC2 driver. */
|
2016-07-14 21:55:50 +08:00
|
|
|
|
if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5Pset_fapl_sec2(fapl_id) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2017-06-01 05:45:41 +08:00
|
|
|
|
/* Check that the VFD feature flags are correct */
|
|
|
|
|
if ((driver_id = H5Pget_driver(fapl_id)) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) TEST_ERROR
|
|
|
|
|
/* Check for extra flags not accounted for above */
|
|
|
|
|
if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
|
|
|
|
|
| H5FD_FEAT_ACCUMULATE_METADATA
|
|
|
|
|
| H5FD_FEAT_DATA_SIEVE
|
|
|
|
|
| H5FD_FEAT_AGGREGATE_SMALLDATA
|
|
|
|
|
| H5FD_FEAT_POSIX_COMPAT_HANDLE
|
|
|
|
|
| H5FD_FEAT_SUPPORTS_SWMR_IO
|
|
|
|
|
| H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Retrieve the access property list... */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if((fapl_id_out = H5Fget_access_plist(fid)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
/* Check that the driver is correct */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5FD_SEC2 != H5Pget_driver(fapl_id_out))
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* ...and close the property list */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5Pclose(fapl_id_out) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Check that we can get an operating-system-specific handle from
|
|
|
|
|
* the library.
|
|
|
|
|
*/
|
|
|
|
|
if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(os_file_handle == NULL)
|
|
|
|
|
FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle");
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* There is no garantee the size of metadata in file is constant.
|
|
|
|
|
* Just try to check if it's reasonable.
|
|
|
|
|
*
|
|
|
|
|
* Currently it should be around 2 KB.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*/
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5Fget_filesize(fid, &file_size) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
if(file_size < 1 * KB || file_size > 4 * KB)
|
2016-07-06 09:40:31 +08:00
|
|
|
|
FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close and delete the file */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5Fclose(fid) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_delete_test_file(FILENAME[0], fapl_id);
|
|
|
|
|
|
|
|
|
|
/* Close the fapl */
|
|
|
|
|
if(H5Pclose(fapl_id) < 0)
|
|
|
|
|
TEST_ERROR;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
PASSED();
|
|
|
|
|
return 0;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
error:
|
|
|
|
|
H5E_BEGIN_TRY {
|
2016-07-06 09:40:31 +08:00
|
|
|
|
H5Pclose(fapl_id);
|
|
|
|
|
H5Pclose(fapl_id_out);
|
|
|
|
|
H5Fclose(fid);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
return -1;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
} /* end test_sec2() */
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2006-10-11 04:07:16 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2015-09-14 11:58:59 +08:00
|
|
|
|
* Function: test_core
|
2006-10-11 04:07:16 +08:00
|
|
|
|
*
|
2015-09-14 11:58:59 +08:00
|
|
|
|
* Purpose: Tests the file handle interface for CORE driver
|
2006-10-11 04:07:16 +08:00
|
|
|
|
*
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
2006-10-11 04:07:16 +08:00
|
|
|
|
*
|
|
|
|
|
* Programmer: Raymond Lu
|
2015-09-14 11:58:59 +08:00
|
|
|
|
* Tuesday, Sept 24, 2002
|
2006-10-11 04:07:16 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
2015-09-14 11:58:59 +08:00
|
|
|
|
test_core(void)
|
2006-10-11 04:07:16 +08:00
|
|
|
|
{
|
2016-07-06 09:40:31 +08:00
|
|
|
|
hid_t fid = -1; /* file ID */
|
|
|
|
|
hid_t fapl_id = -1; /* file access property list ID */
|
|
|
|
|
hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
|
2017-06-01 05:45:41 +08:00
|
|
|
|
hid_t driver_id = -1; /* ID for this VFD */
|
|
|
|
|
unsigned long driver_flags = 0; /* VFD feature flags */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
hid_t did = -1; /* dataset ID */
|
|
|
|
|
hid_t sid = -1; /* dataspace ID */
|
|
|
|
|
char filename[1024]; /* filename */
|
|
|
|
|
void *os_file_handle = NULL; /* OS file handle */
|
|
|
|
|
hsize_t file_size; /* file size */
|
|
|
|
|
size_t increment; /* core VFD increment */
|
|
|
|
|
hbool_t backing_store; /* use backing store? */
|
|
|
|
|
hbool_t use_write_tracking; /* write tracking flag */
|
|
|
|
|
size_t write_tracking_page_size; /* write tracking page size */
|
|
|
|
|
int *data_w = NULL; /* data written to the dataset */
|
|
|
|
|
int *data_r = NULL; /* data read from the dataset */
|
|
|
|
|
int val; /* data value */
|
|
|
|
|
int *pw = NULL, *pr = NULL; /* pointers for iterating over
|
|
|
|
|
data arrays (write & read) */
|
|
|
|
|
hsize_t dims[2]; /* dataspace dimensions */
|
|
|
|
|
int i, j; /* iterators */
|
|
|
|
|
htri_t status; /* return value from H5Lexists */
|
2006-10-11 04:07:16 +08:00
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
TESTING("CORE file driver");
|
2006-10-11 04:07:16 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Get a file access property list and fix up the file name */
|
2016-07-09 14:43:11 +08:00
|
|
|
|
if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename));
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
|
* Check that the backing store flag works by creating a file, close
|
|
|
|
|
* it, and ensure that the file does not exist.
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Make sure it's not present at the start of the test */
|
|
|
|
|
if(HDaccess(filename, F_OK) != -1)
|
|
|
|
|
if(HDremove(filename) < 0)
|
|
|
|
|
FAIL_PUTS_ERROR("unable to remove backing store file");
|
2017-06-01 05:45:41 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Create and close file w/ backing store off */
|
|
|
|
|
if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2017-06-01 05:45:41 +08:00
|
|
|
|
|
|
|
|
|
/* Check that the VFD feature flags are correct.
|
|
|
|
|
* Note that the H5FDdriver_query() API call does not require a file
|
|
|
|
|
* so backing-store related flags will not be returned here.
|
|
|
|
|
*/
|
|
|
|
|
if ((driver_id = H5Pget_driver(fapl_id)) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS)) TEST_ERROR
|
|
|
|
|
/* Check for extra flags not accounted for above */
|
|
|
|
|
if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
|
|
|
|
|
| H5FD_FEAT_ACCUMULATE_METADATA
|
|
|
|
|
| H5FD_FEAT_DATA_SIEVE
|
|
|
|
|
| H5FD_FEAT_AGGREGATE_SMALLDATA
|
|
|
|
|
| H5FD_FEAT_ALLOW_FILE_IMAGE
|
|
|
|
|
| H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS))
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5Fclose(fid) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Check for the backing store file */
|
|
|
|
|
if(HDaccess(filename, F_OK) != -1)
|
|
|
|
|
FAIL_PUTS_ERROR("file created when backing store set to FALSE");
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
|
* Check basic core VFD operation and properties. This is done with the
|
|
|
|
|
* backing store on so a file will be created for later use.
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Turn the backing store on */
|
|
|
|
|
if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
|
|
|
|
|
/* Check that write tracking is off by default and that the default
|
|
|
|
|
* page size is non-zero.
|
|
|
|
|
*/
|
|
|
|
|
if(H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(FALSE != use_write_tracking)
|
|
|
|
|
FAIL_PUTS_ERROR("write tracking should be off by default");
|
|
|
|
|
if(0 == write_tracking_page_size)
|
|
|
|
|
FAIL_PUTS_ERROR("write tracking page size should never be zero");
|
2006-10-19 04:20:32 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Set core VFD properties */
|
|
|
|
|
if(H5Pset_core_write_tracking(fapl_id, TRUE, CORE_PAGE_SIZE) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
|
|
|
|
|
/* Create the file */
|
|
|
|
|
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2008-09-16 23:52:51 +08:00
|
|
|
|
|
2006-10-11 04:07:16 +08:00
|
|
|
|
/* Retrieve the access property list... */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if((fapl_id_out = H5Fget_access_plist(fid)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2006-10-11 04:07:16 +08:00
|
|
|
|
|
2011-04-09 05:31:31 +08:00
|
|
|
|
/* Check that the driver is correct */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5FD_CORE != H5Pget_driver(fapl_id_out))
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
|
|
|
|
|
/* Get the basic VFD properties from the fapl and ensure that
|
|
|
|
|
* they are correct.
|
|
|
|
|
*/
|
|
|
|
|
if(H5Pget_fapl_core(fapl_id_out, &increment, &backing_store) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(increment != (size_t)CORE_INCREMENT)
|
|
|
|
|
FAIL_PUTS_ERROR("incorrect increment from file fapl");
|
|
|
|
|
if(backing_store != TRUE)
|
|
|
|
|
FAIL_PUTS_ERROR("incorrect backing store flag from file fapl");
|
2015-09-14 11:58:59 +08:00
|
|
|
|
|
|
|
|
|
/* Check that the backing store write tracking info was saved */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* TODO: There is a bug where H5Fget_access_plist() does not return
|
|
|
|
|
* the write tracking properties. Until this bug is fixed, just
|
|
|
|
|
* test the main fapl_id.
|
|
|
|
|
*/
|
|
|
|
|
if(H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(TRUE != use_write_tracking)
|
2016-07-06 09:40:31 +08:00
|
|
|
|
FAIL_PUTS_ERROR("write tracking flag incorrect in fapl obtained from H5Fget_access_plist");
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(CORE_PAGE_SIZE != write_tracking_page_size)
|
2016-07-06 09:40:31 +08:00
|
|
|
|
FAIL_PUTS_ERROR("write tracking page size incorrect in fapl obtained from H5Fget_access_plist");
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Close the property list */
|
|
|
|
|
if(H5Pclose(fapl_id_out) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2006-10-11 04:07:16 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Check that we can get an operating-system-specific handle from
|
|
|
|
|
* the library.
|
|
|
|
|
*/
|
|
|
|
|
if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(os_file_handle == NULL)
|
|
|
|
|
FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle");
|
2006-10-11 04:07:16 +08:00
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
/* There is no garantee the size of metadata in file is constant.
|
2016-07-06 09:40:31 +08:00
|
|
|
|
* Just try to check if it's reasonable.
|
|
|
|
|
*
|
|
|
|
|
* TODO: Needs justification of why is this is a reasonable size.
|
2006-10-11 04:07:16 +08:00
|
|
|
|
*/
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5Fget_filesize(fid, &file_size) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(file_size < 2 * KB || file_size > 6 * KB)
|
|
|
|
|
FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
|
2006-10-11 04:07:16 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Close the file */
|
|
|
|
|
if(H5Fclose(fid) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
|
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/************************************************************************
|
|
|
|
|
* Make changes to the file with the backing store flag OFF to ensure
|
|
|
|
|
* that they ARE NOT propagated.
|
|
|
|
|
************************************************************************/
|
2015-09-14 11:58:59 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Open the file with backing store off for read and write.
|
|
|
|
|
* Changes won't be saved in file.
|
|
|
|
|
*/
|
|
|
|
|
if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
|
|
|
|
|
/* Allocate memory for data set. */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(NULL == (data_w = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
|
|
|
|
|
FAIL_PUTS_ERROR("unable to allocate memory for input array");
|
|
|
|
|
if(NULL == (data_r = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
|
|
|
|
|
FAIL_PUTS_ERROR("unable to allocate memory for output array");
|
|
|
|
|
|
|
|
|
|
/* Initialize the buffers */
|
|
|
|
|
val = 0;
|
|
|
|
|
pw = data_w;
|
|
|
|
|
for(i = 0; i < CORE_DSET_DIM1; i++)
|
|
|
|
|
for(j = 0; j < CORE_DSET_DIM2; j++)
|
|
|
|
|
*pw++ = val++;
|
|
|
|
|
HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
|
|
|
|
|
|
|
|
|
|
/* Create the dataspace */
|
|
|
|
|
dims[0] = CORE_DSET_DIM1;
|
|
|
|
|
dims[1] = CORE_DSET_DIM2;
|
|
|
|
|
if((sid = H5Screate_simple(2, dims, NULL)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
|
|
|
|
|
/* Create the dataset */
|
|
|
|
|
if((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
|
|
|
|
|
/* Write the data to the dataset */
|
|
|
|
|
if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
|
|
|
|
|
/* Close and reopen the dataset */
|
|
|
|
|
if(H5Dclose(did) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2006-10-29 05:11:04 +08:00
|
|
|
|
|
|
|
|
|
/* Read the data back from dset1 */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2006-10-29 05:11:04 +08:00
|
|
|
|
|
|
|
|
|
/* Check that the values read are the same as the values written */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
pw = data_w;
|
|
|
|
|
pr = data_r;
|
|
|
|
|
for(i = 0; i < CORE_DSET_DIM1; i++)
|
|
|
|
|
for(j = 0; j < CORE_DSET_DIM2; j++)
|
|
|
|
|
if(*pr++ != *pw++) {
|
2013-02-02 09:53:32 +08:00
|
|
|
|
H5_FAILED();
|
2016-07-06 09:40:31 +08:00
|
|
|
|
printf(" Read different values than written in data set.\n");
|
2013-02-02 09:53:32 +08:00
|
|
|
|
printf(" At index %d,%d\n", i, j);
|
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
} /* end if */
|
2006-10-29 05:11:04 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Close everything except the dataspace ID (needed below)*/
|
|
|
|
|
if(H5Dclose(did) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5Fclose(fid) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2006-10-29 05:11:04 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Reopen the file and ensure that the dataset does not exist */
|
|
|
|
|
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
status = H5Lexists(fid, CORE_DSET_NAME, H5P_DEFAULT);
|
|
|
|
|
if(status < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(status > 0)
|
|
|
|
|
FAIL_PUTS_ERROR("core VFD dataset created in file when backing store disabled");
|
2015-09-14 11:58:59 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Close the file */
|
|
|
|
|
if(H5Fclose(fid) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
|
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/************************************************************************
|
|
|
|
|
* Make changes to the file with the backing store flag ON to ensure
|
|
|
|
|
* that they ARE propagated.
|
|
|
|
|
************************************************************************/
|
2006-10-29 05:11:04 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Open the file with backing store on for read and write.
|
|
|
|
|
* Changes will be saved in file.
|
|
|
|
|
*/
|
|
|
|
|
if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
|
|
|
|
|
/* Create the dataset */
|
|
|
|
|
if((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
|
|
|
|
|
/* Write the data to the dataset */
|
|
|
|
|
if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
|
|
|
|
|
/* Close everything and reopen */
|
|
|
|
|
if(H5Dclose(did) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5Fclose(fid) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Read the data back from the dataset */
|
|
|
|
|
HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
|
|
|
|
|
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2006-10-29 05:11:04 +08:00
|
|
|
|
|
|
|
|
|
/* Check that the values read are the same as the values written */
|
2016-07-06 09:40:31 +08:00
|
|
|
|
pw = data_w;
|
|
|
|
|
pr = data_r;
|
|
|
|
|
for(i = 0; i < CORE_DSET_DIM1; i++)
|
|
|
|
|
for(j = 0; j < CORE_DSET_DIM2; j++)
|
|
|
|
|
if(*pw++ != *pr++) {
|
2015-09-14 11:58:59 +08:00
|
|
|
|
H5_FAILED();
|
2016-07-06 09:40:31 +08:00
|
|
|
|
printf(" Read different values than written in data set.\n");
|
2015-09-14 11:58:59 +08:00
|
|
|
|
printf(" At index %d,%d\n", i, j);
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
} /* end if */
|
2006-10-29 05:11:04 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Check file size API.
|
|
|
|
|
* There is no garantee the size of metadata in file is constant.
|
|
|
|
|
* Just try to check if it's reasonable.
|
|
|
|
|
*
|
|
|
|
|
* TODO: Needs justification of why is this is a reasonable size.
|
|
|
|
|
*/
|
|
|
|
|
if(H5Fget_filesize(fid, &file_size) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(file_size < 64 * KB || file_size > 256 * KB)
|
|
|
|
|
FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
|
2015-09-14 11:58:59 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
/* Close everything */
|
|
|
|
|
if(H5Sclose(sid) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(H5Dclose(did) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
HDfree(data_w);
|
|
|
|
|
HDfree(data_r);
|
2006-10-29 05:11:04 +08:00
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close and delete the file */
|
|
|
|
|
if(H5Fclose(fid) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
h5_delete_test_file(FILENAME[1], fapl_id);
|
|
|
|
|
|
|
|
|
|
/* Close the fapl */
|
|
|
|
|
if(H5Pclose(fapl_id) < 0)
|
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
|
2006-10-11 04:07:16 +08:00
|
|
|
|
PASSED();
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
H5E_BEGIN_TRY {
|
2016-07-06 09:40:31 +08:00
|
|
|
|
H5Sclose(sid);
|
|
|
|
|
H5Dclose(did);
|
|
|
|
|
H5Pclose(fapl_id_out);
|
|
|
|
|
H5Pclose(fapl_id);
|
|
|
|
|
H5Fclose(fid);
|
2006-10-11 04:07:16 +08:00
|
|
|
|
} H5E_END_TRY;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
|
2016-07-06 09:40:31 +08:00
|
|
|
|
if(data_w)
|
|
|
|
|
HDfree(data_w);
|
|
|
|
|
if(data_r)
|
|
|
|
|
HDfree(data_r);
|
2013-02-02 09:53:32 +08:00
|
|
|
|
|
2006-10-11 04:07:16 +08:00
|
|
|
|
return -1;
|
2016-07-06 09:40:31 +08:00
|
|
|
|
} /* end test_core() */
|
2006-10-11 04:07:16 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2015-09-14 11:58:59 +08:00
|
|
|
|
* Function: test_direct
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*
|
2015-09-14 11:58:59 +08:00
|
|
|
|
* Purpose: Tests the file handle interface for DIRECT I/O driver
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*
|
2005-06-24 22:32:05 +08:00
|
|
|
|
* Programmer: Raymond Lu
|
2015-09-14 11:58:59 +08:00
|
|
|
|
* Wednesday, 20 September 2006
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
2015-09-14 11:58:59 +08:00
|
|
|
|
test_direct(void)
|
2005-06-24 22:32:05 +08:00
|
|
|
|
{
|
2015-09-14 11:58:59 +08:00
|
|
|
|
#ifdef H5_HAVE_DIRECT
|
2016-08-20 00:30:05 +08:00
|
|
|
|
hid_t file=-1, fapl=-1, access_fapl = -1;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
hid_t dset1=-1, dset2=-1, space1=-1, space2=-1;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
char filename[1024];
|
2015-09-14 11:58:59 +08:00
|
|
|
|
int *fhandle=NULL;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
hsize_t file_size;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
hsize_t dims1[2], dims2[1];
|
|
|
|
|
size_t mbound;
|
|
|
|
|
size_t fbsize;
|
|
|
|
|
size_t cbsize;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
int *points = NULL, *check = NULL, *p1 = NULL, *p2 = NULL;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
int wdata2[DSET2_DIM] = {11,12,13,14};
|
|
|
|
|
int rdata2[DSET2_DIM];
|
2011-09-07 00:50:32 +08:00
|
|
|
|
int i, j, n;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
#endif /*H5_HAVE_DIRECT*/
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
TESTING("DIRECT I/O file driver");
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
#ifndef H5_HAVE_DIRECT
|
|
|
|
|
SKIPPED();
|
|
|
|
|
return 0;
|
|
|
|
|
#else /*H5_HAVE_DIRECT*/
|
|
|
|
|
|
|
|
|
|
/* Set property list and file name for Direct driver. Set memory alignment boundary
|
|
|
|
|
* and file block size to 512 which is the minimum for Linux 2.6. */
|
2016-08-20 00:30:05 +08:00
|
|
|
|
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
|
|
|
|
|
|
|
|
|
|
/* Verify the file access properties */
|
|
|
|
|
if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE)
|
2014-04-09 11:35:16 +08:00
|
|
|
|
TEST_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
if(file<0) {
|
|
|
|
|
H5Pclose (fapl);
|
|
|
|
|
SKIPPED();
|
|
|
|
|
printf(" Probably the file system doesn't support Direct I/O\n");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
/* Retrieve the access property list... */
|
|
|
|
|
if ((access_fapl = H5Fget_access_plist(file)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2011-04-09 05:31:31 +08:00
|
|
|
|
/* Check that the driver is correct */
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(H5FD_DIRECT != H5Pget_driver(access_fapl))
|
2014-04-09 11:35:16 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
/* ...and close the property list */
|
|
|
|
|
if (H5Pclose(access_fapl) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
/* Check file handle API */
|
|
|
|
|
if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
if(*fhandle<0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Check file size API */
|
|
|
|
|
if(H5Fget_filesize(file, &file_size) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
/* There is no guarantee of the number of metadata allocations, but it's
|
|
|
|
|
* 4 currently and the size of the file should be between 3 & 4 file buffer
|
|
|
|
|
* sizes..
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*/
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4))
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
/* Allocate aligned memory for data set 1. For data set 1, everything is aligned including
|
|
|
|
|
* memory address, size of data, and file address. */
|
|
|
|
|
if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
|
2013-02-02 09:53:32 +08:00
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
|
2013-02-02 09:53:32 +08:00
|
|
|
|
TEST_ERROR;
|
2006-12-01 04:49:01 +08:00
|
|
|
|
|
|
|
|
|
/* Initialize the dset1 */
|
|
|
|
|
p1 = points;
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
for(i = n = 0; i < DSET1_DIM1; i++)
|
2013-02-02 09:53:32 +08:00
|
|
|
|
for(j = 0; j < DSET1_DIM2; j++)
|
|
|
|
|
*p1++ = n++;
|
2006-12-01 04:49:01 +08:00
|
|
|
|
|
|
|
|
|
/* Create the data space1 */
|
|
|
|
|
dims1[0] = DSET1_DIM1;
|
|
|
|
|
dims1[1] = DSET1_DIM2;
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
if((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Create the dset1 */
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Write the data to the dset1 */
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Dclose(dset1) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Read the data back from dset1 */
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Check that the values read are the same as the values written */
|
|
|
|
|
p1 = points;
|
|
|
|
|
p2 = check;
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
for(i = 0; i < DSET1_DIM1; i++)
|
2013-02-02 09:53:32 +08:00
|
|
|
|
for(j = 0; j < DSET1_DIM2; j++)
|
|
|
|
|
if(*p1++ != *p2++) {
|
|
|
|
|
H5_FAILED();
|
|
|
|
|
printf(" Read different values than written in data set 1.\n");
|
|
|
|
|
printf(" At index %d,%d\n", i, j);
|
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
} /* end if */
|
2006-12-01 04:49:01 +08:00
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
/* Create the data space2. For data set 2, memory address and data size are not aligned. */
|
|
|
|
|
dims2[0] = DSET2_DIM;
|
|
|
|
|
if((space2 = H5Screate_simple(1, dims2, NULL)) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
/* Create the dset2 */
|
|
|
|
|
if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Write the data to the dset1 */
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(H5Dclose(dset2) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0)
|
2013-02-02 09:53:32 +08:00
|
|
|
|
TEST_ERROR;
|
2006-12-01 04:49:01 +08:00
|
|
|
|
|
|
|
|
|
/* Read the data back from dset1 */
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Check that the values read are the same as the values written */
|
2015-09-14 11:58:59 +08:00
|
|
|
|
for(i = 0; i < DSET2_DIM; i++)
|
|
|
|
|
if(wdata2[i] != rdata2[i]) {
|
|
|
|
|
H5_FAILED();
|
|
|
|
|
printf(" Read different values than written in data set 2.\n");
|
|
|
|
|
printf(" At index %d\n", i);
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
} /* end if */
|
2006-12-01 04:49:01 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Sclose(space1) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Dclose(dset1) < 0)
|
2006-12-01 04:49:01 +08:00
|
|
|
|
TEST_ERROR;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
if(H5Sclose(space2) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
if(H5Dclose(dset2) < 0)
|
|
|
|
|
TEST_ERROR;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
|
2013-02-02 09:53:32 +08:00
|
|
|
|
HDfree(points);
|
|
|
|
|
HDfree(check);
|
2006-12-01 04:49:01 +08:00
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close and delete the file */
|
|
|
|
|
if(H5Fclose(file) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
h5_delete_test_file(FILENAME[5], fapl);
|
|
|
|
|
|
|
|
|
|
/* Close the fapl */
|
|
|
|
|
if(H5Pclose(fapl) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
PASSED();
|
|
|
|
|
return 0;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
error:
|
|
|
|
|
H5E_BEGIN_TRY {
|
2013-02-02 09:53:32 +08:00
|
|
|
|
H5Pclose(fapl);
|
2015-09-14 11:58:59 +08:00
|
|
|
|
H5Sclose(space1);
|
|
|
|
|
H5Dclose(dset1);
|
|
|
|
|
H5Sclose(space2);
|
|
|
|
|
H5Dclose(dset2);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
H5Fclose(file);
|
|
|
|
|
} H5E_END_TRY;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
|
|
|
|
|
if(points)
|
|
|
|
|
HDfree(points);
|
|
|
|
|
if(check)
|
|
|
|
|
HDfree(check);
|
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
return -1;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
#endif /*H5_HAVE_DIRECT*/
|
2005-06-24 22:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_family_opens
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Private function for test_family() to tests wrong ways of
|
|
|
|
|
* reopening family file.
|
|
|
|
|
*
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*
|
|
|
|
|
* Programmer: Raymond Lu
|
|
|
|
|
* Thursday, May 19, 2005
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
test_family_opens(char *fname, hid_t fa_pl)
|
|
|
|
|
{
|
2016-08-20 00:30:05 +08:00
|
|
|
|
hid_t file=-1;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
char first_name[1024];
|
|
|
|
|
char wrong_name[1024];
|
|
|
|
|
int i;
|
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
/* Case 1: reopen file with 1st member file name and default property list */
|
2013-02-02 09:53:32 +08:00
|
|
|
|
HDsnprintf(first_name, sizeof(first_name), fname, 0);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
H5E_BEGIN_TRY {
|
2013-02-02 09:53:32 +08:00
|
|
|
|
file = H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
} H5E_END_TRY;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if(file >= 0)
|
|
|
|
|
TEST_ERROR
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Case 2: reopen file with correct name template but default property list */
|
|
|
|
|
H5E_BEGIN_TRY {
|
2013-02-02 09:53:32 +08:00
|
|
|
|
file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
} H5E_END_TRY;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if(file >= 0)
|
|
|
|
|
TEST_ERROR
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Case 3: reopen file with wrong member size */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
H5E_BEGIN_TRY {
|
2013-02-02 09:53:32 +08:00
|
|
|
|
file = H5Fopen(fname, H5F_ACC_RDWR, fa_pl);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
} H5E_END_TRY;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if(file >= 0)
|
|
|
|
|
TEST_ERROR
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
/* Case 4: reopen file with wrong name template */
|
2006-10-03 02:32:46 +08:00
|
|
|
|
HDstrcpy(wrong_name, fname);
|
|
|
|
|
for(i = 0; i < 1024; i++)
|
2005-06-24 22:32:05 +08:00
|
|
|
|
if(wrong_name[i] == '5') {
|
|
|
|
|
wrong_name[i] = '4';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_fapl_family(fa_pl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
H5E_BEGIN_TRY {
|
2013-02-02 09:53:32 +08:00
|
|
|
|
file = H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
} H5E_END_TRY;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if(file >= 0)
|
|
|
|
|
TEST_ERROR
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
return 0;
|
2006-10-03 02:32:46 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
error:
|
|
|
|
|
return -1;
|
2006-10-03 02:32:46 +08:00
|
|
|
|
} /* end test_family_opens() */
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_family
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Tests the file handle interface for FAMILY driver
|
|
|
|
|
*
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*
|
|
|
|
|
* Programmer: Raymond Lu
|
|
|
|
|
* Tuesday, Sept 24, 2002
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
test_family(void)
|
|
|
|
|
{
|
2016-08-20 00:30:05 +08:00
|
|
|
|
hid_t file=-1, fapl=-1, fapl2=-1, space=-1, dset=-1;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
hid_t access_fapl = -1;
|
2017-06-01 05:45:41 +08:00
|
|
|
|
hid_t driver_id = -1; /* ID for this VFD */
|
|
|
|
|
unsigned long driver_flags = 0; /* VFD feature flags */
|
2005-06-24 22:32:05 +08:00
|
|
|
|
char filename[1024];
|
|
|
|
|
char dname[]="dataset";
|
2007-04-05 03:59:00 +08:00
|
|
|
|
unsigned int i, j;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
int *fhandle=NULL, *fhandle2=NULL;
|
|
|
|
|
int buf[FAMILY_NUMBER][FAMILY_SIZE];
|
|
|
|
|
hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
|
|
|
|
|
hsize_t file_size;
|
|
|
|
|
|
|
|
|
|
TESTING("FAMILY file driver");
|
|
|
|
|
|
|
|
|
|
/* Set property list and file name for FAMILY driver */
|
2016-08-20 00:30:05 +08:00
|
|
|
|
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2017-06-01 05:45:41 +08:00
|
|
|
|
/* Check that the VFD feature flags are correct */
|
|
|
|
|
if ((driver_id = H5Pget_driver(fapl)) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
|
|
|
|
|
/* Check for extra flags not accounted for above */
|
|
|
|
|
if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
|
|
|
|
|
| H5FD_FEAT_ACCUMULATE_METADATA
|
|
|
|
|
| H5FD_FEAT_DATA_SIEVE
|
|
|
|
|
| H5FD_FEAT_AGGREGATE_SMALLDATA))
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Fclose(file) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
/* Test different wrong ways to reopen family files where there's only
|
2005-06-24 22:32:05 +08:00
|
|
|
|
* one member file existing. */
|
2006-10-03 02:32:46 +08:00
|
|
|
|
if(test_family_opens(filename, fapl) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Reopen the file with default member file size */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Check file size API */
|
|
|
|
|
if(H5Fget_filesize(file, &file_size) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2006-10-03 02:32:46 +08:00
|
|
|
|
/* The file size is supposed to be about 800 bytes right now. */
|
|
|
|
|
if(file_size < (KB / 2) || file_size > KB)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Create and write dataset */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if((space=H5Screate_simple(2, dims, NULL)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Retrieve the access property list... */
|
|
|
|
|
if ((access_fapl = H5Fget_access_plist(file)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2011-04-09 05:31:31 +08:00
|
|
|
|
/* Check that the driver is correct */
|
|
|
|
|
if(H5FD_FAMILY != H5Pget_driver(access_fapl))
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
/* ...and close the property list */
|
|
|
|
|
if (H5Pclose(access_fapl) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2013-02-02 09:53:32 +08:00
|
|
|
|
for(i = 0; i < FAMILY_NUMBER; i++)
|
|
|
|
|
for(j = 0; j < FAMILY_SIZE; j++)
|
|
|
|
|
buf[i][j] = (int)((i * 10000) + j);
|
2007-04-05 03:59:00 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* check file handle API */
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if((fapl2 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_family_offset(fapl2, (hsize_t)0) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if(*fhandle < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_family_offset(fapl2, (hsize_t)(FAMILY_SIZE*2)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if(*fhandle2 < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Check file size API */
|
|
|
|
|
if(H5Fget_filesize(file, &file_size) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2013-02-02 09:53:32 +08:00
|
|
|
|
/* Some data has been written. The file size should be bigger (18KB+976)
|
2005-08-14 04:53:35 +08:00
|
|
|
|
* bytes if int size is 4 bytes) now. */
|
2013-02-02 09:53:32 +08:00
|
|
|
|
#if H5_SIZEOF_INT <= 4
|
|
|
|
|
if(file_size < (18 * KB) || file_size > (20 * KB))
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
#elif H5_SIZEOF_INT >= 8
|
|
|
|
|
if(file_size < (32 * KB) || file_size > (40 * KB))
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
#endif
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Sclose(space) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Dclose(dset) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pclose(fapl2) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Fclose(file) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Test different wrong ways to reopen family files when there're multiple
|
|
|
|
|
* member files existing. */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(test_family_opens(filename, fapl) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Reopen the file with correct member file size. */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close and delete the file */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Fclose(file) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_delete_test_file(FILENAME[2], fapl);
|
|
|
|
|
|
|
|
|
|
/* Close the fapl */
|
|
|
|
|
if(H5Pclose(fapl) < 0)
|
|
|
|
|
TEST_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
PASSED();
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
H5Sclose(space);
|
|
|
|
|
H5Dclose(dset);
|
2016-08-20 00:30:05 +08:00
|
|
|
|
H5Pclose(fapl);
|
|
|
|
|
H5Pclose(fapl2);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
H5Fclose(file);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_family_compat
|
|
|
|
|
*
|
2005-08-14 04:53:35 +08:00
|
|
|
|
* Purpose: Tests the backward compatibility for FAMILY driver.
|
2005-06-24 22:32:05 +08:00
|
|
|
|
* See if we can open files created with v1.6 library.
|
|
|
|
|
* The source file was created by the test/file_handle.c
|
|
|
|
|
* of the v1.6 library. Then tools/misc/h5repart.c was
|
|
|
|
|
* used to concantenated. The command was "h5repart -m 5k
|
2007-12-14 02:17:02 +08:00
|
|
|
|
* family_file%05d.h5 family_v16_%05d.h5".
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*
|
|
|
|
|
* Programmer: Raymond Lu
|
|
|
|
|
* June 3, 2005
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2005-06-24 22:32:05 +08:00
|
|
|
|
test_family_compat(void)
|
|
|
|
|
{
|
2016-08-20 00:30:05 +08:00
|
|
|
|
hid_t file = -1, fapl = -1;
|
|
|
|
|
hid_t dset = -1;
|
2009-03-25 06:06:07 +08:00
|
|
|
|
char dname[]="dataset";
|
2005-06-24 22:32:05 +08:00
|
|
|
|
char filename[1024];
|
2009-04-16 05:42:02 +08:00
|
|
|
|
char pathname[1024], pathname_individual[1024];
|
|
|
|
|
char newname[1024], newname_individual[1024];
|
|
|
|
|
int counter = 0;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
TESTING("FAMILY file driver backward compatibility");
|
|
|
|
|
|
|
|
|
|
/* Set property list and file name for FAMILY driver */
|
2016-08-20 00:30:05 +08:00
|
|
|
|
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof(filename));
|
|
|
|
|
h5_fixname(FILENAME[3], fapl, newname, sizeof(newname));
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2005-10-15 03:16:54 +08:00
|
|
|
|
pathname[0] = '\0';
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
HDstrcat(pathname, filename);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2009-04-16 05:42:02 +08:00
|
|
|
|
/* The following code makes the copies of the family files in the source directory.
|
|
|
|
|
* Since we're going to open the files with write mode, this protects the original
|
|
|
|
|
* files.
|
|
|
|
|
*/
|
2013-02-02 09:53:32 +08:00
|
|
|
|
HDsnprintf(newname_individual, sizeof(newname_individual), newname, counter);
|
|
|
|
|
HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter);
|
2009-04-16 05:42:02 +08:00
|
|
|
|
|
2013-02-02 09:53:32 +08:00
|
|
|
|
while(h5_make_local_copy(pathname_individual, newname_individual) >= 0) {
|
2009-04-16 05:42:02 +08:00
|
|
|
|
counter++;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
HDsnprintf(newname_individual, sizeof(newname_individual), newname, counter);
|
|
|
|
|
HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter);
|
2016-11-23 09:55:03 +08:00
|
|
|
|
} /* end while */
|
2009-04-16 05:42:02 +08:00
|
|
|
|
|
2009-03-25 06:06:07 +08:00
|
|
|
|
/* Make sure we can open the file. Use the read and write mode to flush the
|
|
|
|
|
* superblock. */
|
2009-04-16 05:42:02 +08:00
|
|
|
|
if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
|
2009-03-25 06:06:07 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2009-03-26 03:28:01 +08:00
|
|
|
|
if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
|
2009-03-25 06:06:07 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Dclose(dset) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Fclose(file) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Open the file again to make sure it isn't corrupted. */
|
2009-04-16 05:42:02 +08:00
|
|
|
|
if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
|
2009-03-25 06:06:07 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2009-03-26 03:28:01 +08:00
|
|
|
|
if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
|
2009-03-25 06:06:07 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Dclose(dset) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close and delete the file */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Fclose(file) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_delete_test_file(FILENAME[3], fapl);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close the fapl */
|
|
|
|
|
if(H5Pclose(fapl) < 0)
|
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
PASSED();
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
H5Fclose(file);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
H5Pclose(fapl);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
} H5E_END_TRY;
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
return -1;
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
} /* end test_family_compat() */
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_multi_opens
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Private function for test_multi() to tests wrong ways of
|
|
|
|
|
* reopening multi file.
|
|
|
|
|
*
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
* Return: Success: 0
|
2013-02-02 09:53:32 +08:00
|
|
|
|
* Failure: -1
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*
|
|
|
|
|
* Programmer: Raymond Lu
|
|
|
|
|
* Thursday, May 19, 2005
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
2005-11-15 10:55:39 +08:00
|
|
|
|
test_multi_opens(char *fname)
|
2005-06-24 22:32:05 +08:00
|
|
|
|
{
|
2016-08-20 00:30:05 +08:00
|
|
|
|
hid_t file=-1;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
char super_name[1024]; /*name string "%%s-s.h5"*/
|
|
|
|
|
char sf_name[1024]; /*name string "multi_file-s.h5"*/
|
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
/* Case: reopen with the name of super file and default property list */
|
2013-02-02 09:53:32 +08:00
|
|
|
|
HDsnprintf(super_name, sizeof(super_name), "%%s-%c.h5", 's');
|
|
|
|
|
HDsnprintf(sf_name, sizeof(sf_name), super_name, fname);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
H5E_BEGIN_TRY {
|
2013-02-02 09:53:32 +08:00
|
|
|
|
file = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
|
2013-02-02 09:53:32 +08:00
|
|
|
|
return(file >= 0 ? -1 : 0);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_multi
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Tests the file handle interface for MUTLI driver
|
|
|
|
|
*
|
[svn-r14210] Description:
Enable the backward compatibility file format test for the family VFD
in all situations.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-19 01:47:43 +08:00
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*
|
|
|
|
|
* Programmer: Raymond Lu
|
|
|
|
|
* Tuesday, Sept 24, 2002
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
test_multi(void)
|
|
|
|
|
{
|
2016-08-20 00:30:05 +08:00
|
|
|
|
hid_t file=-1, fapl=-1, fapl2=-1, dset=-1, space=-1;
|
|
|
|
|
hid_t root=-1, attr=-1, aspace=-1, atype=-1;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
hid_t access_fapl = -1;
|
2017-06-01 05:45:41 +08:00
|
|
|
|
hid_t driver_id = -1; /* ID for this VFD */
|
|
|
|
|
unsigned long driver_flags = 0; /* VFD feature flags */
|
2005-06-24 22:32:05 +08:00
|
|
|
|
char filename[1024];
|
|
|
|
|
int *fhandle2=NULL, *fhandle=NULL;
|
|
|
|
|
hsize_t file_size;
|
|
|
|
|
H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
|
|
|
|
|
hid_t memb_fapl[H5FD_MEM_NTYPES];
|
|
|
|
|
haddr_t memb_addr[H5FD_MEM_NTYPES];
|
|
|
|
|
const char *memb_name[H5FD_MEM_NTYPES];
|
|
|
|
|
char sv[H5FD_MEM_NTYPES][32];
|
|
|
|
|
hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE};
|
2007-01-13 04:29:43 +08:00
|
|
|
|
hsize_t adims[1]={1};
|
2005-06-24 22:32:05 +08:00
|
|
|
|
char dname[]="dataset";
|
2007-01-13 04:29:43 +08:00
|
|
|
|
char meta[] = "this is some metadata on this file";
|
2005-06-24 22:32:05 +08:00
|
|
|
|
int i, j;
|
|
|
|
|
int buf[MULTI_SIZE][MULTI_SIZE];
|
|
|
|
|
|
|
|
|
|
TESTING("MULTI file driver");
|
2015-09-14 11:58:59 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
/* Set file access property list for MULTI driver */
|
2016-08-20 00:30:05 +08:00
|
|
|
|
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
HDmemset(memb_map, 0, sizeof(memb_map));
|
|
|
|
|
HDmemset(memb_fapl, 0, sizeof(memb_fapl));
|
|
|
|
|
HDmemset(memb_name, 0, sizeof(memb_name));
|
|
|
|
|
HDmemset(memb_addr, 0, sizeof(memb_addr));
|
|
|
|
|
HDmemset(sv, 0, sizeof(sv));
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2007-01-13 04:29:43 +08:00
|
|
|
|
for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
|
|
|
|
|
memb_fapl[mt] = H5P_DEFAULT;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
memb_map[mt] = H5FD_MEM_SUPER;
|
2007-01-13 04:29:43 +08:00
|
|
|
|
}
|
2005-06-24 22:32:05 +08:00
|
|
|
|
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
|
2007-01-13 04:29:43 +08:00
|
|
|
|
memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE;
|
|
|
|
|
memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
|
|
|
|
|
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
|
|
|
|
|
memb_addr[H5FD_MEM_SUPER] = 0;
|
|
|
|
|
|
2007-01-13 04:29:43 +08:00
|
|
|
|
sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
|
|
|
|
|
memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE];
|
|
|
|
|
memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/4;
|
2008-09-16 23:52:51 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
|
|
|
|
|
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
|
|
|
|
|
memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
|
|
|
|
|
|
2007-01-13 04:29:43 +08:00
|
|
|
|
sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g');
|
|
|
|
|
memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP];
|
2011-04-09 05:31:31 +08:00
|
|
|
|
memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX/4)*3;
|
2007-01-13 04:29:43 +08:00
|
|
|
|
|
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2009-04-17 23:52:38 +08:00
|
|
|
|
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2017-06-01 05:45:41 +08:00
|
|
|
|
/* Check that the VFD feature flags are correct */
|
|
|
|
|
if ((driver_id = H5Pget_driver(fapl)) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_USE_ALLOC_SIZE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_PAGED_AGGR)) TEST_ERROR
|
|
|
|
|
/* Check for extra flags not accounted for above */
|
|
|
|
|
if(driver_flags != (H5FD_FEAT_DATA_SIEVE
|
|
|
|
|
| H5FD_FEAT_AGGREGATE_SMALLDATA
|
|
|
|
|
| H5FD_FEAT_USE_ALLOC_SIZE
|
|
|
|
|
| H5FD_FEAT_PAGED_AGGR))
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Fclose(file) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2007-01-13 04:29:43 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
/* Test wrong ways to reopen multi files */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(test_multi_opens(filename) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Reopen the file */
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Create and write data set */
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if((space = H5Screate_simple(2, dims, NULL)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Retrieve the access property list... */
|
|
|
|
|
if ((access_fapl = H5Fget_access_plist(file)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2011-04-09 05:31:31 +08:00
|
|
|
|
/* Check that the driver is correct */
|
|
|
|
|
if(H5FD_MULTI != H5Pget_driver(access_fapl))
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
/* ...and close the property list */
|
|
|
|
|
if (H5Pclose(access_fapl) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Check file size API */
|
|
|
|
|
if(H5Fget_filesize(file, &file_size) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Before any data is written, the raw data file is empty. So
|
2007-01-13 04:29:43 +08:00
|
|
|
|
* the file size is only the size of b-tree + HADDR_MAX/4.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*/
|
2007-01-13 04:29:43 +08:00
|
|
|
|
if(file_size < HADDR_MAX/4 || file_size > HADDR_MAX/2)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
for(i=0; i<MULTI_SIZE; i++)
|
|
|
|
|
for(j=0; j<MULTI_SIZE; j++)
|
|
|
|
|
buf[i][j] = i*10000+j;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if((fapl2=H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_multi_type(fapl2, H5FD_MEM_SUPER) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
if(*fhandle<0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pset_multi_type(fapl2, H5FD_MEM_DRAW) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
if(*fhandle2<0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/* Check file size API */
|
|
|
|
|
if(H5Fget_filesize(file, &file_size) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
/* After the data is written, the file size is huge because the
|
2005-06-24 22:32:05 +08:00
|
|
|
|
* beginning of raw data file is set at HADDR_MAX/2. It's supposed
|
2005-08-14 04:53:35 +08:00
|
|
|
|
* to be (HADDR_MAX/2 + 128*128*4)
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*/
|
|
|
|
|
if(file_size < HADDR_MAX/2 || file_size > HADDR_MAX)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Sclose(space) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Dclose(dset) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Pclose(fapl2) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2007-01-13 04:29:43 +08:00
|
|
|
|
|
|
|
|
|
/* Create and write attribute for the root group. */
|
2007-08-28 23:02:54 +08:00
|
|
|
|
if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0)
|
2016-08-18 22:20:03 +08:00
|
|
|
|
TEST_ERROR
|
2007-01-13 04:29:43 +08:00
|
|
|
|
|
|
|
|
|
/* Attribute string. */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if((atype = H5Tcopy(H5T_C_S1)) < 0)
|
2007-01-13 04:29:43 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Tset_size(atype, strlen(meta) + 1) < 0)
|
2007-01-13 04:29:43 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Tset_strpad(atype, H5T_STR_NULLTERM) < 0)
|
2007-01-13 04:29:43 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Create and write attribute */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if((aspace = H5Screate_simple(1, adims, NULL)) < 0)
|
2007-01-13 04:29:43 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
[svn-r14218] Description:
Changed H5Acreate2 -> H5Acreate_by_name, to be more consistent with
other new API routines.
Re-added simpler form of H5Acreate2, which creates attributes directly
on an object.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-31 02:13:48 +08:00
|
|
|
|
if((attr = H5Acreate2(root, "Metadata", atype, aspace, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2007-01-13 04:29:43 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Awrite(attr, atype, meta) < 0)
|
2007-01-13 04:29:43 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Close IDs */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Tclose(atype) < 0)
|
2007-01-13 04:29:43 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Sclose(aspace) < 0)
|
2007-01-13 04:29:43 +08:00
|
|
|
|
TEST_ERROR;
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Aclose(attr) < 0)
|
2007-01-13 04:29:43 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close and delete the file */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(H5Fclose(file) < 0)
|
2005-11-15 10:55:39 +08:00
|
|
|
|
TEST_ERROR;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_delete_test_file(FILENAME[4], fapl);
|
|
|
|
|
|
|
|
|
|
/* Close the fapl */
|
|
|
|
|
if(H5Pclose(fapl) < 0)
|
|
|
|
|
TEST_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
|
|
|
|
PASSED();
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
return 0;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
error:
|
|
|
|
|
H5E_BEGIN_TRY {
|
2005-06-24 22:32:05 +08:00
|
|
|
|
H5Sclose(space);
|
|
|
|
|
H5Dclose(dset);
|
|
|
|
|
H5Pclose(fapl);
|
|
|
|
|
H5Pclose(fapl2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
H5Fclose(file);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
return -1;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-22 23:47:57 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_multi_compat
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Tests the backward compatibility for MULTI driver.
|
|
|
|
|
* See if we can open files created with v1.6 library.
|
|
|
|
|
* The source file was created by the test/file_handle.c
|
|
|
|
|
* of the v1.6 library. This test verifies the fix for
|
|
|
|
|
* Issue 2598. In v1.6 library, there was EOA for the whole
|
|
|
|
|
* MULTI file saved in the super block. We took it out in
|
|
|
|
|
* v1.8 library because it's meaningless for the MULTI file.
|
|
|
|
|
* v1.8 library saves the EOA for the metadata file, instead.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Raymond Lu
|
|
|
|
|
* 21 June 2011
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
test_multi_compat(void)
|
|
|
|
|
{
|
2016-08-20 00:30:05 +08:00
|
|
|
|
hid_t file=-1, fapl=-1, dset=-1, space=-1;
|
2012-05-26 01:39:07 +08:00
|
|
|
|
char newname[1024];
|
2011-06-22 23:47:57 +08:00
|
|
|
|
char filename_s[1024], newname_s[1024];
|
|
|
|
|
char filename_r[1024], newname_r[1024];
|
|
|
|
|
H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
|
|
|
|
|
hid_t memb_fapl[H5FD_MEM_NTYPES];
|
|
|
|
|
haddr_t memb_addr[H5FD_MEM_NTYPES];
|
|
|
|
|
const char *memb_name[H5FD_MEM_NTYPES];
|
|
|
|
|
char sv[H5FD_MEM_NTYPES][32];
|
|
|
|
|
hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE};
|
|
|
|
|
int i, j;
|
|
|
|
|
int buf[MULTI_SIZE][MULTI_SIZE];
|
|
|
|
|
|
|
|
|
|
TESTING("MULTI file driver backward compatibility");
|
|
|
|
|
|
|
|
|
|
/* Set file access property list for MULTI driver */
|
2016-08-20 00:30:05 +08:00
|
|
|
|
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
|
|
|
|
TEST_ERROR;
|
2011-06-22 23:47:57 +08:00
|
|
|
|
|
|
|
|
|
HDmemset(memb_map, 0, sizeof memb_map);
|
|
|
|
|
HDmemset(memb_fapl, 0, sizeof memb_fapl);
|
|
|
|
|
HDmemset(memb_name, 0, sizeof memb_name);
|
|
|
|
|
HDmemset(memb_addr, 0, sizeof memb_addr);
|
|
|
|
|
HDmemset(sv, 0, sizeof sv);
|
|
|
|
|
|
|
|
|
|
for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt))
|
|
|
|
|
memb_map[mt] = H5FD_MEM_SUPER;
|
|
|
|
|
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
|
|
|
|
|
|
|
|
|
|
memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT;
|
|
|
|
|
sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
|
|
|
|
|
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
|
|
|
|
|
memb_addr[H5FD_MEM_SUPER] = 0;
|
|
|
|
|
|
|
|
|
|
memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
|
|
|
|
|
sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
|
|
|
|
|
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
|
|
|
|
|
memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
|
|
|
|
|
|
|
|
|
|
if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE)<0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[9], fapl, newname, sizeof newname);
|
|
|
|
|
|
|
|
|
|
/* Make copy for the data file in the build directory, to protect the
|
|
|
|
|
* original file in the source directory */
|
|
|
|
|
sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's');
|
|
|
|
|
sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's');
|
|
|
|
|
h5_make_local_copy(filename_s, newname_s);
|
|
|
|
|
|
|
|
|
|
sprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r');
|
|
|
|
|
sprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r');
|
|
|
|
|
h5_make_local_copy(filename_r, newname_r);
|
|
|
|
|
|
|
|
|
|
/* Reopen the file for read only. Verify 1.8 library can open file
|
|
|
|
|
* created with 1.6 library. */
|
|
|
|
|
if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Dclose(dset) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Fclose(file) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Make sure we can reopen the file for read and write */
|
|
|
|
|
if((file=H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Dclose(dset) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Fclose(file) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Reopen the file for adding another dataset. The new EOA for metadata file
|
|
|
|
|
* should be written to the file */
|
|
|
|
|
if((file=H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Create and write data set */
|
|
|
|
|
if((space=H5Screate_simple(2, dims, NULL)) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if((dset=H5Dcreate2(file, DSET3_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2011-06-22 23:47:57 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
for(i=0; i<MULTI_SIZE; i++)
|
|
|
|
|
for(j=0; j<MULTI_SIZE; j++)
|
|
|
|
|
buf[i][j] = i*10000+j;
|
|
|
|
|
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Dclose(dset) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Sclose(space) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Fclose(file) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Reopen the file for read only again. Verify the library can handle
|
|
|
|
|
* the EOA correctly */
|
|
|
|
|
if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if((dset = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Dclose(dset) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if((dset = H5Dopen2(file, DSET3_NAME, H5P_DEFAULT)) < 0)
|
2011-06-22 23:47:57 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
if(H5Dclose(dset) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close and delete the file */
|
2011-06-22 23:47:57 +08:00
|
|
|
|
if(H5Fclose(file) < 0)
|
|
|
|
|
TEST_ERROR;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_delete_test_file(FILENAME[9], fapl);
|
|
|
|
|
|
|
|
|
|
/* Close the fapl */
|
|
|
|
|
if(H5Pclose(fapl) < 0)
|
|
|
|
|
TEST_ERROR;
|
2011-06-22 23:47:57 +08:00
|
|
|
|
|
|
|
|
|
PASSED();
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
H5Sclose(space);
|
|
|
|
|
H5Dclose(dset);
|
|
|
|
|
H5Pclose(fapl);
|
|
|
|
|
H5Fclose(file);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_log
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Tests the file handle interface for log driver
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Dana Robinson
|
|
|
|
|
* Tuesday, March 22, 2011
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
test_log(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t file = -1;
|
|
|
|
|
hid_t fapl = -1;
|
|
|
|
|
hid_t access_fapl = -1;
|
2017-06-01 05:45:41 +08:00
|
|
|
|
hid_t driver_id = -1; /* ID for this VFD */
|
|
|
|
|
unsigned long driver_flags = 0; /* VFD feature flags */
|
2011-04-09 05:31:31 +08:00
|
|
|
|
char filename[1024];
|
|
|
|
|
int *fhandle = NULL;
|
|
|
|
|
hsize_t file_size = 0;
|
|
|
|
|
unsigned int flags = H5FD_LOG_ALL;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
size_t buf_size = 4 * KB;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
TESTING("LOG file driver");
|
|
|
|
|
|
|
|
|
|
/* Set property list and file name for log driver. */
|
2016-08-20 00:30:05 +08:00
|
|
|
|
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
|
|
|
|
TEST_ERROR;
|
2013-02-02 09:53:32 +08:00
|
|
|
|
if(H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
|
2011-04-09 05:31:31 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
|
|
|
|
|
|
2017-06-01 05:45:41 +08:00
|
|
|
|
/* Check that the VFD feature flags are correct */
|
|
|
|
|
if ((driver_id = H5Pget_driver(fapl)) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) TEST_ERROR
|
|
|
|
|
/* Check for extra flags not accounted for above */
|
|
|
|
|
if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
|
|
|
|
|
| H5FD_FEAT_ACCUMULATE_METADATA
|
|
|
|
|
| H5FD_FEAT_DATA_SIEVE
|
|
|
|
|
| H5FD_FEAT_AGGREGATE_SMALLDATA
|
|
|
|
|
| H5FD_FEAT_POSIX_COMPAT_HANDLE
|
|
|
|
|
| H5FD_FEAT_SUPPORTS_SWMR_IO
|
|
|
|
|
| H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
|
2011-04-09 05:31:31 +08:00
|
|
|
|
/* Create the test file */
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
/* Check that the driver is correct */
|
|
|
|
|
if(H5FD_LOG != H5Pget_driver(access_fapl))
|
|
|
|
|
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 guarantee 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;
|
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close and delete the file */
|
2011-04-09 05:31:31 +08:00
|
|
|
|
if(H5Fclose(file) < 0)
|
|
|
|
|
TEST_ERROR;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_delete_test_file(FILENAME[6], fapl);
|
|
|
|
|
|
|
|
|
|
/* Close the fapl */
|
|
|
|
|
if(H5Pclose(fapl) < 0)
|
|
|
|
|
TEST_ERROR;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
PASSED();
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
H5Pclose(fapl);
|
|
|
|
|
H5Fclose(file);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_stdio
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Tests the file handle interface for STDIO driver
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Dana Robinson
|
|
|
|
|
* Tuesday, March 22, 2011
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
test_stdio(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t file = -1;
|
|
|
|
|
hid_t fapl = -1;
|
|
|
|
|
hid_t access_fapl = -1;
|
2017-06-01 05:45:41 +08:00
|
|
|
|
hid_t driver_id = -1; /* ID for this VFD */
|
|
|
|
|
unsigned long driver_flags = 0; /* VFD feature flags */
|
2011-04-09 05:31:31 +08:00
|
|
|
|
char filename[1024];
|
2011-04-19 19:34:51 +08:00
|
|
|
|
FILE *fhandle = NULL;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
hsize_t file_size = 0;
|
|
|
|
|
|
|
|
|
|
TESTING("STDIO file driver");
|
|
|
|
|
|
|
|
|
|
/* Set property list and file name for STDIO driver. */
|
2016-08-20 00:30:05 +08:00
|
|
|
|
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
|
|
|
|
TEST_ERROR;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
if(H5Pset_fapl_stdio(fapl) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
h5_fixname(FILENAME[7], fapl, filename, sizeof filename);
|
|
|
|
|
|
2017-06-01 05:45:41 +08:00
|
|
|
|
/* Check that the VFD feature flags are correct */
|
|
|
|
|
if ((driver_id = H5Pget_driver(fapl)) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) TEST_ERROR
|
|
|
|
|
/* Check for extra flags not accounted for above */
|
|
|
|
|
if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
|
|
|
|
|
| H5FD_FEAT_ACCUMULATE_METADATA
|
|
|
|
|
| H5FD_FEAT_DATA_SIEVE
|
|
|
|
|
| H5FD_FEAT_AGGREGATE_SMALLDATA
|
|
|
|
|
| H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
|
2011-04-09 05:31:31 +08:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
/* Check that the driver is correct */
|
|
|
|
|
if(H5FD_STDIO != H5Pget_driver(access_fapl))
|
|
|
|
|
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;
|
2011-04-19 19:34:51 +08:00
|
|
|
|
if(NULL == fhandle)
|
2011-04-09 05:31:31 +08:00
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* Check file size API */
|
|
|
|
|
if(H5Fget_filesize(file, &file_size) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
|
|
|
|
|
/* There is no guarantee 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;
|
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close and delete the file */
|
2011-04-09 05:31:31 +08:00
|
|
|
|
if(H5Fclose(file) < 0)
|
|
|
|
|
TEST_ERROR;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_delete_test_file(FILENAME[7], fapl);
|
|
|
|
|
|
|
|
|
|
/* Close the fapl */
|
|
|
|
|
if(H5Pclose(fapl) < 0)
|
|
|
|
|
TEST_ERROR;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
PASSED();
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
H5Pclose(fapl);
|
|
|
|
|
H5Fclose(file);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: test_windows
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Tests the file handle interface for WINDOWS driver
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: -1
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Dana Robinson
|
|
|
|
|
* Tuesday, March 22, 2011
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
test_windows(void)
|
|
|
|
|
{
|
2011-09-07 00:50:32 +08:00
|
|
|
|
#ifdef H5_HAVE_WINDOWS
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
hid_t file = -1;
|
|
|
|
|
hid_t fapl = -1;
|
|
|
|
|
hid_t access_fapl = -1;
|
2017-06-01 05:45:41 +08:00
|
|
|
|
hid_t driver_id = -1; /* ID for this VFD */
|
|
|
|
|
unsigned long driver_flags = 0; /* VFD feature flags */
|
2011-04-09 05:31:31 +08:00
|
|
|
|
char filename[1024];
|
|
|
|
|
int *fhandle = NULL;
|
|
|
|
|
hsize_t file_size = 0;
|
|
|
|
|
|
2011-09-07 00:50:32 +08:00
|
|
|
|
#endif /*H5_HAVE_WINDOWS*/
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
TESTING("WINDOWS file driver");
|
|
|
|
|
|
2011-09-07 00:50:32 +08:00
|
|
|
|
#ifndef H5_HAVE_WINDOWS
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
SKIPPED();
|
|
|
|
|
return 0;
|
|
|
|
|
|
2011-09-07 00:50:32 +08:00
|
|
|
|
#else /* H5_HAVE_WINDOWS */
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
/* Set property list and file name for WINDOWS driver. */
|
2016-08-20 00:30:05 +08:00
|
|
|
|
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
|
|
|
|
TEST_ERROR;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
if(H5Pset_fapl_windows(fapl) < 0)
|
|
|
|
|
TEST_ERROR;
|
|
|
|
|
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
|
|
|
|
|
|
2017-06-01 05:45:41 +08:00
|
|
|
|
/* Check that the VFD feature flags are correct */
|
|
|
|
|
if ((driver_id = H5Pget_driver(fapl)) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if (H5FDdriver_query(driver_id, &driver_flags) < 0)
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_ACCUMULATE_METADATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_POSIX_COMPAT_HANDLE)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_SUPPORTS_SWMR_IO)) TEST_ERROR
|
|
|
|
|
if(!(driver_flags & H5FD_FEAT_DEFAULT_VFD_COMPATIBLE)) TEST_ERROR
|
|
|
|
|
/* Check for extra flags not accounted for above */
|
|
|
|
|
if(driver_flags != (H5FD_FEAT_AGGREGATE_METADATA
|
|
|
|
|
| H5FD_FEAT_ACCUMULATE_METADATA
|
|
|
|
|
| H5FD_FEAT_DATA_SIEVE
|
|
|
|
|
| H5FD_FEAT_AGGREGATE_SMALLDATA
|
|
|
|
|
| H5FD_FEAT_POSIX_COMPAT_HANDLE
|
|
|
|
|
| H5FD_FEAT_SUPPORTS_SWMR_IO
|
|
|
|
|
| H5FD_FEAT_DEFAULT_VFD_COMPATIBLE))
|
|
|
|
|
TEST_ERROR
|
|
|
|
|
|
2011-04-09 05:31:31 +08:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
/* Check that the driver is correct */
|
|
|
|
|
if(H5FD_WINDOWS!= H5Pget_driver(access_fapl))
|
|
|
|
|
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 guarantee 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;
|
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
/* Close and delete the file */
|
2011-04-09 05:31:31 +08:00
|
|
|
|
if(H5Fclose(file) < 0)
|
|
|
|
|
TEST_ERROR;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_delete_test_file(FILENAME[8], fapl);
|
|
|
|
|
|
|
|
|
|
/* Close the fapl */
|
|
|
|
|
if(H5Pclose(fapl) < 0)
|
|
|
|
|
TEST_ERROR;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
PASSED();
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
error:
|
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
|
H5Pclose(fapl);
|
|
|
|
|
H5Fclose(file);
|
|
|
|
|
} H5E_END_TRY;
|
|
|
|
|
return -1;
|
|
|
|
|
|
2011-09-07 00:50:32 +08:00
|
|
|
|
#endif /* H5_HAVE_WINDOWS */
|
2016-08-20 00:30:05 +08:00
|
|
|
|
} /* end test_windows() */
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: main
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*
|
2005-06-24 22:32:05 +08:00
|
|
|
|
* Purpose: Tests the basic features of Virtual File Drivers
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*
|
2011-04-09 05:31:31 +08:00
|
|
|
|
* Return: Success: 0
|
|
|
|
|
* Failure: 1
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*
|
2005-06-24 22:32:05 +08:00
|
|
|
|
* Programmer: Raymond Lu
|
|
|
|
|
* Tuesday, Sept 24, 2002
|
2005-08-14 04:53:35 +08:00
|
|
|
|
*
|
2005-06-24 22:32:05 +08:00
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
main(void)
|
2005-08-14 04:53:35 +08:00
|
|
|
|
{
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
int nerrors = 0;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2016-08-20 00:30:05 +08:00
|
|
|
|
h5_reset();
|
|
|
|
|
|
|
|
|
|
HDprintf("Testing basic Virtual File Driver functionality.\n");
|
2011-04-09 05:31:31 +08:00
|
|
|
|
|
|
|
|
|
nerrors += test_sec2() < 0 ? 1 : 0;
|
|
|
|
|
nerrors += test_core() < 0 ? 1 : 0;
|
2015-09-14 11:58:59 +08:00
|
|
|
|
nerrors += test_direct() < 0 ? 1 : 0;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
nerrors += test_family() < 0 ? 1 : 0;
|
|
|
|
|
nerrors += test_family_compat() < 0 ? 1 : 0;
|
|
|
|
|
nerrors += test_multi() < 0 ? 1 : 0;
|
2011-06-22 23:47:57 +08:00
|
|
|
|
nerrors += test_multi_compat() < 0 ? 1 : 0;
|
2011-04-09 05:31:31 +08:00
|
|
|
|
nerrors += test_log() < 0 ? 1 : 0;
|
|
|
|
|
nerrors += test_stdio() < 0 ? 1 : 0;
|
|
|
|
|
nerrors += test_windows() < 0 ? 1 : 0;
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
if(nerrors) {
|
2016-08-20 00:30:05 +08:00
|
|
|
|
HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
|
2015-09-14 11:58:59 +08:00
|
|
|
|
nerrors, nerrors > 1 ? "S" : "");
|
|
|
|
|
return 1;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
} /* end if */
|
|
|
|
|
|
|
|
|
|
HDprintf("All Virtual File Driver tests passed.\n");
|
2005-06-24 22:32:05 +08:00
|
|
|
|
|
|
|
|
|
return 0;
|
2016-08-20 00:30:05 +08:00
|
|
|
|
} /* end main() */
|
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().
Add regression tests for H5Acreate1().
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-05 06:19:07 +08:00
|
|
|
|
|