diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2018-04-29 08:04:21 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2018-04-29 08:04:21 (GMT) |
commit | 01f196b31a03f072b685f998b0805c1f90322c2b (patch) | |
tree | 6e1cae004705ade1c870e4c6612a76b55be3c331 /test/swmr_start_write.c | |
parent | da4b69097756158fdbfcbf52b5b552e2034d263d (diff) | |
parent | b3c5284692093953132c6c8227e0980b670bf4ad (diff) | |
download | hdf5-01f196b31a03f072b685f998b0805c1f90322c2b.zip hdf5-01f196b31a03f072b685f998b0805c1f90322c2b.tar.gz hdf5-01f196b31a03f072b685f998b0805c1f90322c2b.tar.bz2 |
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into merge_hyperslab_updates
Diffstat (limited to 'test/swmr_start_write.c')
-rw-r--r-- | test/swmr_start_write.c | 175 |
1 files changed, 4 insertions, 171 deletions
diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c index ab639fb..af4b743 100644 --- a/test/swmr_start_write.c +++ b/test/swmr_start_write.c @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------- @@ -42,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); @@ -214,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 |