Make test scripts fail if result files are created

This commit is contained in:
Allen Byrne 2017-05-02 12:36:02 -05:00
parent 3b81a29c46
commit 7608b264e4
15 changed files with 403 additions and 333 deletions

View File

@ -381,6 +381,8 @@ CMP_OUTPUT()
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else

View File

@ -242,6 +242,8 @@ TOOLTEST() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
elif test $h5haveexitcode = 'yes' -a -z "$pmode"; then

View File

@ -502,6 +502,8 @@ TOOLTEST() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
elif test $h5haveexitcode = 'yes' -a -z "$pmode"; then

View File

@ -196,6 +196,8 @@ TOOLTEST() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual > /dev/null 2>&1 ; then
echo " PASSED"
else

View File

@ -487,6 +487,8 @@ TOOLTEST() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $xCMP $expect $actual > /dev/null 2>&1 ; then
echo " PASSED"
else
@ -529,11 +531,15 @@ TOOLTEST2() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
if [ ! -f $expectdata ]; then
# Create the expect data file if it doesn't yet exist.
echo " CREATED"
cp $actualdata $expectdata
echo " Expected data (*.exp) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expectdata $actualdata; then
echo " PASSED"
else
@ -584,16 +590,22 @@ TOOLTEST2A() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
if [ ! -f $expectdata ]; then
# Create the expect data file if it doesn't yet exist.
echo " CREATED"
cp $actualdata $expectdata
echo " Expected data (*.exp) missing"
nerrors="`expr $nerrors + 1`"
elif $DIFF $expectdata $actualdata; then
if [ ! -f $expectmeta ]; then
# Create the expect meta file if it doesn't yet exist.
echo " CREATED"
cp $actualmeta $expectmeta
echo " Expected metafile (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expectmeta $actualmeta; then
echo " PASSED"
else
@ -645,6 +657,8 @@ TOOLTEST2B() {
# Create the expect data file if it doesn't yet exist.
echo " CREATED"
cp $actualdata $expectdata
echo " Expected data (*.exp) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expectdata $actualdata; then
echo " PASSED"
else
@ -700,6 +714,8 @@ TOOLTEST3() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
@ -757,15 +773,17 @@ TOOLTEST4() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
if $CMP $expect_err $actual_ext; then
echo " PASSED"
else
echo "*FAILED*"
echo " Expected result (*.err) differs from actual result (*.oerr)"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
fi
else
echo "*FAILED*"
echo " Expected result (*.err) differs from actual result (*.oerr)"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
fi
else
echo "*FAILED*"
echo " Expected result (*.ddl) differs from actual result (*.out)"
@ -821,15 +839,17 @@ TOOLTEST5() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
if $CMP $expect_err $actual_ext; then
echo " PASSED"
else
echo "*FAILED*"
echo " Expected result (*.err) differs from actual result (*.oerr)"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
fi
else
echo "*FAILED*"
echo " Expected result (*.err) differs from actual result (*.oerr)"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
fi
else
echo "*FAILED*"
echo " Expected result (*.ddl) differs from actual result (*.out)"
@ -863,6 +883,8 @@ TOOLTEST_HELP() {
# Create the expect data file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect-CREATED
echo " Expected output (*.txt) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else

View File

@ -241,6 +241,8 @@ TOOLTEST() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
@ -282,11 +284,15 @@ TOOLTEST2() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
if [ ! -f $expectdata ]; then
# Create the expect data file if it doesn't yet exist.
echo " CREATED"
cp $actualdata $expectdata
echo " Expected data (*.exp) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expectdata $actualdata; then
echo " PASSED"
else
@ -348,6 +354,8 @@ TOOLTEST3() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
@ -404,15 +412,17 @@ TOOLTEST4() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
if $CMP $expect_err $actual_ext; then
echo " PASSED"
else
echo "*FAILED*"
echo " Expected result (*.err) differs from actual result (*.oerr)"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
fi
else
echo "*FAILED*"
echo " Expected result (*.err) differs from actual result (*.oerr)"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
fi
else
echo "*FAILED*"
echo " Expected result (*.ddl) differs from actual result (*.out)"

View File

@ -220,6 +220,8 @@ TOOLTEST() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
@ -261,11 +263,15 @@ TOOLTEST2() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
if [ ! -f $expectdata ]; then
# Create the expect data file if it doesn't yet exist.
echo " CREATED"
cp $actualdata $expectdata
echo " Expected data (*.exp) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expectdata $actualdata; then
echo " PASSED"
else
@ -327,6 +333,8 @@ TOOLTEST3() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else

View File

@ -202,10 +202,10 @@ COPY_TESTFILES_TO_TESTDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
$CP -f $tstfile $TESTDIR
$CP -f $tstfile $TESTDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
# Comment out this to CREATE expected file
exit $EXIT_FAILURE
fi
@ -263,7 +263,9 @@ TOOLTEST() {
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
cp $actual $expect
echo " Expected result (*.xml) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
@ -279,7 +281,7 @@ TOOLTEST() {
fi
}
# Print a "SKIP" message
# Print a "SKIP" message
SKIP() {
TESTING $DUMPER $@
echo " -SKIP-"
@ -345,7 +347,7 @@ TOOLTEST tsaf.h5.xml --xml tsaf.h5
TOOLTEST tempty.h5.xml --xml tempty.h5
TOOLTEST tnamed_dtype_attr.h5.xml --xml tnamed_dtype_attr.h5
##Test dataset and attribute of null space. Commented out:
## wait until the XML schema is updated for null space.
## wait until the XML schema is updated for null space.
##TOOLTEST tnullspace.h5.xml --xml tnulspace.h5
# other options for xml
@ -356,7 +358,7 @@ TOOLTEST tempty-nons.h5.xml --xml -X ":" tempty.h5
TOOLTEST tempty-nons-2.h5.xml --xml --xml-ns=":" tempty.h5
## Some of these combinations are syntactically correct but
## the URLs are dummies
## the URLs are dummies
TOOLTEST tempty-ns.h5.xml --xml -X "thing:" tempty.h5
TOOLTEST tempty-ns-2.h5.xml --xml --xml-ns="thing:" tempty.h5
TOOLTEST tempty-nons-uri.h5.xml --xml --xml-ns=":" --xml-dtd="http://somewhere.net" tempty.h5

View File

@ -107,10 +107,10 @@ COPY_TESTFILES_TO_TESTDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
$CP -f $tstfile $TESTDIR
$CP -f $tstfile $TESTDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
# Comment out this to CREATE expected file
exit $EXIT_FAILURE
fi
@ -154,19 +154,19 @@ SKIP() {
echo " -SKIP-"
}
#
#
# COMPARE_FILES a.h5 b.h5
# Compare two files, skipping the first line. This is used to
# Compare two files, skipping the first line. This is used to
# compare the output of the dumper, skipping the file name which
# is different.
# The result is stored in 'compval'.
#
cmpval=0;
COMPARE_FILES() {
$AWK 'NR > 1' $1 > $1.cmp
$AWK 'NR > 1' $2 > $2.cmp
$CMP $1.cmp $2.cmp
cmpval=$?
$AWK 'NR > 1' $1 > $1.cmp
$AWK 'NR > 1' $2 > $2.cmp
$CMP $1.cmp $2.cmp
cmpval=$?
rm -f $1.cmp $2.cmp
}
@ -174,10 +174,10 @@ COMPARE_FILES() {
# Clean up named files.
CLEANUP() {
if test -z "$HDF5_NOCLEANUP"; then
for i in $*
do
rm -f $i
done
for i in $*
do
rm -f $i
done
fi
}
@ -190,7 +190,7 @@ CLEANUP() {
# the "cat" command.
#
SETUP() {
cat < $1 > $2
cat < $1 > $2
}
#
@ -233,7 +233,7 @@ CHECKFILE() {
}
#
# CHECK_UB file.h5 user_block_file origfile.h5
# CHECK_UB file.h5 user_block_file origfile.h5
#
# Check the user block in 'file.h5' is the same as
# 'user_block' (allowing for padding).
@ -243,73 +243,73 @@ CHECKFILE() {
# and the test file compared to:
# cat compare_ub user_block_file.
#
# This test uses './getub' to extract the user block from
# This test uses './getub' to extract the user block from
# 'file.h5', which is compared to the file described above.
#
# The result is set in variable 'result1'.
#
result1=0;
CHECK_UB_1() {
hfile="$1"
ufile="$2"
hfile="$1"
ufile="$2"
# check for third argument (the original file)
origfile="";
if [ -n "$3" ];
then
origfile="$3"
fi
# check for third argument (the original file)
origfile="";
if [ -n "$3" ];
then
origfile="$3"
fi
# find the length of the user block to check
s1=`cat $ufile | wc -c | sed -e 's/ //g'`
if [ "$s1" = "0" ];
then
echo "File "$ufile" is empty"
result1=1;
fi
# find the length of the user block to check
s1=`cat $ufile | wc -c | sed -e 's/ //g'`
if [ "$s1" = "0" ];
then
echo "File "$ufile" is empty"
result1=1;
fi
# Get the size of the original user block, if any.
if [ -n "$origfile" ];
then
# 'tellub' calls H5Fget_user_block to get the size
# of the user block
s2=`$JAM_BIN/tellub $origfile`
if [ "$s2" = "0" ];
then
size=$s1;
cmpfile=$ufile
else
cmpfile="tt2"
size=`expr $s2 + $s1`
$JAM_BIN/getub -c $s2 $origfile > $cmpfile
cat $ufile >> $cmpfile
fi
else
# assume no user block
s2="0"
size=$s1;
cmpfile=$ufile
fi
# Get the size of the original user block, if any.
if [ -n "$origfile" ];
then
# 'tellub' calls H5Fget_user_block to get the size
# of the user block
s2=`$JAM_BIN/tellub $origfile`
if [ "$s2" = "0" ];
then
size=$s1;
cmpfile=$ufile
else
cmpfile="tt2"
size=`expr $s2 + $s1`
$JAM_BIN/getub -c $s2 $origfile > $cmpfile
cat $ufile >> $cmpfile
fi
else
# assume no user block
s2="0"
size=$s1;
cmpfile=$ufile
fi
# Extract 'size' bytes from the front of 'hfile'
# Compare to 'cmpfile', result is set in result1
tfile="tt1"
$JAM_BIN/getub -c $size $hfile > $tfile
res=`cmp $cmpfile $tfile`
if [ "$?" != "0" ];
then
echo $res
result1=1;
else
result1=0;
fi
# Extract 'size' bytes from the front of 'hfile'
# Compare to 'cmpfile', result is set in result1
tfile="tt1"
$JAM_BIN/getub -c $size $hfile > $tfile
res=`cmp $cmpfile $tfile`
if [ "$?" != "0" ];
then
echo $res
result1=1;
else
result1=0;
fi
# clean up
rm -f $tfile
if [ "$s2" != "0" ] ;
then
rm -f $cmpfile
fi
# clean up
rm -f $tfile
if [ "$s2" != "0" ] ;
then
rm -f $cmpfile
fi
}
@ -321,25 +321,25 @@ CHECK_UB_1() {
result2=0;
CHECK_NOUB() {
hfile="$1"
hfile="$1"
# call 'ubsize' to get the size of the user block
ubsize=`$JAM_BIN/tellub $hfile`
# call 'ubsize' to get the size of the user block
ubsize=`$JAM_BIN/tellub $hfile`
if [ "$?" != "0" ];
then
# error
result2=1;
else
if [ "$ubsize" = "0" ];
then
# pass
result2=0;
else
# fail
result2=1;
fi
fi
if [ "$?" != "0" ];
then
# error
result2=1;
else
if [ "$ubsize" = "0" ];
then
# pass
result2=0;
else
# fail
result2=1;
fi
fi
}
# JAMTEST user_block file.h5 [--clobber] [ofile.h5]
@ -351,119 +351,119 @@ CHECK_NOUB() {
# 3. check the user block is correct in the output (Check_UB)
# If the user block is correct, print "PASSED", else "*FAILED*"
JAMTEST() {
ufile="$1"
ifile="$2"
compare_test="" # the file to test
compare_orig="" # the comparison to test against
cleanup=""
ufile="$1"
ifile="$2"
compare_test="" # the file to test
compare_orig="" # the comparison to test against
cleanup=""
# sort out the arguments for the test and the check
do_clobber="no"
if [ "$3" = "--clobber" ];
then
# clobber overwrites any existing user block
do_clobber="yes"
clobber="--clobber"
compare_orig=""
if [ -z "$4" ];
then
# output goes to infile, compare ubfile to infile
ofile=""
compare_test="$ifile"
else
# output goes to $4, compare ofile to ubfile
ofile="$4"
compare_test="$ofile"
fi
else
clobber=""
# add user block to existing ub, if any
if [ -z "$3" ];
then
# output goes to infile, compare ubfile to infile
ofile=""
compare_test="$ifile"
cp $ifile xxofile.h5
compare_orig="xxofile.h5"
cleanup="$cleanup $compare_orig"
else
# output goes to $3, compare ofile to ubfile
ofile="$3"
compare_test="$ofile"
compare_orig="$ifile"
fi
fi
# sort out the arguments for the test and the check
do_clobber="no"
if [ "$3" = "--clobber" ];
then
# clobber overwrites any existing user block
do_clobber="yes"
clobber="--clobber"
compare_orig=""
if [ -z "$4" ];
then
# output goes to infile, compare ubfile to infile
ofile=""
compare_test="$ifile"
else
# output goes to $4, compare ofile to ubfile
ofile="$4"
compare_test="$ofile"
fi
else
clobber=""
# add user block to existing ub, if any
if [ -z "$3" ];
then
# output goes to infile, compare ubfile to infile
ofile=""
compare_test="$ifile"
cp $ifile xxofile.h5
compare_orig="xxofile.h5"
cleanup="$cleanup $compare_orig"
else
# output goes to $3, compare ofile to ubfile
ofile="$3"
compare_test="$ofile"
compare_orig="$ifile"
fi
fi
# call 'jam' with the appropriate arguments
if [ -n "$ofile" ];
then
TESTING h5jam -u `basename $ufile` -i `basename $ifile` -o `basename $ofile` $clobber
$JAM_BIN/$JAM -u $ufile -i $ifile -o $ofile $clobber
else
TESTING jam -u `basename $ufile` -i `basename $ifile` $clobber
$JAM_BIN/$JAM -u $ufile -i $ifile $clobber
fi
# call 'jam' with the appropriate arguments
if [ -n "$ofile" ];
then
TESTING h5jam -u `basename $ufile` -i `basename $ifile` -o `basename $ofile` $clobber
$JAM_BIN/$JAM -u $ufile -i $ifile -o $ofile $clobber
else
TESTING jam -u `basename $ufile` -i `basename $ifile` $clobber
$JAM_BIN/$JAM -u $ufile -i $ifile $clobber
fi
#echo "CHECK_UB_1 $compare_test $ufile $compare_orig"
CHECK_UB_1 $compare_test $ufile $compare_orig
#echo "CHECK_UB_1 $compare_test $ufile $compare_orig"
CHECK_UB_1 $compare_test $ufile $compare_orig
if [ "$result1" = "0" ] ;
then
echo " PASSED"
else
echo " *FAILED*"
nerrors="`expr $nerrors + 1`"
fi
CLEANUP $cleanup
if [ "$result1" = "0" ] ;
then
echo " PASSED"
else
echo " *FAILED*"
nerrors="`expr $nerrors + 1`"
fi
CLEANUP $cleanup
}
# UNJAMTEST file.h5 [- | --delete] ofile
#
# Test the 'unjam' tool
#
###fix the working directory here and in jamtest
UNJAMTEST () {
infile="$1"
ofile="$3"
if [ "$2" = "-" ];
then
uofile="uofile"
TESTING h5unjam -i `basename $infile` -o `basename $ofile` "> "`basename $uofile`
$JAM_BIN/$UNJAM -i $infile -o $ofile > $uofile
else
if [ "$2" = "--delete" ];
then
uofile="none"
TESTING h5unjam -i `basename $infile` -o `basename $ofile` --delete
$JAM_BIN/$UNJAM -i $infile -o $ofile --delete
infile="$1"
ofile="$3"
if [ "$2" = "-" ];
then
uofile="uofile"
TESTING h5unjam -i `basename $infile` -o `basename $ofile` "> "`basename $uofile`
$JAM_BIN/$UNJAM -i $infile -o $ofile > $uofile
else
if [ "$2" = "--delete" ];
then
uofile="none"
TESTING h5unjam -i `basename $infile` -o `basename $ofile` --delete
$JAM_BIN/$UNJAM -i $infile -o $ofile --delete
else
uofile="$2"
TESTING h5unjam -i `basename $infile` -u `basename $uofile` -o `basename $ofile`
$JAM_BIN/$UNJAM -i $infile -u $uofile -o $ofile
fi
fi
else
uofile="$2"
TESTING h5unjam -i `basename $infile` -u `basename $uofile` -o `basename $ofile`
$JAM_BIN/$UNJAM -i $infile -u $uofile -o $ofile
fi
fi
result1=0
result2=0
cleanup=""
if [ "$uofile" != "none" ];
then
# sets result1
CHECK_UB_1 $infile $uofile
CLEANUP $uofile
fi
result1=0
result2=0
cleanup=""
if [ "$uofile" != "none" ];
then
# sets result1
CHECK_UB_1 $infile $uofile
CLEANUP $uofile
fi
# sets result2
CHECK_NOUB $ofile
# sets result2
CHECK_NOUB $ofile
if [ "$result1" = "0" -a "$result2" = "0" ];
then
echo " PASSED"
else
echo " *FAILED*"
nerrors="`expr $nerrors + 1`"
fi
if [ "$result1" = "0" -a "$result2" = "0" ];
then
echo " PASSED"
else
echo " *FAILED*"
nerrors="`expr $nerrors + 1`"
fi
}
@ -500,28 +500,30 @@ TOOLTEST_OUTPUT() {
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
# combine stderr to stdout for output compare
# combine stderr to stdout for output compare
cat $actual_err >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
rm -f $actual $actual_sav $actual_err $actual_err_sav
echo " Expected result (*.ls) missing"
nerrors="`expr $nerrors + 1`"
rm -f $actual $actual_sav $actual_err $actual_err_sav
elif $CMP $expect $actual; then
echo " PASSED"
rm -f $actual $actual_sav $actual_err $actual_err_sav
rm -f $actual $actual_sav $actual_err $actual_err_sav
else
echo "*FAILED*"
echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
}
##############################################################################
##############################################################################
### T H E T E S T S ###
### T H E T E S T S ###
##############################################################################
##############################################################################
# prepare for test
@ -550,19 +552,19 @@ CHECKFILE $TESTDIR/tall.h5 ta5.h5
CLEANUP ta5.h5
SETUP $TESTDIR/tall.h5 ta6.h5
JAMTEST $TESTDIR/u10.txt ta6.h5
JAMTEST $TESTDIR/u10.txt ta6.h5
CHECKFILE $TESTDIR/tall.h5 ta6.h5
CLEANUP ta6.h5
SETUP $TESTDIR/tall.h5 ta7.h5
JAMTEST $TESTDIR/u511.txt ta7.h5
JAMTEST $TESTDIR/u511.txt ta7.h5
CHECKFILE $TESTDIR/tall.h5 ta7.h5
CLEANUP ta7.h5
SETUP $TESTDIR/tall.h5 ta8.h5
JAMTEST $TESTDIR/u512.txt ta8.h5
JAMTEST $TESTDIR/u512.txt ta8.h5
CHECKFILE $TESTDIR/tall.h5 ta8.h5
CLEANUP ta8.h5
SETUP $TESTDIR/tall.h5 ta9.h5
JAMTEST $TESTDIR/u513.txt ta9.h5
JAMTEST $TESTDIR/u513.txt ta9.h5
CHECKFILE $TESTDIR/tall.h5 ta9.h5
CLEANUP ta9.h5
@ -592,29 +594,29 @@ JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 tax9.h5
CHECKFILE $TESTDIR/tall.h5 tax9.h5
CLEANUP tax9.h5
JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 --clobber taz2.h5
JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 --clobber taz2.h5
CHECKFILE $TESTDIR/tall.h5 taz2.h5
CLEANUP taz2.h5
JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub.h5 --clobber taz3.h5
CHECKFILE $TESTDIR/tall.h5 taz3.h5
CLEANUP taz3.h5
JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub.h5 --clobber taz4.h5
JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub.h5 --clobber taz4.h5
CHECKFILE $TESTDIR/tall.h5 taz4.h5
CLEANUP taz4.h5
JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub.h5 --clobber taz5.h5
JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub.h5 --clobber taz5.h5
CHECKFILE $TESTDIR/tall.h5 taz5.h5
CLEANUP taz5.h5
JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub513.h5 --clobber taz6.h5
JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub513.h5 --clobber taz6.h5
CHECKFILE $TESTDIR/tall.h5 taz6.h5
CLEANUP taz6.h5
JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub513.h5 --clobber taz7.h5
CHECKFILE $TESTDIR/tall.h5 taz7.h5
CLEANUP taz7.h5
JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub513.h5 --clobber taz8.h5
JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub513.h5 --clobber taz8.h5
CHECKFILE $TESTDIR/tall.h5 taz8.h5
CLEANUP taz8.h5
JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 --clobber taz9.h5
JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 --clobber taz9.h5
CHECKFILE $TESTDIR/tall.h5 taz9.h5
CLEANUP taz9.h5
@ -653,7 +655,7 @@ CHECKFILE $TESTDIR/tall.h5 tay9.h5
CLEANUP tay9.h5
#---------------------------------
# Testing h5unjam
# Testing h5unjam
#---------------------------------
# help page
TOOLTEST_OUTPUT UNJAM h5unjam-help.txt 0 -h

View File

@ -184,7 +184,7 @@ TOOLTEST() {
# any unexpected output from that stream too.
TESTING $H5LS $@
(
cd $TESTDIR
cd $TESTDIR
$ENVCMD $RUNSERIAL $H5LS_BIN "$@"
) >$actual 2>$actual_err
@ -196,31 +196,33 @@ TOOLTEST() {
STDERR_FILTER $actual_err
cat $actual_err >> $actual
if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
if [ yes = "$verbose" ]; then
echo "test returned with exit code $exitcode"
echo "test output: (up to $NLINES lines)"
head -$NLINES $actual
echo "***end of test output***"
echo ""
fi
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
if [ yes = "$verbose" ]; then
echo "test returned with exit code $exitcode"
echo "test output: (up to $NLINES lines)"
head -$NLINES $actual
echo "***end of test output***"
echo ""
fi
elif [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ls) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
echo "*FAILED*"
echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err $actual_sav $actual_err_sav
rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}

View File

@ -181,7 +181,7 @@ COPY_TESTFILES_TO_TESTDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
$CP -f $tstfile $TESTDIR
$CP -f $tstfile $TESTDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
@ -239,7 +239,7 @@ TOOLTEST() {
# any unexpected output from that stream too.
TESTING $H5LS $@
(
cd $TESTDIR
cd $TESTDIR
$RUNSERIAL $H5LS_BIN "$@"
) >$actual 2>$actual_err
@ -251,37 +251,39 @@ TOOLTEST() {
STDERR_FILTER $actual_err
cat $actual_err >> $actual
if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
if [ yes = "$verbose" ]; then
echo "test returned with exit code $exitcode"
echo "test output: (up to $NLINES lines)"
head -$NLINES $actual
echo "***end of test output***"
echo ""
fi
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
if [ yes = "$verbose" ]; then
echo "test returned with exit code $exitcode"
echo "test output: (up to $NLINES lines)"
head -$NLINES $actual
echo "***end of test output***"
echo ""
fi
elif [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ls) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
echo "*FAILED*"
echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err $actual_sav $actual_err_sav
rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}
##############################################################################
##############################################################################
### T H E T E S T S ###
### T H E T E S T S ###
##############################################################################
##############################################################################
# prepare for test

View File

@ -187,7 +187,7 @@ TOOLTEST() {
# any unexpected output from that stream too.
TESTING $H5LS $@
(
cd $TESTDIR
cd $TESTDIR
$RUNSERIAL $H5LS_BIN "$@"
) >$actual 2>$actual_err
@ -199,37 +199,39 @@ TOOLTEST() {
STDERR_FILTER $actual_err
cat $actual_err >> $actual
if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
if [ yes = "$verbose" ]; then
echo "test returned with exit code $exitcode"
echo "test output: (up to $NLINES lines)"
head -$NLINES $actual
echo "***end of test output***"
echo ""
fi
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
if [ yes = "$verbose" ]; then
echo "test returned with exit code $exitcode"
echo "test output: (up to $NLINES lines)"
head -$NLINES $actual
echo "***end of test output***"
echo ""
fi
elif [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ls) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
echo "*FAILED*"
echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err $actual_sav $actual_err_sav
rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}
##############################################################################
##############################################################################
### T H E T E S T S ###
### T H E T E S T S ###
##############################################################################
##############################################################################
# prepare for test

View File

@ -177,7 +177,7 @@ COPY_TESTFILES_TO_TESTDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
$CP -f $tstfile $TESTDIR
$CP -f $tstfile $TESTDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
@ -373,6 +373,8 @@ VERIFY_LAYOUT_VDS()
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual > /dev/null 2>&1 ; then
echo " PASSED"
else
@ -384,7 +386,7 @@ VERIFY_LAYOUT_VDS()
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err
rm -f $actual $actual_err
fi
# clean up tmp files
@ -539,11 +541,11 @@ TOOLTEST1()
)
RET=$?
if [ $RET != 0 ] ; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
DIFFTEST $infile $outfile
echo " PASSED"
DIFFTEST $infile $outfile
fi
rm -f $outfile
}
@ -570,11 +572,11 @@ TOOLTESTV()
) >$actual 2>$actual_err
RET=$?
if [ $RET != 0 ] ; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
DIFFTEST $infile $outfile
echo " PASSED"
DIFFTEST $infile $outfile
fi
# display output compare
@ -635,6 +637,8 @@ TOOLTESTM() {
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.tst) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
@ -646,7 +650,7 @@ TOOLTESTM() {
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err $actual_sav $actual_err_sav
rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}
@ -760,11 +764,11 @@ TOOLTEST_META()
# verify sizes.
MESSAGE "Verify the sizes of both output files ($size1 vs $size2)"
if [ $size1 -lt $size2 ]; then
# pass
echo " PASSED"
# pass
echo " PASSED"
else
#fail
echo "*FAILED*"
#fail
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
fi
@ -791,6 +795,8 @@ TOOLTEST_HELP() {
# Create the expect data file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect-CREATED
echo " Expected result (*.txt) missing"
nerrors="`expr $nerrors + 1`"
elif cmp -s $expect $actual; then
echo " PASSED"
else
@ -838,7 +844,7 @@ USE_FILTER_SZIP_ENCODER=`$RUNSERIAL $H5DETECTSZIP_BIN`
fi
##############################################################################
### T H E T E S T S
### T H E T E S T S
##############################################################################
# prepare for test
COPY_TESTFILES_TO_TESTDIR

View File

@ -14,8 +14,8 @@
# Tests for the h5stat tool
#
# Modifcations:
# Vailin Choi; July 2013
# Add tests for -l, -m, -a options
# Vailin Choi; July 2013
# Add tests for -l, -m, -a options
#
srcdir=@srcdir@
@ -132,10 +132,10 @@ COPY_TESTFILES_TO_TESTDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
$CP -f $tstfile $TESTDIR
$CP -f $tstfile $TESTDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
# Comment out this to CREATE expected file
exit $EXIT_FAILURE
fi
@ -199,9 +199,11 @@ TOOLTEST() {
cat $actual_err >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
@ -220,15 +222,15 @@ TOOLTEST() {
# Print a "SKIP" message
SKIP() {
TESTING $STAT $@
echo " -SKIP-"
TESTING $STAT $@
echo " -SKIP-"
}
##############################################################################
##############################################################################
### T H E T E S T S ###
### T H E T E S T S ###
##############################################################################
##############################################################################
# prepare for test
@ -252,7 +254,7 @@ TOOLTEST h5stat_filters-dT.ddl -dT h5stat_filters.h5
TOOLTEST h5stat_filters-UD.ddl -D h5stat_filters.h5
TOOLTEST h5stat_filters-UT.ddl -T h5stat_filters.h5
#
# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
# as of release 1.8.7-snap0 (on a 64-bit machine)
TOOLTEST h5stat_tsohm.ddl h5stat_tsohm.h5
# h5stat_newgrat.h5 is generated by h5stat_gentest.c
@ -262,36 +264,36 @@ TOOLTEST h5stat_newgrat-UA.ddl -A h5stat_newgrat.h5
# h5stat_idx.h5 is generated by h5stat_gentest.c
TOOLTEST h5stat_idx.ddl h5stat_idx.h5
#
# Tests for -l (--links) option on h5stat_threshold.h5:
# -l 0 (incorrect threshold value)
# -g -l 8
# --links=8
# --links=20 -g
# Tests for -l (--links) option on h5stat_threshold.h5:
# -l 0 (incorrect threshold value)
# -g -l 8
# --links=8
# --links=20 -g
TOOLTEST h5stat_err1_links.ddl -l 0 h5stat_threshold.h5
TOOLTEST h5stat_links1.ddl -g -l 8 h5stat_threshold.h5
TOOLTEST h5stat_links2.ddl --links=8 h5stat_threshold.h5
TOOLTEST h5stat_links3.ddl --links=20 -g h5stat_threshold.h5
#
# Tests for -l (--links) option on h5stat_newgrat.h5:
# -g
# -g -l 40000
# Tests for -l (--links) option on h5stat_newgrat.h5:
# -g
# -g -l 40000
TOOLTEST h5stat_links4.ddl -g h5stat_newgrat.h5
TOOLTEST h5stat_links5.ddl -g -l 40000 h5stat_newgrat.h5
#
# Tests for -m (--dims) option on h5stat_threshold.h5
# -d --dims=-1 (incorrect threshold value)
# -gd -m 5
# -d --di=15
# -d --dims=-1 (incorrect threshold value)
# -gd -m 5
# -d --di=15
TOOLTEST h5stat_err1_dims.ddl -d --dims=-1 h5stat_threshold.h5
TOOLTEST h5stat_dims1.ddl -gd -m 5 h5stat_threshold.h5
TOOLTEST h5stat_dims2.ddl -d --di=15 h5stat_threshold.h5
#
# Tests for -a option on h5stat_threshold.h5
# -a -2 (incorrect threshold value)
# --numattrs (without threshold value)
# -AS -a 10
# -a 1
# -A --numattrs=25
# -a -2 (incorrect threshold value)
# --numattrs (without threshold value)
# -AS -a 10
# -a 1
# -A --numattrs=25
TOOLTEST h5stat_err1_numattrs.ddl -a -2 h5stat_threshold.h5
TOOLTEST h5stat_err2_numattrs.ddl --numattrs h5stat_threshold.h5
TOOLTEST h5stat_numattrs1.ddl -AS -a 10 h5stat_threshold.h5
@ -299,7 +301,7 @@ TOOLTEST h5stat_numattrs2.ddl -a 1 h5stat_threshold.h5
TOOLTEST h5stat_numattrs3.ddl -A --numattrs=25 h5stat_threshold.h5
#
# Tests for -a option on h5stat_newgrat.h5
# -A -a 100
# -A -a 100
TOOLTEST h5stat_numattrs4.ddl -A -a 100 h5stat_newgrat.h5
#

View File

@ -98,7 +98,7 @@ COPY_TESTFILES_TO_TESTDIR()
$CP -f $tstfile $TESTDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
# Comment out this to CREATE expected file
exit $EXIT_FAILURE
fi
@ -122,7 +122,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
TESTING()
TESTING()
{
SPACES=" "
echo "Testing $* $SPACES" |cut -c1-70 |tr -d '\012'
@ -134,7 +134,7 @@ TESTING()
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Verifying".
#
VERIFY_H5LS()
VERIFY_H5LS()
{
SPACES=" "
echo "Verifying h5ls file structure $* $SPACES" | cut -c1-70 | tr -d '\012'
@ -146,7 +146,7 @@ VERIFY_H5LS()
# Assumed arguments:
# $* arguments for h5mkgrp.
TOOLTEST()
TOOLTEST()
{
TESTING $H5MKGRP $@
(
@ -171,7 +171,7 @@ TOOLTEST()
# Call the h5ls tool to verify the correct output data in the destination file
#
H5LSTEST()
H5LSTEST()
{
expect="$TESTDIR/`basename $1 .h5`.ls"
actual="$TESTDIR/`basename $1 .h5`.out"
@ -191,9 +191,11 @@ H5LSTEST()
STDERR_FILTER $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ls) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
@ -215,7 +217,7 @@ H5LSTEST()
# $1 is test file name
# $2 is h5mkgrp options
# $* are groups to create
RUNTEST()
RUNTEST()
{
FILEOUT=$1
shift
@ -244,7 +246,7 @@ RUNTEST()
# $1 is test expected output file
# $2 is h5mkgrp options
# $* are groups to create
CMPTEST()
CMPTEST()
{
FILEOUT=$1
expect="$TESTDIR/`basename $1 .h5`.txt"
@ -260,11 +262,13 @@ CMPTEST()
$RUNSERIAL $H5MKGRP_BIN $@
) >$actual 2>$actual_err
cat $actual_err >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " CREATED"
cp $actual $expect
echo " Expected result (*.txt) missing"
nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
@ -302,7 +306,7 @@ RUNTEST h5mkgrp_several_v.h5 "-v" one two
RUNTEST h5mkgrp_several_p.h5 "-p" one two
RUNTEST h5mkgrp_several_l.h5 "-l" one two
# Create various nested groups
# Create various nested groups
RUNTEST h5mkgrp_nested_p.h5 "-p" /one/two
RUNTEST h5mkgrp_nested_lp.h5 "-lp" /one/two
RUNTEST h5mkgrp_nested_mult_p.h5 "-p" /one/two /three/four