summaryrefslogtreecommitdiffstats
path: root/tools/h5repack
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2013-08-23 04:55:15 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2013-08-23 04:55:15 (GMT)
commitd8a0a14591c902c21497f4fc7aab7ea9a35caee4 (patch)
treed77637306313312d02d7b7a88117b1d61a3baf00 /tools/h5repack
parent66921438dd3903b70ad3d4013c8726db3f6b69bd (diff)
downloadhdf5-d8a0a14591c902c21497f4fc7aab7ea9a35caee4.zip
hdf5-d8a0a14591c902c21497f4fc7aab7ea9a35caee4.tar.gz
hdf5-d8a0a14591c902c21497f4fc7aab7ea9a35caee4.tar.bz2
[svn-r24062] Bring revisions #24030 - 24058 from trunk to revise_chunks.
h5committested.
Diffstat (limited to 'tools/h5repack')
-rw-r--r--tools/h5repack/CMakeTests.cmake40
-rw-r--r--tools/h5repack/h5repack.c2
-rw-r--r--tools/h5repack/h5repack.sh.in53
-rw-r--r--tools/h5repack/h5repack_copy.c10
-rw-r--r--tools/h5repack/h5repack_main.c2
-rw-r--r--tools/h5repack/testfiles/h5repack_layout.h5.ddl130
6 files changed, 231 insertions, 6 deletions
diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake
index 79d75a7..c27aaa0 100644
--- a/tools/h5repack/CMakeTests.cmake
+++ b/tools/h5repack/CMakeTests.cmake
@@ -82,6 +82,7 @@
${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_ext.bin
${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/ublock.bin
${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack.info
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5.ddl
# tools/testfiles
${HDF5_TOOLS_SRC_DIR}/testfiles/h5repack_filters.h5.ddl
)
@@ -163,7 +164,9 @@
ELSE (${testtype} STREQUAL "SKIP")
# If using memchecker add tests without using scripts
IF (HDF5_ENABLE_USING_MEMCHECKER)
- ADD_TEST (NAME H5REPACK_CMP-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN} testfiles/${resultfile} testfiles/out-${testname}.${resultfile})
+ ADD_TEST (
+ NAME H5REPACK_CMP-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile})
ELSE (HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (
NAME H5REPACK_CMP-${testname}
@@ -184,6 +187,39 @@
ENDIF (${testtype} STREQUAL "SKIP")
ENDMACRO (ADD_H5_CMP_TEST)
+ MACRO (ADD_H5_DMP_TEST testname testtype resultcode resultfile)
+ IF (${testtype} STREQUAL "SKIP")
+ IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5REPACK_DMP-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}"
+ )
+ ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ELSE (${testtype} STREQUAL "SKIP")
+ # If using memchecker add tests without using scripts
+ ADD_TEST (
+ NAME H5REPACK_DMP-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile})
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5REPACK_DMP-${testname} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5REPACK_DMP-h5dump-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-pH;./testfiles/out-${testname}.${resultfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${resultfile}-${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=testfiles/${resultfile}.ddl"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}")
+ ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_DMP_TEST)
+
MACRO (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter)
IF (${testtype} STREQUAL "SKIP")
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -768,7 +804,7 @@
IF (NOT USE_FILTER_DEFLATE)
SET (TESTTYPE "SKIP")
ENDIF (NOT USE_FILTER_DEFLATE)
- ADD_H5_TEST (deflate_limit ${TESTTYPE} ${arg})
+ ADD_H5_DMP_TEST (deflate_limit ${TESTTYPE} 0 ${arg})
#file
SET (arg ${FILE4} -e ${INFO_FILE})
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index dda81cf..5d30bf2 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -93,7 +93,7 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
int k, n;
HDmemset(options, 0, sizeof(pack_opt_t));
- options->min_comp = 1024;
+ options->min_comp = 0;
options->verbose = verbose;
options->latest = latest;
options->layout_g = H5D_LAYOUT_ERROR;
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index ca25183..42b8ecb 100644
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -120,6 +120,7 @@ LIST_OTHER_TEST_FILES="
$SRC_H5REPACK_TESTFILES/h5repack_ext.bin
$SRC_H5REPACK_TESTFILES/ublock.bin
$SRC_H5REPACK_TESTFILES/h5repack.info
+$SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl
$SRC_TOOLS_TESTFILES/h5repack_filters.h5.ddl
"
@@ -201,7 +202,7 @@ DIFFTEST()
fi
}
-
+
# Call h5repack
#
@@ -475,6 +476,54 @@ TOOLTESTV()
rm -f $actual $actual_err
rm -f $outfile
}
+
+# This is same as TOOLTESTV() with comparing h5dump output
+# from -pH option
+#
+TOOLTEST_DUMP()
+{
+ infile=$TESTDIR/$2
+ outfile=$TESTDIR/out-$1.$2
+ expect="$TESTDIR/$2.ddl"
+ actual="$TESTDIR/out-$1.$2.out"
+ actual_err="$TESTDIR/out-$1.$2.err"
+
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ VERIFY h5dump output $@
+ (
+ $RUNSERIAL $H5DUMP_BIN -pH $outfile
+ ) >$actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ RET=$?
+
+ fi
+
+ if cmp -s $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /'
+ fi
+
+ rm -f $actual $actual_err
+ rm -f $outfile
+}
# TOOLTEST_META:
# Test metadata block size option.
@@ -820,7 +869,7 @@ arg="h5repack_layout.h5 -f GZIP=1 -m 1024"
if test $USE_FILTER_DEFLATE != "yes" ; then
SKIP $arg
else
- TOOLTEST deflate_limit $arg
+ TOOLTEST_DUMP deflate_limit $arg
fi
#file
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index f9dd334..02337fd 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -1017,6 +1017,16 @@ int do_copy_objects(hid_t fidin,
/* get the storage size of the input dataset */
dsize_in=H5Dget_storage_size(dset_in);
+ /* check for small size datasets (less than 1k) except
+ * changing to COMPACT. For the reference, COMPACT is limited
+ * by size 64K by library.
+ */
+ if (options->layout_g != H5D_COMPACT)
+ {
+ if ( size_dset < options->min_comp )
+ apply_s=0;
+ }
+
/* apply the filter */
if (apply_s)
{
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index 51276ea..05ff447 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -180,7 +180,7 @@ static void usage(const char *prog)
printf("\n");
- printf(" M - is an integer greater than 1, size of dataset in bytes (default is 1024) \n");
+ printf(" M - is an integer greater than 1, size of dataset in bytes (default is 0) \n");
printf(" E - is a filename.\n");
printf(" S - is an integer\n");
printf(" U - is a filename.\n");
diff --git a/tools/h5repack/testfiles/h5repack_layout.h5.ddl b/tools/h5repack/testfiles/h5repack_layout.h5.ddl
new file mode 100644
index 0000000..d380201
--- /dev/null
+++ b/tools/h5repack/testfiles/h5repack_layout.h5.ddl
@@ -0,0 +1,130 @@
+HDF5 "./testfiles/out-deflate_limit.h5repack_layout.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE 0
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE 0
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset3" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE 0
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset4" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE 0
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_chunk" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 20, 10 )
+ SIZE 1283 (2.494:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE 0
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_compact" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE 0
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_contiguous" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE 0
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+}
+}