summaryrefslogtreecommitdiffstats
path: root/tools/test/h5repack/h5repack.sh.in
diff options
context:
space:
mode:
authorJacob Smith <jake.smith@hdfgroup.org>2019-05-30 20:45:53 (GMT)
committerJacob Smith <jake.smith@hdfgroup.org>2019-05-30 20:45:53 (GMT)
commita648183cc38e71f7393702c3ad11bf5ccb7a74a4 (patch)
treeb2991dd1def27c0ede088f8f4d8a95b1b2b21676 /tools/test/h5repack/h5repack.sh.in
parent449d6807d5f81eff9db7356eed918d459154ee6c (diff)
downloadhdf5-a648183cc38e71f7393702c3ad11bf5ccb7a74a4.zip
hdf5-a648183cc38e71f7393702c3ad11bf5ccb7a74a4.tar.gz
hdf5-a648183cc38e71f7393702c3ad11bf5ccb7a74a4.tar.bz2
Add initial failing test for h5repack copying external data into new file.
Diffstat (limited to 'tools/test/h5repack/h5repack.sh.in')
-rw-r--r--tools/test/h5repack/h5repack.sh.in93
1 files changed, 92 insertions, 1 deletions
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index 282ba76..9851e89 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -115,6 +115,8 @@ $SRC_H5REPACK_TESTFILES/h5repack_fsm_aggr_persist.h5
$SRC_H5REPACK_TESTFILES/h5repack_none.h5
$SRC_H5REPACK_TESTFILES/h5repack_paged_nopersist.h5
$SRC_H5REPACK_TESTFILES/h5repack_paged_persist.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_ex.h5
$SRC_H5DIFF_TESTFILES/h5diff_attr1.h5
$SRC_TOOLS_TESTFILES/tfamily00000.h5
$SRC_TOOLS_TESTFILES/tfamily00001.h5
@@ -160,6 +162,7 @@ $SRC_H5REPACK_TESTFILES/ublock.bin
$SRC_H5REPACK_TESTFILES/h5repack.info
$SRC_H5REPACK_TESTFILES/crtorder.tordergr.h5.ddl
$SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_ex-0.dat
$SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl
$SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst
$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
@@ -599,8 +602,91 @@ VERIFY_INVALIDBOUNDS()
} # end of VERIFY_INVALIDBOUNDS
+# -----------------------------------------------------------------------------
+# Expect h5diff to fail
+# -----------------------------------------------------------------------------
+DIFFFAIL()
+{
+ VERIFY h5diff unequal $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
+ )
+ RET=$?
+ if [ $RET == 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+}
+
+# -----------------------------------------------------------------------------
+# Catchall test for repacking with external files
+# Loops over all (internally-listed) cases and applies the given arguments
+# to h5repack.
+# Expects case files to be of format:
+# + h5repack_<NAME>.h5
+# + h5repack_<NAME>_ex.h5
+# + h5repack_<NAME>_ex-<N>.dat
+# ...where NAME is part of the internal list, and N is a positive decimal
+# number; multiple external files (*.dat) are allowed per file, but they must
+# follow the same pattern and be in numerical sequence starting at 0.
+# -----------------------------------------------------------------------------
+VERIFY_EXTERNAL_CONSOLIDATION()
+{
+ for name in int32le
+ do
+ basename="h5repack_${name}"
+ base_ext="${basename}_ex"
+ base_rpkg="${basename}_rp"
+ canonical="${basename}.h5"
+ external="${base_ext}.h5"
+ ex_dat="${base_ext}-0.dat"
+ ex_dat_mv="__${ext_dat}"
+ repacked="${base_rpkg}.h5"
+ prev_nerrors=$nerrors
+
+ TESTING external consolidation on $name with h5repack $@
+ echo " . . ."
+
+ # baseline comparison of known files
+ DIFFTEST $canonical $external
+
+ # repack the external file, verify integrity
+ ( cd $TESTDIR
+ $H5REPACK_BIN $@ $external $repacked
+ )
+ DIFFTEST $repacked $canonical
+ DIFFTEST $repacked $external
+
+ # invalidate external file by moving its data file; verify
+ ( cd $TESTDIR
+ mv $ex_dat $ex_dat_mv
+ )
+ DIFFFAIL $canonical $external
+ DIFFFAIL $repacked $external
+ DIFFTEST $canonical $repacked
+
+ # reset test state for re-runs with different h5repack arguments
+ ( cd $TESTDIR
+ mv $ex_dat_mv $ex_dat
+ rm $repacked
+ )
+
+ # flag if any of the above checks failed
+ if [ $prev_nerrors != $nerrors ]; then
+ echo ". . . *FAILED*"
+ nerrors="`expr $prev_nerrors + 1`"
+ else
+ echo ". . . PASSED"
+ fi
+ done
+} # end VERIFY_EXTERNAL_CONSOLIDATION
+
+# -----------------------------------------------------------------------------
# same as TOOLTEST, but it uses the old syntax -i input_file -o output_file
-#
+# -----------------------------------------------------------------------------
TOOLTEST0()
{
infile=$2
@@ -1464,6 +1550,11 @@ 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
+#
+# Testing external storage
+#
+VERIFY_EXTERNAL_CONSOLIDATION
+
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR