summaryrefslogtreecommitdiffstats
path: root/tools/test/h5repack
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2018-03-09 22:57:54 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2018-03-09 22:57:54 (GMT)
commita5d95ec0832d8b24e44277b3bdb90b21ea16ff2d (patch)
treeab4a705acd06c1df3aa6f54652804ce5ddb7e4f2 /tools/test/h5repack
parent3093cb5bbac5d91d16787f998346dc0270322597 (diff)
parent2a5d608f7bf5f99fb61898a331fde2ccc170117e (diff)
downloadhdf5-a5d95ec0832d8b24e44277b3bdb90b21ea16ff2d.zip
hdf5-a5d95ec0832d8b24e44277b3bdb90b21ea16ff2d.tar.gz
hdf5-a5d95ec0832d8b24e44277b3bdb90b21ea16ff2d.tar.bz2
Merge branch 'develop' into hdf5_1_10_merge
Diffstat (limited to 'tools/test/h5repack')
-rw-r--r--tools/test/h5repack/CMakeTests.cmake69
-rw-r--r--tools/test/h5repack/h5repack.sh.in98
-rw-r--r--tools/test/h5repack/testfiles/bounds_latest_latest.h5bin0 -> 82048 bytes
3 files changed, 165 insertions, 2 deletions
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index 13ebd17..f40c0b1 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -53,6 +53,7 @@
# Copy all the HDF5 files from the source directory into the test directory
# --------------------------------------------------------------------
set (LIST_HDF5_TEST_FILES
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/bounds_latest_latest.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_attr.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_attr_refs.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_deflate.h5
@@ -582,6 +583,62 @@
endif ()
endmacro ()
+# VERIFY_SUPERBLOCK
+ macro (ADD_H5_VERIFY_SUPERBLOCK testname testfile lowbound highbound superblock)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/out-${testname}.${testfile}
+ testfiles/${testfile}-${testname}-v.out
+ testfiles/${testfile}-${testname}-v.out.err
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}
+ COMMAND $<TARGET_FILE:h5repack> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects)
+ add_test (
+ NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-H;-B;out-${testname}.${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testfile}-${testname}-v.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_FILTER:STRING=SUPERBLOCK_VERSION ${superblock}"
+ -D "TEST_REFERENCE=SUPERBLOCK_VERSION ${superblock}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
+ )
+ set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname})
+ endif ()
+ endmacro ()
+
+ macro (ADD_H5_VERIFY_INVALIDBOUNDS testname resultcode lowbound highbound)
+ add_test (
+ NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/out-${testname}.${testfile}
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}
+ COMMAND $<TARGET_FILE:h5repack> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (
+ ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES
+ DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects
+ WILL_FAIL "true"
+ )
+ endmacro ()
+
macro (ADD_H5_TEST_META testname testfile)
# Remove any output file left over from previous test run
add_test (
@@ -1371,6 +1428,18 @@
ADD_H5_VERIFY_VDS (vds_conti ${TESTTYPE} 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI)
##############################################################################
+### V E R S I O N B O U N D S T E S T S
+##############################################################################
+# -j 0 -k 2, superblock will be 0
+ADD_H5_VERIFY_SUPERBLOCK (SB_IS_0 h5repack_layout.h5 0 2 0)
+# -j 1 -k 2, superblock will be 2
+ADD_H5_VERIFY_SUPERBLOCK (SB_IS_2 h5repack_layout.h5 1 2 2)
+# -j 2 -k 2, superblock will be 3
+ADD_H5_VERIFY_SUPERBLOCK (SB_IS_3 h5repack_layout.h5 2 2 3)
+# -j 0 -k 1, file cannot be opened
+ADD_H5_VERIFY_INVALIDBOUNDS (latest_latest_invalid bounds_latest_latest.h5 0 1)
+
+##############################################################################
### P L U G I N T E S T S
##############################################################################
ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,0,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE})
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index e474bc3..b0a2f99 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -82,6 +82,7 @@ test -d $TESTDIR || mkdir $TESTDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_HDF5_TEST_FILES="
+$SRC_H5REPACK_TESTFILES/bounds_latest_latest.h5
$SRC_H5REPACK_TESTFILES/h5repack_attr.h5
$SRC_H5REPACK_TESTFILES/h5repack_attr_refs.h5
$SRC_H5REPACK_TESTFILES/h5repack_deflate.h5
@@ -340,8 +341,8 @@ VERIFY_LAYOUT_DSET()
fi
# clean up tmp files
- rm -f $outfile
- rm -f $layoutfile
+# rm -f $outfile
+# rm -f $layoutfile
}
#------------------------------------------
@@ -513,6 +514,87 @@ VERIFY_LAYOUT_ALL()
rm -f $layoutfile
}
+#--------------------------------------------------------------
+# Verifying superblock of a file with different version bounds
+VERIFY_SUPERBLOCK()
+{
+ lowbound=$1
+ highbound=$2
+ superblock=$3
+ infile=$4
+ layoutfile=verbounds-low$lowbound-high$highbound.$4
+ outfile=out-verbounds-low$lowbound-high$highbound.$infile
+ expectedsuperblock="SUPERBLOCK_VERSION $superblock"
+
+ shift
+ shift
+ shift
+ shift
+
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN -j $lowbound -k $highbound $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ DIFFTEST $infile $outfile
+ fi
+
+ #---------------------------------
+ # check the layout from a dataset
+ VERIFY "superblock"
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DUMP_BIN -H -B $outfile > $layoutfile
+ )
+ $GREP "$expectedsuperblock" $TESTDIR/$layoutfile > /dev/null
+ if [ $? -eq 0 ]; then
+ echo " PASSED"
+ else
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+ # clean up tmp files
+ rm -f $outfile
+ rm -f $layoutfile
+
+} # end of VERIFY_SUPERBLOCK
+
+#------------------------------------------------------------------
+# Verifying that a latest file cannot be opened with earlier bounds
+VERIFY_INVALIDBOUNDS()
+{
+ lowbound=$1
+ highbound=$2
+ infile=$3
+ outfile=out-verbounds-low$lowbound-high$highbound.$infile
+
+ #--------------------------------------
+ # check for failure with invalid bounds
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN -j $lowbound -k $highbound $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+ # clean up tmp files
+ rm -f $outfile
+
+} # end of VERIFY_INVALIDBOUNDS
+
# same as TOOLTEST, but it uses the old syntax -i input_file -o output_file
#
TOOLTEST0()
@@ -1365,6 +1447,18 @@ else
VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI
fi
+#########################################################
+# Testing version bounds
+#########################################################
+# -j 0 -k 2, superblock will be 0
+VERIFY_SUPERBLOCK 0 2 0 h5repack_layout.h5 -j 0 -k 2 h5repack_layout.h5
+# -j 1 -k 2, superblock will be 2
+VERIFY_SUPERBLOCK 1 2 2 h5repack_layout.h5 -j 1 -k 2 h5repack_layout.h5
+# -j 2 -k 2, superblock will be 3
+VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5
+# -j 0 -k 1, file cannot be opened
+VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5
+
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR
diff --git a/tools/test/h5repack/testfiles/bounds_latest_latest.h5 b/tools/test/h5repack/testfiles/bounds_latest_latest.h5
new file mode 100644
index 0000000..6e8bcad
--- /dev/null
+++ b/tools/test/h5repack/testfiles/bounds_latest_latest.h5
Binary files differ