diff options
Diffstat (limited to 'test/swmr_start_write.c')
-rw-r--r-- | test/swmr_start_write.c | 165 |
1 files changed, 0 insertions, 165 deletions
diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c index 2d5c3f9..af4b743 100644 --- a/test/swmr_start_write.c +++ b/test/swmr_start_write.c @@ -40,11 +40,6 @@ static hid_t create_file(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned random_seed); static int create_datasets(hid_t fid, int comp_level, hbool_t verbose, FILE *verbose_file, const char *index_type); -static int create_close_datasets(hid_t fid, int comp_level, hbool_t verbose, - FILE *verbose_file); -static int open_datasets(hid_t fid, hbool_t verbose, FILE *verbose_file); -static hid_t open_file(const char *filename, hbool_t verbose, - FILE *verbose_file); static int add_records(hid_t fid, hbool_t verbose, FILE *verbose_file, unsigned long nrecords, unsigned long flush_count); static void usage(void); @@ -212,166 +207,6 @@ create_datasets(hid_t fid, int comp_level, hbool_t verbose, FILE *verbose_file, /*------------------------------------------------------------------------- - * Function: create_close_datasets - * - * Purpose: Create and close datasets which will be used for testing - * H5Fstart_swmr_write(). - * - * Parameters: - * fid: file ID for the SWMR test file - * comp_level: the compresssion level - * verbose: whether verbose console output is desired. - * verbose_file: file pointer for verbose output - * - * Return: Success: 0 - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -static int -create_close_datasets(hid_t fid, int comp_level, hbool_t verbose, FILE *verbose_file) -{ - hid_t dcpl; /* Dataset creation property list */ - hid_t tid; /* Datatype for dataset elements */ - hid_t sid; /* Dataspace ID */ - hsize_t dims[2] = {1, 0}; /* Dataset starting dimensions */ - hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* Dataset maximum dimensions */ - hsize_t chunk_dims[2] = {1, CHUNK_SIZE}; /* Chunk dimensions */ - unsigned u, v; /* Local index variable */ - - /* Create datatype for creating datasets */ - if((tid = create_symbol_datatype()) < 0) - return -1; - - /* Create dataspace for creating datasets */ - if((sid = H5Screate_simple(2, dims, max_dims)) < 0) - return -1; - - /* Create dataset creation property list */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - return -1; - if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - return -1; - if(comp_level >= 0) { - if(H5Pset_deflate(dcpl, (unsigned)comp_level) < 0) - return -1; - } /* end if */ - - /* Emit informational message */ - if(verbose) - HDfprintf(verbose_file, "Creating datasets\n"); - - /* Create the datasets */ - for(u = 0; u < NLEVELS; u++) - for(v = 0; v < symbol_count[u]; v++) { - hid_t dsid; /* Dataset ID */ - char name_buf[64]; - - generate_name(name_buf, u, v); - if((dsid = H5Dcreate2(fid, name_buf, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - return -1; - - if(H5Dclose(dsid) < 0) - return -1; - } /* end for */ - - /* Closing */ - if(H5Pclose(dcpl) < 0) - return -1; - if(H5Sclose(sid) < 0) - return -1; - if(H5Tclose(tid) < 0) - return -1; - - return 0; -} /* create_close_datasets() */ - - -/*------------------------------------------------------------------------- - * Function: open_file - * - * Purpose: Opens the HDF5 test file without SWMR access. - * - * Parameters: - * filename: The filename of the HDF5 file to open - * verbose: whether or not to emit verbose console messages - * verbose_file: file pointer for verbose output - * - * Return: Success: The file ID of the opened SWMR file - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -static hid_t -open_file(const char *filename, hbool_t verbose, FILE *verbose_file) -{ - hid_t fid; /* File ID for new HDF5 file */ - hid_t fapl; /* File access property list */ - - HDassert(filename); - - /* Create file access property list */ - if((fapl = h5_fileaccess()) < 0) - return -1; - - /* Set to use the latest library format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; - - /* Emit informational message */ - if(verbose) - HDfprintf(verbose_file, "Opening the file without SWMR access: %s\n", filename); - - /* Open the file */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - return -1; - - /* Close file access property list */ - if(H5Pclose(fapl) < 0) - return -1; - - return fid; -} /* Open file() */ - - - -/*------------------------------------------------------------------------- - * Function: open_datasets - * - * Purpose: Opens the datasets. - * - * Parameters: - * filename: the filename of the SWMR HDF5 file to open - * verbose: whether or not to emit verbose console messages - * verbose_file: file pointer for verbose output - * - * Return: Success: 0 - * Failure: -1 - * - *------------------------------------------------------------------------- - */ -static int -open_datasets(hid_t fid, hbool_t verbose, FILE *verbose_file) -{ - unsigned u, v; /* Local index variable */ - - /* Emit informational message */ - if(verbose) - HDfprintf(verbose_file, "Opening datasets\n"); - - /* Open the datasets */ - for(u = 0; u < NLEVELS; u++) - for(v = 0; v < symbol_count[u]; v++) { - if((symbol_info[u][v].dsid = H5Dopen2(fid, symbol_info[u][v].name, H5P_DEFAULT)) < 0) - return -1; - symbol_info[u][v].nrecords = 0; - } /* end for */ - - return 0; -} /* open_datasets() */ - - -/*------------------------------------------------------------------------- * Function: add_records * * Purpose: Writes a specified number of records to random datasets in |