summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_verify.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-11-16 20:45:05 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-11-16 20:45:05 (GMT)
commitd2b87ec47ebdb096c331c7b62a195b9cea2f33ae (patch)
treea066f01361afaf5df457cef612bb0bb9fd80fe18 /tools/h5repack/h5repack_verify.c
parentee5a1e07350f0dcf3ef07d9443aa2f4c073392f4 (diff)
downloadhdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.zip
hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.tar.gz
hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.tar.bz2
[svn-r17896] Description:
Bring r17546:17895 from trunk to revise_chunks branch. Changes to fixed and extensible array dataset chunk indexing code to accommodate changes to private APIs in those interfaces. Also, other adjustments to source code and expected output in response to changes on the trunk. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.2 (amazon) in debug mode Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'tools/h5repack/h5repack_verify.c')
-rw-r--r--tools/h5repack/h5repack_verify.c113
1 files changed, 96 insertions, 17 deletions
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index 69df02c..fe94148 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -44,20 +44,25 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil
*-------------------------------------------------------------------------
*/
-int h5repack_verify(const char *fname,
- pack_opt_t *options)
+int
+h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options)
{
- hid_t fid; /* file ID */
- hid_t did; /* dataset ID */
- hid_t pid; /* dataset creation property list ID */
- hid_t sid; /* space ID */
- hid_t tid; /* type ID */
+ hid_t fidin; /* file ID for input file*/
+ hid_t fidout; /* file ID for output file*/
+ hid_t did; /* dataset ID */
+ hid_t pid; /* dataset creation property list ID */
+ hid_t sid; /* space ID */
+ hid_t tid; /* type ID */
unsigned int i;
trav_table_t *travt = NULL;
int ok = 1;
+ hid_t fcpl_in; /* file creation property for input file */
+ hid_t fcpl_out; /* file creation property for output file */
+ H5F_file_space_type_t in_strat, out_strat; /* file space handling strategy for in/output file */
+ hsize_t in_thresh, out_thresh; /* free space section threshold for in/output file */
- /* open the file */
- if((fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
+ /* open the output file */
+ if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
return -1;
for(i = 0; i < options->op_tbl->nelems; i++)
@@ -69,7 +74,7 @@ int h5repack_verify(const char *fname,
* open
*-------------------------------------------------------------------------
*/
- if((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
+ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
goto error;
if((sid = H5Dget_space(did)) < 0)
goto error;
@@ -121,7 +126,7 @@ int h5repack_verify(const char *fname,
trav_table_init(&travt);
/* get the list of objects in the file */
- if(h5trav_gettable(fid, travt) < 0)
+ if(h5trav_gettable(fidout, travt) < 0)
goto error;
for(i = 0; i < travt->nobjs; i++)
@@ -135,7 +140,7 @@ int h5repack_verify(const char *fname,
* open
*-------------------------------------------------------------------------
*/
- if((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
+ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
goto error;
if((sid = H5Dget_space(did)) < 0)
goto error;
@@ -191,26 +196,100 @@ int h5repack_verify(const char *fname,
}
/*-------------------------------------------------------------------------
- * close
+ * Verify that file space strategy and free space threshold
+ * are set as expected
*-------------------------------------------------------------------------
*/
- if (H5Fclose(fid) < 0)
- return -1;
+ /* open the input file */
+ if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
+ goto error;
+
+ /* Get file creation property list for input file */
+ if((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
+ error_msg(progname, "failed to retrieve file creation property list\n");
+ goto error;
+ }
+
+ /* Get file space management info for input file */
+ if(H5Pget_file_space(fcpl_in, &in_strat, &in_thresh) < 0) {
+ error_msg(progname, "failed to retrieve file space strategy & threshold\n");
+ goto error;
+ }
+
+ /* Output file is already opened */
+ /* Get file creation property list for output file */
+ if((fcpl_out = H5Fget_create_plist(fidout)) < 0) {
+ error_msg(progname, "failed to retrieve file creation property list\n");
+ goto error;
+ }
+
+ /* Get file space management info for output file */
+ if(H5Pget_file_space(fcpl_out, &out_strat, &out_thresh) < 0) {
+ error_msg(progname, "failed to retrieve file space strategy & threshold\n");
+ goto error;
+ }
+
+ /*
+ * If the strategy option is not set,
+ * file space handling strategy should be the same for both
+ * input & output files.
+ * If the strategy option is set,
+ * the output file's file space handling strategy should be the same
+ * as what is set via the strategy option
+ */
+ if(!options->fs_strategy && out_strat != in_strat) {
+ error_msg(progname, "file space strategy not set as unexpected\n");
+ goto error;
+
+ } else if(options->fs_strategy && out_strat!= options->fs_strategy) {
+ error_msg(progname, "file space strategy not set as unexpectec\n");
+ goto error;
+ }
+
+ /*
+ * If the threshold option is not set,
+ * the free space section threshold should be the same for both
+ * input & output files.
+ * If the threshold option is set,
+ * the output file's free space section threshold should be the same
+ * as what is set via the threshold option.
+ */
+ if(!options->fs_threshold && out_thresh != in_thresh) {
+ error_msg(progname, "free space threshold not set as unexpected\n");
+ goto error;
+
+ } else if(options->fs_threshold && out_thresh != options->fs_threshold) {
+ error_msg(progname, "free space threshold not set as unexpectec\n");
+ goto error;
+ }
+
+ /* Closing */
+ if (H5Pclose(fcpl_in) < 0)
+ goto error;
+ if (H5Pclose(fcpl_out) < 0)
+ goto error;
+ if (H5Fclose(fidin) < 0)
+ goto error;
+ if (H5Fclose(fidout) < 0)
+ goto error;
return ok;
error:
H5E_BEGIN_TRY {
+ H5Pclose(fcpl_in);
+ H5Pclose(fcpl_out);
H5Pclose(pid);
H5Sclose(sid);
H5Dclose(did);
- H5Fclose(fid);
+ H5Fclose(fidin);
+ H5Fclose(fidout);
if (travt)
trav_table_free(travt);
} H5E_END_TRY;
return -1;
-}
+} /* h5repack_verify() */