summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-04-06 02:57:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-04-06 02:57:06 (GMT)
commitd5a62239587f7cc5de301fa5c6b0919807689818 (patch)
tree40a36d60dd8ac2d10a45886869cc53d3fdc9181e /tools/h5repack
parentebf3d99b955c705217227fb7f8ae4405e941399a (diff)
downloadhdf5-d5a62239587f7cc5de301fa5c6b0919807689818.zip
hdf5-d5a62239587f7cc5de301fa5c6b0919807689818.tar.gz
hdf5-d5a62239587f7cc5de301fa5c6b0919807689818.tar.bz2
[svn-r22254] Description:
Bring r22085:22251 from trunk to revise_chunks branch. Also tackle some testing issues in test/objcopy.c test and clean up some warnings. Tested on: FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode FreeBSD/64 8.2 (freedom) w/gcc4.6, 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 (koala) 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, w/threadsafe, in production mode Linux/PPC 2.6 (ostrich) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (ember) w/Intel compilers, w/paralle, C++ & FORTRAN, in production mode Mac OS X/32 10.7.3 (amazon) in debug mode Mac OS X/32 10.7.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.7.3 (amazon) w/parallel, in debug mode
Diffstat (limited to 'tools/h5repack')
-rw-r--r--tools/h5repack/CMakeLists.txt70
-rw-r--r--tools/h5repack/h5repack.c5
-rw-r--r--tools/h5repack/h5repack.h5
-rw-r--r--[-rwxr-xr-x]tools/h5repack/h5repack.sh.in61
-rw-r--r--tools/h5repack/h5repack_copy.c154
-rw-r--r--tools/h5repack/h5repack_main.c70
-rw-r--r--tools/h5repack/h5repacktst.c181
7 files changed, 328 insertions, 218 deletions
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt
index 6460375..ae7a658 100644
--- a/tools/h5repack/CMakeLists.txt
+++ b/tools/h5repack/CMakeLists.txt
@@ -145,6 +145,31 @@ IF (BUILD_TESTING)
##############################################################################
##############################################################################
+ MACRO (ADD_H5_TEST_OLD testname testtype testfile)
+ IF (${testtype} STREQUAL "SKIP")
+ IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5REPACK-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}"
+ )
+ ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ELSE (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ ADD_TEST (
+ NAME H5REPACK-DIFF_${testname}
+ COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}
+ )
+ SET_TESTS_PROPERTIES (H5REPACK-DIFF_${testname} PROPERTIES DEPENDS H5REPACK-${testname})
+ SET (last_test "H5REPACK-DIFF_${testname}")
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_TEST_OLD)
+
MACRO (ADD_H5_TEST testname testtype testfile)
IF (${testtype} STREQUAL "SKIP")
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -261,6 +286,29 @@ IF (BUILD_TESTING)
ENDIF (${testtype} STREQUAL "SKIP")
ENDMACRO (ADD_H5_VERIFY_TEST)
+ MACRO (ADD_H5_TEST_META testname testfile)
+ ADD_TEST (
+ NAME H5REPACK-${testname}_N
+ COMMAND $<TARGET_FILE:h5repack> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out_N.${testname}.h5
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5REPACK-${testname}_N PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ ADD_TEST (
+ NAME H5REPACK-${testname}_M
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out_M.${testname}.h5
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5REPACK-${testname}_M PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ ADD_TEST (NAME H5REPACK-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/testfiles/out_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out_M.${testname}.h5)
+ SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES WILL_FAIL "true")
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5REPACK-${testname}")
+ ENDMACRO (ADD_H5_TEST_META)
+
##############################################################################
##############################################################################
### T H E T E S T S ###
@@ -278,8 +326,10 @@ IF (BUILD_TESTING)
./testfiles/h5repack_layout2.h5-v.out.err
./testfiles/h5repack_layout.h5-v.out
./testfiles/h5repack_layout.h5-v.out.err
+ ./testfiles/out.tfamily%05d.h5
./testfiles/out.h5diff_attr1.h5
./testfiles/out.h5repack_attr.h5
+ ./testfiles/out.h5repack_attr_refs.h5
./testfiles/out.h5repack_deflate.h5
./testfiles/out.h5repack_early.h5
./testfiles/out.h5repack_fill.h5
@@ -295,6 +345,10 @@ IF (BUILD_TESTING)
./testfiles/out.h5repack_refs.h5
./testfiles/out.h5repack_shuffle.h5
./testfiles/out.h5repack_soffset.h5
+ ./testfiles/out_M.meta_short.h5
+ ./testfiles/out_N.meta_short.h5
+ ./testfiles/out_M.meta_long.h5
+ ./testfiles/out_N.meta_long.h5
# from the h5repacktst
h5repack_attr.h5
h5repack_attr_out.h5
@@ -762,7 +816,7 @@ IF (BUILD_TESTING)
IF (NOT USE_FILTER_DEFLATE)
SET (TESTTYPE "SKIP")
ENDIF (NOT USE_FILTER_DEFLATE)
-# ADD_H5_TEST (old_style_layout_short_switches ${TESTTYPE} ${arg})
+ ADD_H5_TEST_OLD (old_style_layout_short_switches ${TESTTYPE} ${arg})
# add a userblock to file
SET (arg ${FILE1} -u ${PROJECT_BINARY_DIR}/testfiles/ublock.bin -b 2048)
@@ -783,16 +837,14 @@ IF (BUILD_TESTING)
ADD_H5_TEST (committed_dt "TEST" ${FILE15})
# tests family driver (file is located in common testfiles folder, uses TOOLTEST1
-# ADD_H5_TEST ( family "FAMILY" ${FILE16})
+ ADD_H5_TEST (family "TEST" ${FILE16})
# test various references (bug 1814 and 1726)
ADD_H5_TEST (bug1814 "TEST" ${FILE_REF})
-# test attribute with various references in attribute of compund
-# or vlen datatype
-# (HDFFV-2605, 7513)
-# TODO: include this test when code portion is completed.
- ADD_H5_TEST (HDFFV-2605 "SKIP" ${FILE_ATTR_REF})
+# test attribute with various references (bug1797 / HDFFV-5932)
+# the references in attribute of compund or vlen datatype
+ ADD_H5_TEST (HDFFV-5932 "TEST" ${FILE_ATTR_REF})
# Add test for memory leak in attirbute. This test is verified by CTEST.
# 1. leak from vlen string
@@ -801,6 +853,10 @@ IF (BUILD_TESTING)
# Note: this test is experimental for sharing test file among tools
ADD_H5_TEST (HDFFV-7840 "TEST" h5diff_attr1.h5)
+# tests for metadata block size option ('-M')
+ ADD_H5_TEST_META (meta_short h5repack_layout.h5 -M 8192)
+ ADD_H5_TEST_META (meta_long h5repack_layout.h5 --metadata_block_size=8192)
+
IF (HDF5_TEST_VFD)
# Run test with different Virtual File Driver
FOREACH (vfd ${VFD_LIST})
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 05160d8..fb38bc6 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -87,11 +87,12 @@ int h5repack(const char* infile,
*/
int
-h5repack_init(pack_opt_t *options, int verbose, int latest,
+h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
H5F_file_space_type_t strategy, hsize_t threshold)
{
int k, n;
- HDmemset(options,0,sizeof(pack_opt_t));
+
+ HDmemset(options, 0, sizeof(pack_opt_t));
options->min_comp = 1024;
options->verbose = verbose;
options->latest = latest;
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 8d009a4..2bbed0a 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -104,13 +104,14 @@ typedef struct {
int verbose; /*verbose mode */
hsize_t min_comp; /*minimum size to compress, in bytes */
int use_native; /*use a native type in write */
- int latest; /*pack file with the latest file format */
+ hbool_t latest; /*pack file with the latest file format */
int grp_compact; /* Set the maximum number of links to store as header messages in the group */
int grp_indexed; /* Set the minimum number of links to store in the indexed format */
int msg_size[8]; /* Minimum size of shared messages: dataspace,
datatype, fill value, filter pipleline, attribute */
const char *ublock_filename; /* user block file name */
hsize_t ublock_size; /* user block size */
+ hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
hsize_t threshold; /* alignment threshold for H5Pset_alignment */
hsize_t alignment ; /* alignment for H5Pset_alignment */
H5F_file_space_type_t fs_strategy; /* File space handling strategy */
@@ -136,7 +137,7 @@ extern "C" {
int h5repack(const char* infile, const char* outfile, pack_opt_t *options);
int h5repack_addfilter(const char* str, pack_opt_t *options);
int h5repack_addlayout(const char* str, pack_opt_t *options);
-int h5repack_init(pack_opt_t *options, int verbose, int latest,
+int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
H5F_file_space_type_t strategy, hsize_t threshold);
int h5repack_end(pack_opt_t *options);
int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options);
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index c1cbba1..236c555 100755..100644
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -147,20 +147,25 @@ COPY_TESTFILES_TO_TESTDIR()
done
}
+# Print a $* message left justified in a field of 70 characters
+#
+MESSAGE() {
+ SPACES=" "
+ echo "$* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
#
TESTING() {
- SPACES=" "
- echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+ MESSAGE "Testing $*"
}
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Verifying".
#
VERIFY() {
- SPACES=" "
- echo "Verifying h5diff output $* $SPACES" | cut -c1-70 | tr -d '\012'
+ MESSAGE "Verifying h5diff output $*"
}
# Print a message that a test has been skipped (because a required filter
@@ -385,6 +390,49 @@ TOOLTESTV()
rm -f $actual $actual_err $actual_sav
}
+# TOOLTEST_META:
+# Test metadata block size option.
+# Reason to create a function here is to localize all special steps related to
+# metadata block size option in one place. This is a quick solution. More
+# thought out solution needed when there is more time.
+#
+# $1: test input file
+# $2:$: metadata options (either "-M size" or "--metadata_block_size=size")
+#
+# Algorithm:
+# Run it once without the metadata option ($2-$);
+# Save the result output file;
+# Run it second time with the metadata option;
+# Verify the output file of second run is larger than the one of 1st run.
+TOOLTEST_META()
+{
+ input_file=$1
+ outfile="$TESTDIR/out.$1"
+
+ # Use TOOLTEST_MAIN to run because it does not remove the output file.
+ # 1st run, without metadata option
+ TOOLTEST_MAIN $1
+ # get the size of the first output file
+ size1=`wc -c $outfile | cut -d' ' -f1`
+
+ # 2nd run with metadata option
+ TOOLTEST_MAIN $*
+ # get the size of the second output file
+ size2=`wc -c $outfile | cut -d' ' -f1`
+
+ # verify sizes.
+ MESSAGE "Verify the sizes of both output files ($size1 vs $size2)"
+ if [ $size1 -lt $size2 ]; then
+ # pass
+ echo " PASSED"
+ else
+ #fail
+ echo "*FAILED*"
+ fi
+
+ rm -f $outfile
+}
+
# This is different from $srcdir/../../bin/output_filter.sh
STDOUT_FILTER() {
result_file=$1
@@ -801,7 +849,6 @@ TOOLTEST h5repack_refs.h5
# the references in attribute of compund or vlen datatype
TOOLTEST h5repack_attr_refs.h5
-
# Add test for memory leak in attirbute. This test is verified by CTEST.
# 1. leak from vlen string
# 2. leak from compound type without reference member
@@ -809,6 +856,10 @@ TOOLTEST h5repack_attr_refs.h5
# Note: this test is experimental for sharing test file among tools
TOOLTEST h5diff_attr1.h5
+# tests for metadata block size option ('-M')
+TOOLTEST_META h5repack_layout.h5 -M 8192
+TOOLTEST_META h5repack_layout.h5 --metadata_block_size=8192
+
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
exit $EXIT_SUCCESS
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 55cf932..d38a15c 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -42,7 +42,7 @@
int _err_num = 0; \
char _msg[80]; \
H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \
- H5Eget_msg(_err_num, NULL, _msg, 80); \
+ H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \
error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \
goto error; \
} \
@@ -132,23 +132,23 @@ int copy_objects(const char* fnamein,
goto out;
}
- if(!options->fs_strategy)
- {
- if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0)
- {
- error_msg("failed to retrieve file space strategy\n");
- goto out;
- }
- }
-
- if(!options->fs_threshold)
- {
- if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0)
- {
- error_msg("failed to retrieve file space threshold\n");
- goto out;
- }
- }
+ if(!options->fs_strategy)
+ {
+ if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0)
+ {
+ error_msg("failed to retrieve file space strategy\n");
+ goto out;
+ }
+ }
+
+ if(!options->fs_threshold)
+ {
+ if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0)
+ {
+ error_msg("failed to retrieve file space threshold\n");
+ goto out;
+ }
+ }
if(H5Pclose(fcpl_in) < 0)
{
@@ -254,135 +254,113 @@ int copy_objects(const char* fnamein,
} /* end if */
} /* end if */
} /* end if */
-
-
-
-
#if defined (H5REPACK_DEBUG_USER_BLOCK)
- print_user_block(fnamein,fidin);
+ print_user_block(fnamein, fidin);
#endif
-
/*-------------------------------------------------------------------------
* set the new user userblock options in the FCPL (before H5Fcreate )
*-------------------------------------------------------------------------
*/
-
if ( options->ublock_size > 0 )
{
/* either use the FCPL already created or create a new one */
- if(fcpl != H5P_DEFAULT)
+ if(fcpl == H5P_DEFAULT)
{
- /* set user block size */
- if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
- {
- error_msg("failed to set userblock size\n");
- goto out;
- }
-
- }
-
- else
- {
-
/* create a file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
error_msg("fail to create a file creation property list\n");
goto out;
}
-
- /* set user block size */
- if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
- {
- error_msg("failed to set userblock size\n");
- goto out;
- }
-
}
-
-
+ /* set user block size */
+ if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
+ {
+ error_msg("failed to set userblock size\n");
+ goto out;
+ }
}
-
/*-------------------------------------------------------------------------
* set alignment options
*-------------------------------------------------------------------------
*/
-
-
if ( options->alignment > 0 )
{
/* either use the FAPL already created or create a new one */
- if (fapl != H5P_DEFAULT)
+ if (fapl == H5P_DEFAULT)
{
-
- if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
+ /* create a file access property list */
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
{
- error_msg("failed to set alignment\n");
+ error_msg("Could not create file access property list\n");
goto out;
}
-
}
- else
+ if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
{
+ error_msg("failed to set alignment\n");
+ goto out;
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * set metadata block size option
+ *-------------------------------------------------------------------------
+ */
+ if ( options->meta_block_size > 0 )
+ {
+ /* either use the FAPL already created or create a new one */
+ if (fapl == H5P_DEFAULT)
+ {
/* create a file access property list */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
{
error_msg("Could not create file access property list\n");
goto out;
}
-
- if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
- {
- error_msg("failed to set alignment\n");
- goto out;
- }
-
}
+ if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0)
+ {
+ error_msg("failed to set metadata block size\n");
+ goto out;
+ }
}
+ /*-------------------------------------------------------------------------
+ * set free-space strategy options
+ *-------------------------------------------------------------------------
+ */
+
/* either use the FCPL already created or create a new one */
- if(fcpl != H5P_DEFAULT)
+ if(fcpl == H5P_DEFAULT)
{
- /* set file space strategy and free space threshold */
- if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
- {
- error_msg("failed to set file space strategy & threshold\n");
- goto out;
- }
+ /* create a file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ {
+ error_msg("fail to create a file creation property list\n");
+ goto out;
+ }
}
- else
+
+ /* set file space strategy and free space threshold */
+ if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
{
- /* create a file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- {
- error_msg("fail to create a file creation property list\n");
- goto out;
- }
-
- /* set file space strategy and free space threshold */
- if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
- {
- error_msg("failed to set file space strategy & threshold \n");
- goto out;
- }
+ error_msg("failed to set file space strategy & threshold \n");
+ goto out;
}
/*-------------------------------------------------------------------------
* create the output file
*-------------------------------------------------------------------------
*/
-
-
if(options->verbose)
printf("Making file <%s>...\n",fnameout);
-
if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
error_msg("<%s>: Could not create file\n", fnameout );
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index a630559..b6b8bfa 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -35,7 +35,7 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:t:a:i:o:S:T:";
+static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:T:";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -51,6 +51,7 @@ static struct long_options l_opts[] = {
{ "ssize", require_arg, 's' },
{ "ublock", require_arg, 'u' },
{ "block", require_arg, 'b' },
+ { "metadata_block_size", require_arg, 'M' },
{ "threshold", require_arg, 't' },
{ "alignment", require_arg, 'a' },
{ "infile", require_arg, 'i' }, /* -i for backward compability */
@@ -78,24 +79,6 @@ static struct long_options l_opts[] = {
*
* Comments:
*
- * Modifications:
- * July 2004: Introduced the extra EC or NN option for SZIP
- * October 2006: Added a new switch -n, that allows to write the dataset
- * using a native type. The default to write is the file type.
- *
- * Modification:
- * Peter Cao, June 13, 2007
- * Add "-L, --latest" option to pack a file with the latest file format
- * PVN, November 19, 2007
- * adopted the syntax h5repack [OPTIONS] file1 file2
- * PVN, November 28, 2007
- * added support for multiple global filters
- * PVN, May 16, 2008
- * added backward compatibility for -i infile -o outfile
- * PVN, August 20, 2008
- * add a user block to repacked file (switches -u -b)
- * PVN, August 28, 2008
- * add options to set alignment (H5Pset_alignment) (switches -t -a)
*-------------------------------------------------------------------------
*/
int main(int argc, const char **argv)
@@ -115,7 +98,7 @@ int main(int argc, const char **argv)
HDexit(EXIT_FAILURE);
/* initialize options */
- h5repack_init(&options, 0, 0, 0, (hsize_t)0);
+ h5repack_init(&options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t)0);
parse_command_line(argc, argv, &options);
@@ -187,6 +170,7 @@ static void usage(const char *prog)
printf(" -e E, --file=E Name of file E with the -f and -l options\n");
printf(" -u U, --ublock=U Name of file U with user block data to be added\n");
printf(" -b B, --block=B Size of user block to be added\n");
+ printf(" -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n");
printf(" -t T, --threshold=T Threshold value for H5Pset_alignment\n");
printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n");
printf(" -f FILT, --filter=FILT Filter type\n");
@@ -370,36 +354,32 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'L':
- options->latest = 1;
+ options->latest = TRUE;
break;
case 'c':
-
options->grp_compact = HDatoi( opt_arg );
- if (options->grp_compact>0)
- options->latest = 1; /* must use latest format */
+ if (options->grp_compact > 0)
+ options->latest = TRUE; /* must use latest format */
break;
case 'd':
-
options->grp_indexed = HDatoi( opt_arg );
- if (options->grp_indexed>0)
- options->latest = 1; /* must use latest format */
+ if (options->grp_indexed > 0)
+ options->latest = TRUE; /* must use latest format */
break;
case 's':
-
{
-
int idx = 0;
int ssize = 0;
- char *msgPtr = HDstrchr( opt_arg, ':');
- options->latest = 1; /* must use latest format */
+ char *msgPtr = HDstrchr(opt_arg, ':');
+ options->latest = TRUE; /* must use latest format */
if (msgPtr == NULL)
{
ssize = HDatoi( opt_arg );
- for (idx=0; idx<5; idx++)
+ for(idx = 0; idx < 5; idx++)
options->msg_size[idx] = ssize;
}
else
@@ -408,27 +388,20 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
HDstrcpy(msgType, msgPtr+1);
msgPtr[0] = '\0';
ssize = HDatoi( opt_arg );
- if (HDstrncmp(msgType, "dspace",6) == 0) {
+ if(HDstrncmp(msgType, "dspace",6) == 0)
options->msg_size[0] = ssize;
- }
- else if (HDstrncmp(msgType, "dtype", 5) == 0) {
+ else if (HDstrncmp(msgType, "dtype", 5) == 0)
options->msg_size[1] = ssize;
- }
- else if (HDstrncmp(msgType, "fill", 4) == 0) {
+ else if (HDstrncmp(msgType, "fill", 4) == 0)
options->msg_size[2] = ssize;
- }
- else if (HDstrncmp(msgType, "pline", 5) == 0) {
+ else if (HDstrncmp(msgType, "pline", 5) == 0)
options->msg_size[3] = ssize;
- }
- else if (HDstrncmp(msgType, "attr", 4) == 0) {
+ else if (HDstrncmp(msgType, "attr", 4) == 0)
options->msg_size[4] = ssize;
- }
}
}
-
break;
-
case 'u':
options->ublock_filename = opt_arg;
@@ -439,6 +412,11 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
options->ublock_size = (hsize_t)HDatol( opt_arg );
break;
+ case 'M':
+
+ options->meta_block_size = (hsize_t)HDatol( opt_arg );
+ break;
+
case 't':
options->threshold = (hsize_t)HDatol( opt_arg );
@@ -455,7 +433,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'S':
- {
+ {
char strategy[MAX_NC_NAME];
HDstrcpy(strategy, opt_arg);
@@ -472,7 +450,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
HDexit(EXIT_FAILURE);
}
break;
- }
+ }
case 'T':
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 05eac2f..0caf72a 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -78,7 +78,6 @@
#define FNAME17OUT "h5repack_named_dtypes_out.h5"
#define FNAME18 "h5repack_layout2.h5"
-#define FNAME18OUT "h5repack_layout2_out.h5"
#define FNAME_UB "ublock.bin"
@@ -172,6 +171,8 @@ int main (void)
diff_opt_t diff_options;
hsize_t fs_size = 0; /* free space section threshold */
H5F_file_space_type_t fs_type = H5F_FILE_SPACE_DEFAULT; /* file space handling strategy */
+ h5_stat_t file_stat;
+ h5_stat_size_t fsize1, fsize2; /* file sizes */
#if defined (H5_HAVE_FILTER_SZIP)
int szip_can_encode = 0;
#endif
@@ -212,7 +213,7 @@ int main (void)
TESTING(" copy of datasets (fill values)");
/* fs_type = 0; fs_size = 0 */
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME0,FNAME0OUT,&pack_options) < 0)
GOERROR;
@@ -232,7 +233,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of datasets (all datatypes)");
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0)
GOERROR;
@@ -252,7 +253,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of datasets (attributes)");
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME2,FNAME2OUT,&pack_options) < 0)
GOERROR;
@@ -271,7 +272,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of datasets (hardlinks)");
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME3,FNAME3OUT,&pack_options) < 0)
GOERROR;
@@ -291,7 +292,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" copy of allocation early file");
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME5,FNAME5OUT,&pack_options) < 0)
GOERROR;
@@ -321,7 +322,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0)
GOERROR;
@@ -348,7 +349,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 1, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, TRUE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0)
GOERROR;
@@ -376,7 +377,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("GZIP=1",&pack_options) < 0)
GOERROR;
@@ -414,7 +415,7 @@ int main (void)
*/
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset2:SZIP=8,EC",&pack_options) < 0)
GOERROR;
@@ -446,7 +447,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("SZIP=8,NN",&pack_options) < 0)
GOERROR;
@@ -477,7 +478,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0)
GOERROR;
@@ -507,7 +508,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_SHUFFLE
/* fs_type = H5F_FILE_SPACE_ALL_PERSIST; fs_size = 1 */
- if (h5repack_init (&pack_options, 0, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack_addfilter("SHUF",&pack_options) < 0)
GOERROR;
@@ -536,7 +537,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset1:FLET",&pack_options) < 0)
GOERROR;
@@ -566,7 +567,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_FLETCHER32
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("FLET",&pack_options) < 0)
GOERROR;
@@ -594,7 +595,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options) < 0)
GOERROR;
@@ -640,7 +641,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
GOERROR;
@@ -662,7 +663,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 1, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, TRUE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
GOERROR;
@@ -682,7 +683,7 @@ int main (void)
*/
TESTING(" adding layout chunked to all");
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
GOERROR;
@@ -703,7 +704,7 @@ int main (void)
* test an individual object option
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:CONTI",&pack_options) < 0)
GOERROR;
@@ -724,7 +725,7 @@ int main (void)
* test all objects option
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("CONTI",&pack_options) < 0)
GOERROR;
@@ -741,7 +742,7 @@ int main (void)
* do the same test for a file with filters (chunked)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("CONTI",&pack_options) < 0)
GOERROR;
@@ -763,7 +764,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset1:COMPA",&pack_options) < 0)
GOERROR;
@@ -785,7 +786,7 @@ int main (void)
*/
/* fs_type = H5F_FILE_SPACE_ALL; fs_size = 2 */
- if (h5repack_init (&pack_options, 0, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack_addlayout("COMPA",&pack_options) < 0)
GOERROR;
@@ -807,7 +808,7 @@ int main (void)
* layout compact to contiguous conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_compact:CONTI",&pack_options) < 0)
GOERROR;
@@ -827,7 +828,7 @@ int main (void)
* layout compact to chunk conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options) < 0)
GOERROR;
@@ -847,7 +848,7 @@ int main (void)
* layout compact to compact conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_compact:COMPA",&pack_options) < 0)
GOERROR;
@@ -866,7 +867,7 @@ int main (void)
* layout contiguous to compact conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options) < 0)
GOERROR;
@@ -885,7 +886,7 @@ int main (void)
* layout contiguous to chunk conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options) < 0)
GOERROR;
@@ -905,7 +906,7 @@ int main (void)
* layout contiguous to contiguous conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options) < 0)
GOERROR;
@@ -924,7 +925,7 @@ int main (void)
* layout chunked to compact conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_chunk:COMPA",&pack_options) < 0)
GOERROR;
@@ -944,7 +945,7 @@ int main (void)
* layout chunked to contiguous conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_chunk:CONTI",&pack_options) < 0)
GOERROR;
@@ -963,7 +964,7 @@ int main (void)
* layout chunked to chunked conversion
*-------------------------------------------------------------------------
*/
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options) < 0)
GOERROR;
@@ -994,7 +995,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
/* fs_type = H5F_FILE_SPACE_AGGR_VFD; fs_size = 3 */
- if (h5repack_init (&pack_options, 0, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0)
GOERROR;
@@ -1019,7 +1020,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_szip:NONE",&pack_options) < 0)
GOERROR;
@@ -1044,7 +1045,7 @@ int main (void)
TESTING(" copy of deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0)
GOERROR;
@@ -1064,7 +1065,7 @@ int main (void)
TESTING(" removing deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
- if (h5repack_init (&pack_options, 0, 0, fs_type, ++fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, ++fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_deflate:NONE",&pack_options) < 0)
GOERROR;
@@ -1087,7 +1088,7 @@ int main (void)
TESTING(" copy of shuffle filter");
#ifdef H5_HAVE_FILTER_SHUFFLE
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0)
GOERROR;
@@ -1106,7 +1107,7 @@ int main (void)
TESTING(" removing shuffle filter");
#ifdef H5_HAVE_FILTER_SHUFFLE
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_shuffle:NONE",&pack_options) < 0)
GOERROR;
@@ -1127,7 +1128,7 @@ int main (void)
TESTING(" copy of fletcher filter");
#ifdef H5_HAVE_FILTER_FLETCHER32
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0)
GOERROR;
@@ -1146,7 +1147,7 @@ int main (void)
TESTING(" removing fletcher filter");
#ifdef H5_HAVE_FILTER_FLETCHER32
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options) < 0)
GOERROR;
@@ -1168,7 +1169,7 @@ int main (void)
TESTING(" copy of nbit filter");
#ifdef H5_HAVE_FILTER_NBIT
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0)
GOERROR;
@@ -1187,7 +1188,7 @@ int main (void)
TESTING(" removing nbit filter");
#ifdef H5_HAVE_FILTER_NBIT
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_nbit:NONE",&pack_options) < 0)
GOERROR;
@@ -1209,7 +1210,7 @@ int main (void)
TESTING(" adding nbit filter");
#ifdef H5_HAVE_FILTER_NBIT
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_int31:NBIT",&pack_options) < 0)
GOERROR;
@@ -1231,7 +1232,7 @@ int main (void)
TESTING(" copy of scaleoffset filter");
#ifdef H5_HAVE_FILTER_SCALEOFFSET
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0)
GOERROR;
@@ -1250,7 +1251,7 @@ int main (void)
TESTING(" removing scaleoffset filter");
#ifdef H5_HAVE_FILTER_SCALEOFFSET
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_scaleoffset:NONE",&pack_options) < 0)
GOERROR;
@@ -1272,7 +1273,7 @@ int main (void)
TESTING(" adding scaleoffset filter");
#ifdef H5_HAVE_FILTER_SCALEOFFSET
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_none:SOFF=31,IN",&pack_options) < 0)
GOERROR;
@@ -1311,7 +1312,7 @@ int main (void)
if (szip_can_encode) {
/* fs_type = H5F_FILE_SPACE_VFD; fs_size = 4 */
- if (h5repack_init (&pack_options, 0, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options) < 0)
GOERROR;
@@ -1339,7 +1340,7 @@ int main (void)
&& defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE)
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options) < 0)
GOERROR;
@@ -1371,7 +1372,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) \
&& defined (H5_HAVE_FILTER_FLETCHER32) && defined (H5_HAVE_FILTER_SHUFFLE)
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("NONE",&pack_options) < 0)
GOERROR;
@@ -1395,7 +1396,7 @@ int main (void)
*/
TESTING(" big file");
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME14,FNAME14OUT,&pack_options) < 0)
GOERROR;
@@ -1412,7 +1413,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" external datasets");
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack(FNAME15,FNAME15OUT,&pack_options) < 0)
GOERROR;
@@ -1429,7 +1430,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" file with userblock");
- if(h5repack_init(&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if(h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
GOERROR;
@@ -1448,7 +1449,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" latest file format options");
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
pack_options.latest=1;
pack_options.grp_compact=10;
@@ -1478,7 +1479,7 @@ int main (void)
#if defined (H5_HAVE_FILTER_DEFLATE) && defined (H5_HAVE_FILTER_SHUFFLE)
- if (h5repack_init (&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if (h5repack_addfilter("GZIP=1",&pack_options) < 0)
GOERROR;
@@ -1507,7 +1508,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if(h5repack_init(&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
/* add the options for a user block size and user block filename */
@@ -1540,7 +1541,7 @@ int main (void)
#ifdef H5_HAVE_FILTER_DEFLATE
- if(h5repack_init(&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
/* add the options for aligment */
@@ -1594,7 +1595,7 @@ int main (void)
*/
TESTING(" file with committed datatypes");
- if(h5repack_init(&pack_options, 0, 0, fs_type, fs_size) < 0)
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
GOERROR;
if(h5repack(FNAME17, FNAME17OUT, &pack_options) < 0)
@@ -1610,6 +1611,50 @@ int main (void)
PASSED();
/*-------------------------------------------------------------------------
+ * test --metadata_block_size option
+ * Also verify that output file using the metadata_block_size option is
+ * larger than the output file one not using it.
+ * FNAME4 is used because it is the same as the test file used for the
+ * shell script version of this test (h5repack.sh).
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" metadata block size option");
+ /* First run without metadata option. No need to verify the correctness */
+ /* since this has been verified by earlier tests. Just record the file */
+ /* size of the output file. */
+ if(h5repack_init(&pack_options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0)
+ GOERROR;
+ if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
+ GOERROR;
+ if(HDstat(FNAME4OUT, &file_stat) < 0)
+ GOERROR;
+ fsize1 = file_stat.st_size;
+ if(h5repack_end(&pack_options) < 0)
+ GOERROR;
+
+ /* run it again with metadata option */
+ if(h5repack_init(&pack_options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0)
+ GOERROR;
+ pack_options.meta_block_size = 8192;
+ if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
+ GOERROR;
+ if(h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if(h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
+ GOERROR;
+ /* record the file size of the output file */
+ if(HDstat(FNAME4OUT, &file_stat) < 0)
+ GOERROR;
+ fsize2 = file_stat.st_size;
+ /* verify second file size is larger than the first one */
+ if(fsize2 <= fsize1)
+ GOERROR;
+ if(h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+
+ /*-------------------------------------------------------------------------
* clean temporary test files
*-------------------------------------------------------------------------
*/
@@ -3302,7 +3347,7 @@ make_userblock(void)
/* Initialize userblock data */
for(u = 0; u < USERBLOCK_SIZE; u++)
- ub[u] = 'a' + (u % 26);
+ ub[u] = 'a' + (char)(u % 26);
/* Re-open HDF5 file, as "plain" file */
if((fd = HDopen(FNAME16, O_WRONLY, 0644)) < 0)
@@ -3415,7 +3460,7 @@ make_userblock_file(void)
/* initialize userblock data */
for(u = 0; u < USERBLOCK_SIZE; u++)
- ub[u] = 'a' + (u % 26);
+ ub[u] = 'a' + (char)(u % 26);
/* open file */
if((fd = HDopen(FNAME_UB,O_WRONLY|O_CREAT|O_TRUNC, 0644 )) < 0)
@@ -3891,7 +3936,7 @@ int write_dset_in(hid_t loc_id,
int l;
buf52[i][j].p = malloc((i + 1) * sizeof(int));
- buf52[i][j].len = i + 1;
+ buf52[i][j].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
{
if(make_diffs)
@@ -4112,7 +4157,7 @@ int write_dset_in(hid_t loc_id,
int l;
buf53[i][j][k].p = malloc((i + 1) * sizeof(int));
- buf53[i][j][k].len = i + 1;
+ buf53[i][j][k].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
{
if(make_diffs)
@@ -4903,7 +4948,7 @@ int write_attr_in(hid_t loc_id,
{
int l;
buf52[i][j].p = malloc((i + 1) * sizeof(int));
- buf52[i][j].len = i + 1;
+ buf52[i][j].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
if (make_diffs)((int *)buf52[i][j].p)[l] = 0;
else ((int *)buf52[i][j].p)[l] = n++;
@@ -5369,7 +5414,7 @@ int write_attr_in(hid_t loc_id,
{
int l;
buf53[i][j][k].p = malloc((i + 1) * sizeof(int));
- buf53[i][j][k].len = i + 1;
+ buf53[i][j][k].len = (size_t)i + 1;
for (l = 0; l < i + 1; l++)
if (make_diffs)
{
@@ -5868,7 +5913,7 @@ static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id)
}
/* select elements space for reference */
- status = H5Sselect_elements (sid_regrefed_dset, H5S_SELECT_SET, 3, coords_regrefed_dset[0]);
+ status = H5Sselect_elements (sid_regrefed_dset, H5S_SELECT_SET, (size_t)3, coords_regrefed_dset[0]);
if (status < 0)
{
fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
@@ -6190,7 +6235,7 @@ static herr_t gen_region_ref(hid_t loc_id)
}
/* select elements space for reference */
- status = H5Sselect_elements (sid_trg, H5S_SELECT_SET, 4, coords[0]);
+ status = H5Sselect_elements (sid_trg, H5S_SELECT_SET, (size_t)4, coords[0]);
if (status < 0)
{
fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
@@ -6557,7 +6602,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create the region reference
*/
- status = H5Sselect_elements (objsid, H5S_SELECT_SET, 4, coords[0]);
+ status = H5Sselect_elements (objsid, H5S_SELECT_SET, (size_t)4, coords[0]);
if (status < 0)
{
fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
@@ -6668,7 +6713,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create region reference
*/
- status = H5Sselect_elements(objsid, H5S_SELECT_SET, 4, coords[0]);
+ status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]);
if (status < 0)
{
fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);