summaryrefslogtreecommitdiffstats
path: root/tools/test/h5repack/h5repack.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'tools/test/h5repack/h5repack.sh.in')
-rw-r--r--tools/test/h5repack/h5repack.sh.in96
1 files changed, 94 insertions, 2 deletions
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index e474bc3..a34b75c 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -340,8 +340,8 @@ VERIFY_LAYOUT_DSET()
fi
# clean up tmp files
- rm -f $outfile
- rm -f $layoutfile
+# rm -f $outfile
+# rm -f $layoutfile
}
#------------------------------------------
@@ -513,6 +513,86 @@ 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
+echo "$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
+
+ 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 +1445,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