From 4ad9eb928fa25202d9160864545936ec3a20e78e Mon Sep 17 00:00:00 2001 From: Glenn Song <43005495+glennsong09@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:08:59 -0500 Subject: [PATCH] Move changes from external repo to main repo (#3718) Co-authored-by: Glenn Song --- test/API/tools/testh5copy.sh | 56 ++++++++++++++++++---------------- test/API/tools/testh5diff.sh | 46 +++++++++++++++------------- test/API/tools/testh5dump.sh | 42 +++++++++++++------------ test/API/tools/testh5ls.sh | 26 +++++++++------- test/API/tools/testh5mkgrp.sh | 46 ++++++++++++++-------------- test/API/tools/testh5repack.sh | 52 ++++++++++++++++--------------- test/API/tools/testph5diff.sh | 3 +- 7 files changed, 142 insertions(+), 129 deletions(-) diff --git a/test/API/tools/testh5copy.sh b/test/API/tools/testh5copy.sh index 620069fdbb8..b5560556c9d 100644 --- a/test/API/tools/testh5copy.sh +++ b/test/API/tools/testh5copy.sh @@ -13,6 +13,8 @@ # # Tests for the h5copy tool +srcdir=@srcdir@ + TESTNAME=h5copy EXIT_SUCCESS=0 EXIT_FAILURE=1 @@ -40,10 +42,10 @@ h5haveexitcode=yes # default is yes # -------------------------------------------------------------------- # Where the tool's HDF5 input files are located -TESTFILES_HDF5_DIR="./testfiles/hdf5" +TESTFILES_HDF5_DIR="../../../tools/h5copy/testfiles" # Where the tool's expected output files are located -H5COPY_TESTFILES_OUT_DIR="./testfiles/expected/h5copy" +H5COPY_TESTFILES_OUT_DIR="../../../tools/h5copy/expected" ###################################################################### # Output files @@ -128,8 +130,8 @@ COPY_EXPECTED_OUTPUT_FILES() # Use -f to make sure get a new copy $CP -f $filepath $TEXT_OUTPUT_DIR - if [ $? -ne 0 ]; then - echo "Error: FAILED to copy expected output file: $filepath ." + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy expected output file: $filepath ." fi done } @@ -536,39 +538,39 @@ TESTFILE="$REPACK_OUTPUT_DIR/h5copytst.h5" # Copy single datasets of various forms from one group to another, # adding object copied to the destination file each time -echo "Test copying various forms of datasets" -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/simple.out.h5 -v -s simple -d simple -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/chunk.out.h5 -v -s chunk -d chunk -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/compact.out.h5 -v -s compact -d compact -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/compound.out.h5 -v -s compound -d compound + echo "Test copying various forms of datasets" + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/simple.out.h5 -v -s simple -d simple + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/chunk.out.h5 -v -s chunk -d chunk + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/compact.out.h5 -v -s compact -d compact + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/compound.out.h5 -v -s compound -d compound TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/named_vl.out.h5 -v -s named_vl -d named_vl -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/nested_vl.out.h5 -v -s nested_vl -d nested_vl -#TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/dset_attr.out.h5 -v -s /dset_attr -d /dset_attr + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/nested_vl.out.h5 -v -s nested_vl -d nested_vl + #TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/dset_attr.out.h5 -v -s /dset_attr -d /dset_attr -echo "Test copying dataset within group in source file to root of destination" -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/simple_top.out.h5 -v -s grp_dsets/simple -d simple_top + echo "Test copying dataset within group in source file to root of destination" + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/simple_top.out.h5 -v -s grp_dsets/simple -d simple_top -echo "Test copying & renaming dataset" -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/dsrename.out.h5 -v -s compound -d rename + echo "Test copying & renaming dataset" + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/dsrename.out.h5 -v -s compound -d rename -echo "Test copying empty, 'full' & 'nested' groups" -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/grp_empty.out.h5 -v -s grp_empty -d grp_empty + echo "Test copying empty, 'full' & 'nested' groups" + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/grp_empty.out.h5 -v -s grp_empty -d grp_empty #TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/grp_attr.out.h5 -v -s grp_attr -d grp_attr -#echo "Test copying dataset within group in source file to group in destination" -#TOOLTEST_PREFILL -i $TESTFILE -o $HDF5_OUTPUT_DIR/simple_group.out.h5 grp_dsets grp_dsets /grp_dsets/simple /grp_dsets/simple_group + #echo "Test copying dataset within group in source file to group in destination" + #TOOLTEST_PREFILL -i $TESTFILE -o $HDF5_OUTPUT_DIR/simple_group.out.h5 grp_dsets grp_dsets /grp_dsets/simple /grp_dsets/simple_group -echo "Test copying objects into group hier. that doesn't exist yet in destination file" -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/A_B1_simple.out.h5 -vp -s simple -d /A/B1/simple -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/A_B2_simple2.out.h5 -vp -s simple -d /A/B2/simple2 -TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/C_D_simple.out.h5 -vp -s /grp_dsets/simple -d /C/D/simple + echo "Test copying objects into group hier. that doesn't exist yet in destination file" # "hier" + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/A_B1_simple.out.h5 -vp -s simple -d /A/B1/simple + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/A_B2_simple2.out.h5 -vp -s simple -d /A/B2/simple2 + TOOLTEST -i $TESTFILE -o $HDF5_OUTPUT_DIR/C_D_simple.out.h5 -vp -s /grp_dsets/simple -d /C/D/simple # Misc tests -echo "Test copying object into group which doesn't exist, without -p" -TOOLTEST_FAIL h5copy_misc1.out -i $TESTFILE -o $HDF5_OUTPUT_DIR/h5copy_misc1.out.h5 -v -s /simple -d /g1/g2/simple + echo "Test copying object into group which doesn't exist, without -p" + TOOLTEST_FAIL h5copy_misc1.out -i $TESTFILE -o $HDF5_OUTPUT_DIR/h5copy_misc1.out.h5 -v -s /simple -d /g1/g2/simple -echo "Test copying objects to the same file " -TOOLTEST_SAME -i $TESTFILE -o $HDF5_OUTPUT_DIR/samefile1.out.h5 /simple /simple_cp + echo "Test copying objects to the same file " + TOOLTEST_SAME -i $TESTFILE -o $HDF5_OUTPUT_DIR/samefile1.out.h5 /simple /simple_cp # Clean up generated files/directories CLEAN_OUTPUT diff --git a/test/API/tools/testh5diff.sh b/test/API/tools/testh5diff.sh index 2bb2cbe4863..1505ab9c3f4 100644 --- a/test/API/tools/testh5diff.sh +++ b/test/API/tools/testh5diff.sh @@ -14,6 +14,8 @@ # Tests for the h5diff tool # +srcdir=@srcdir@ + TESTNAME=h5diff EXIT_SUCCESS=0 EXIT_FAILURE=1 @@ -44,10 +46,10 @@ mydomainname=`domainname 2>/dev/null` # -------------------------------------------------------------------- # Where the tool's HDF5 input files are located -TESTFILES_HDF5_DIR="./testfiles/hdf5" +TESTFILES_HDF5_DIR="../../../tools/test/h5diff/testfiles" # Where the tool's expected output files are located -H5DIFF_TESTFILES_OUT_DIR="./testfiles/expected/h5diff" +H5DIFF_TESTFILES_OUT_DIR="../../../tools/test/h5diff/expected" ###################################################################### # Output files @@ -345,7 +347,7 @@ while [ $# -gt 0 ]; do -p) # reset the tool name and bin to run ph5diff tests TESTNAME=ph5diff H5DIFF=ph5diff # The tool name - pmode=yes + pmode=yes shift ;; -h) # print help page @@ -391,7 +393,7 @@ REPACK_HDF5_FILES() # Repack the file $H5REPACK --src-vol-name=native --enable-error-stack $inpath $outpath if [ $? -ne 0 ]; then - echo "Error: FAILED to repack HDF5 file: $inpath ." + echo "Error: FAILED to repack HDF5 file: $inpath ." fi done } @@ -483,7 +485,7 @@ RUNTEST() { # don't add exit code check in pmode, as it causes failure. (exit code # is from mpirun not tool) # if any problem occurs relate to an exit code, it will be caught in - # serial mode, so the test is fullfilled. + # serial mode, so the test is fulfilled. if test $h5haveexitcode = 'yes' -a -z "$pmode"; then echo "EXIT CODE: $EXIT_CODE" >> $actual fi @@ -513,23 +515,23 @@ RUNTEST() { # is done by serial mode. grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit mv $expect_sorted.noexit $expect_sorted - if $CMP $expect_sorted $actual_sorted; then - echo " PASSED" - else - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" - if test yes = "$verbose"; then - echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" - $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' - echo "====The actual output ($actual_sav)" - sed 's/^/ /' < $actual_sav - echo "====The actual stderr ($actual_err_sav)" - sed 's/^/ /' < $actual_err_sav - echo "====End of actual stderr ($actual_err_sav)" - echo "" + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi fi fi - fi } @@ -885,7 +887,7 @@ RUNTEST h5diff_206.txt -c $REPACK_OUTPUT_DIR/h5diff_basic2.h5 $REPACK_OUTPUT_DIR #RUNTEST h5diff_208.txt -c $REPACK_OUTPUT_DIR/h5diff_dset_zero_dim_size1.h5 $REPACK_OUTPUT_DIR/h5diff_dset_zero_dim_size2.h5 # non-comparable dataset with comparable attribute, and other comparable datasets. -# Also test non-compatible attributes with different type, dimention, rank. +# Also test non-compatible attributes with different type, dimension, rank. # All the comparables should display differences. RUNTEST h5diff_220.txt -c $REPACK_OUTPUT_DIR/non_comparables1.h5 $REPACK_OUTPUT_DIR/non_comparables2.h5 /g1 @@ -1048,7 +1050,7 @@ RUNTEST h5diff_224.txt -c $REPACK_OUTPUT_DIR/non_comparables2.h5 $REPACK_OUTPUT_ #RUNTEST h5diff_475.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link1 # ############################################################################## -# # test for group diff recursivly +# # test for group diff recursively # ############################################################################## # root #RUNTEST h5diff_500.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / / diff --git a/test/API/tools/testh5dump.sh b/test/API/tools/testh5dump.sh index f49a1e46a5f..466d655419e 100644 --- a/test/API/tools/testh5dump.sh +++ b/test/API/tools/testh5dump.sh @@ -14,6 +14,9 @@ # Tests for the h5dump tool # Assume we are on a little-endian system + +srcdir=@srcdir@ + WORDS_BIGENDIAN="no" TESTNAME=h5dump @@ -41,10 +44,10 @@ verbose=yes # -------------------------------------------------------------------- # Where the tool's HDF5 input files are located -TESTFILES_HDF5_DIR="./testfiles/hdf5" +TESTFILES_HDF5_DIR="../../../tools/h5dump/testfiles" # Where the tool's expected output files are located -H5DUMP_TESTFILES_OUT_DIR="./testfiles/expected/h5dump" +H5DUMP_TESTFILES_OUT_DIR="../../../tools/h5dump/expected" ###################################################################### # Output files @@ -407,7 +410,7 @@ COPY_EXPECTED_OUTPUT_FILES() filepath="$H5DUMP_TESTFILES_OUT_DIR/$outfile" # Use -f to make sure get a new copy - $CP -f $filepath $TEXT_OUTPUT_DIR + $CP -f $filepath $TEXT_OUTPUT_DIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy expected output file: $filepath ." fi @@ -425,8 +428,8 @@ REPACK_HDF5_FILES() # Repack the file $H5REPACK --src-vol-name=native --enable-error-stack $inpath $outpath - if [ $? -ne 0 ]; then - echo "Error: FAILED to repack HDF5 file: $inpath ." + if [ $? -ne 0 ]; then + echo "Error: FAILED to repack HDF5 file: $inpath ." fi done } @@ -454,7 +457,7 @@ CLEAN_OUTPUT() # The HDF5 output directory is always created, even if the VOL # storage won't use it. Delete it here. $RM $REPACK_OUTPUT_DIR - fi + fi } # Print a line-line message left justified in a field of 70 characters @@ -484,14 +487,14 @@ TESTING() { RUNTEST() { # check if caseless compare and diff requested if [ "$1" = ignorecase ]; then - caseless="-i" - # replace cmp with diff which runs much longer. - xCMP="$DIFF -i" - shift + caseless="-i" + # replace cmp with diff which runs much longer. + xCMP="$DIFF -i" + shift else - caseless="" - # stick with faster cmp if ignorecase is not requested. - xCMP="$CMP" + caseless="" + # stick with faster cmp if ignorecase is not requested. + xCMP="$CMP" fi expect="$TEXT_OUTPUT_DIR/$1" @@ -504,7 +507,7 @@ RUNTEST() { # Run test. TESTING $H5DUMP $@ ( - $RUNSERIAL $H5DUMP "$@" + $RUNSERIAL $H5DUMP "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -707,7 +710,7 @@ RUNTEST_HELP() { expect="$TEXT_OUTPUT_DIR/$1" actual="$TEXT_OUTPUT_DIR/`basename $1 .txt`.out" actual_err="$TEXT_OUTPUT_DIR/`basename $1 .txt`.err" - shift + shift # Run test. TESTING $H5DUMP $@ @@ -745,7 +748,7 @@ RUNTEST_GREP() # Run test. TESTING $H5DUMP -p $@ ( - $ENVCMD $RUNSERIAL $H5DUMP -p "$@" + $ENVCMD $RUNSERIAL $H5DUMP -p "$@" ) >$actual 2>$actual_err if [ "$txttype" = "ERRTXT" ]; then $GREP "$expectdata" $actual_err > /dev/null @@ -775,7 +778,7 @@ RUNTEST_GREP2() # Run test. TESTING $H5DUMP -p $@ ( - $ENVCMD $RUNSERIAL $H5DUMP -p "$@" + $ENVCMD $RUNSERIAL $H5DUMP -p "$@" ) >$actual 2>$actual_err if [ "$txttype" = "ERRTXT" ]; then $GREP "$expectdata" $actual_err > /dev/null @@ -907,9 +910,9 @@ RUNTEST tcomp-4.ddl --enable-error-stack $REPACK_OUTPUT_DIR/tcompound_complex.h5 RUNTEST tcompound_complex2.ddl --enable-error-stack $REPACK_OUTPUT_DIR/tcompound_complex2.h5 # tests for bitfields and opaque data types if test $WORDS_BIGENDIAN != "yes"; then -RUNTEST tbitnopaque_le.ddl --enable-error-stack $REPACK_OUTPUT_DIR/tbitnopaque.h5 + RUNTEST tbitnopaque_le.ddl --enable-error-stack $REPACK_OUTPUT_DIR/tbitnopaque.h5 else -RUNTEST tbitnopaque_be.ddl --enable-error-stack $REPACK_OUTPUT_DIR/tbitnopaque.h5 + RUNTEST tbitnopaque_be.ddl --enable-error-stack $REPACK_OUTPUT_DIR/tbitnopaque.h5 fi #test for the nested compound type @@ -1133,4 +1136,3 @@ else echo "$TESTNAME tests failed with $nerrors errors." exit $EXIT_FAILURE fi - diff --git a/test/API/tools/testh5ls.sh b/test/API/tools/testh5ls.sh index 79538c8097a..213823a7aaf 100644 --- a/test/API/tools/testh5ls.sh +++ b/test/API/tools/testh5ls.sh @@ -14,6 +14,9 @@ # Tests for the h5ls tool # Assume we are on a little-endian system + +srcdir=@srcdir@ + WORDS_BIGENDIAN="no" TESTNAME=h5ls @@ -42,10 +45,10 @@ h5haveexitcode=yes # default is yes # -------------------------------------------------------------------- # Where the tool's HDF5 input files are located -TESTFILES_HDF5_DIR="./testfiles/hdf5" +TESTFILES_HDF5_DIR="../../../tools/h5dump/testfiles" # Where the tool's expected output files are located -H5LS_TESTFILES_OUT_DIR="./testfiles/expected/h5ls" +H5LS_TESTFILES_OUT_DIR="../../../tools/h5ls/expected" ###################################################################### # Output files @@ -197,9 +200,9 @@ COPY_EXPECTED_OUTPUT_FILES() filepath="$H5LS_TESTFILES_OUT_DIR/$outfile" # Use -f to make sure get a new copy - $CP -f $filepath $TEXT_OUTPUT_DIR - if [ $? -ne 0 ]; then - echo "Error: FAILED to copy expected output file: $filepath ." + $CP -f $filepath $TEXT_OUTPUT_DIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy expected output file: $filepath ." fi done } @@ -244,7 +247,7 @@ CLEAN_OUTPUT() # The HDF5 output directory is always created, even if the VOL # storage won't use it. Delete it here. $RM $REPACK_OUTPUT_DIR - fi + fi } # Print a line-line message left justified in a field of 70 characters @@ -266,7 +269,7 @@ TESTING() { # the `nerrors' global variable and (if $verbose is set) display up to $NLINS # lines of the actual output from the tool test. The actual output is not # removed if $HDF5_NOCLEANUP has a non-zero value. -# Arguemnts: +# Arguments: # $1 -- actual output filename to use # $2 and on -- argument for the h5ls tool RUNTEST() { @@ -472,17 +475,17 @@ RUNTEST tempty.ls 0 -w80 -d $REPACK_OUTPUT_DIR/tempty.h5 # test for variable length data types in verbose mode # TODO: Diff fails on hard-coded dataset locations. #if test $WORDS_BIGENDIAN != "yes"; then -# RUNTEST tvldtypes2le.ls 0 -v $REPACK_OUTPUT_DIR/tvldtypes1.h5 + # RUNTEST tvldtypes2le.ls 0 -v $REPACK_OUTPUT_DIR/tvldtypes1.h5 #else -# RUNTEST tvldtypes2be.ls 0 -v $REPACK_OUTPUT_DIR/tvldtypes1.h5 + # RUNTEST tvldtypes2be.ls 0 -v $REPACK_OUTPUT_DIR/tvldtypes1.h5 #fi # test for dataset region references data types in verbose mode # TODO: Diff fails on hard-coded dataset locations. #if test $WORDS_BIGENDIAN != "yes"; then -# RUNTEST tdataregle.ls 0 -v $REPACK_OUTPUT_DIR/tdatareg.h5 + # RUNTEST tdataregle.ls 0 -v $REPACK_OUTPUT_DIR/tdatareg.h5 #else -# RUNTEST tdataregbe.ls 0 -v $REPACK_OUTPUT_DIR/tdatareg.h5 + # RUNTEST tdataregbe.ls 0 -v $REPACK_OUTPUT_DIR/tdatareg.h5 #fi # Clean up generated files/directories @@ -495,3 +498,4 @@ else echo "$TESTNAME tests failed with $nerrors errors." exit $EXIT_FAILURE fi + diff --git a/test/API/tools/testh5mkgrp.sh b/test/API/tools/testh5mkgrp.sh index 2dac539c844..f1d5e84184b 100644 --- a/test/API/tools/testh5mkgrp.sh +++ b/test/API/tools/testh5mkgrp.sh @@ -13,9 +13,8 @@ # # Tests for the h5mkgrp tool # -# Quincey Koziol (koziol@hdfgroup.org) -# Tuesday, February 13, 2007 -# + +srcdir=@srcdir@ TESTNAME=h5mkgrp EXIT_SUCCESS=0 @@ -42,7 +41,7 @@ verbose=yes # -------------------------------------------------------------------- # Where the tool's expected output files are located -H5MKGRP_TESTFILES_OUT_DIR="./testfiles/expected/h5mkgrp" +H5MKGRP_TESTFILES_OUT_DIR="../../../tools/h5mkgrp/expected" ###################################################################### # Output files @@ -163,7 +162,7 @@ CLEAN_OUTPUT() # The HDF5 output directory is always created, even if the VOL # storage won't use it. Delete it here. $RM $HDF5_OUTPUT_DIR - fi + fi } # Print a line-line message left justified in a field of 70 characters @@ -201,7 +200,7 @@ RUNTOOL() { TESTING $H5MKGRP $@ ( - $H5MKGRP $@ + $H5MKGRP $@ ) > $TEXT_OUTPUT_DIR/output.out RET=$? if [ $RET != 0 ]; then @@ -214,7 +213,7 @@ RUNTOOL() # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - $RM $TEXT_OUTPUT_DIR/output.out + $RM $TEXT_OUTPUT_DIR/output.out fi fi } @@ -231,7 +230,7 @@ RUNH5LS() # any unexpected output from that stream too. VERIFY_H5LS $@ ( - $H5LS $H5LS_ARGS $@ + $H5LS $H5LS_ARGS $@ ) 2>&1 > $actual # ) 2>&1 | sed 's/Modified:.*/Modified: XXXX-XX-XX XX:XX:XX XXX/' |\ # sed 's/Location:.*/Location: XXX:XXX/' |\ @@ -306,24 +305,24 @@ CMPTEST() # any unexpected output from that stream too. TESTING $H5MKGRP $@ ( - $H5MKGRP $@ + $H5MKGRP $@ ) >$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 " Expected result (*.txt) missing" - nerrors="`expr $nerrors + 1`" - elif $CMP $expect $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result (*.txt) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' - fi + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.txt) missing" + nerrors="`expr $nerrors + 1`" + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.txt) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi } ############################################################################## @@ -370,3 +369,4 @@ else echo "$TESTNAME tests failed with $nerrors errors." exit $EXIT_FAILURE fi + diff --git a/test/API/tools/testh5repack.sh b/test/API/tools/testh5repack.sh index 58febff52c9..227a090cbbe 100644 --- a/test/API/tools/testh5repack.sh +++ b/test/API/tools/testh5repack.sh @@ -14,6 +14,8 @@ # Tests for the h5repack tool # Assume the HDF5 library was built with gzip support +srcdir=@srcdir@ + USE_FILTER_DEFLATE="no" TESTNAME=h5repack @@ -25,7 +27,6 @@ H5REPACK=h5repack # The h5repack tool name H5DIFF=h5diff # The h5diff tool name H5DUMP=h5dump # The h5dump tool name - RM='rm -rf' CMP='cmp' DIFF='diff -c' @@ -43,10 +44,10 @@ verbose=yes # -------------------------------------------------------------------- # Where the tool's HDF5 input files are located -TESTFILES_HDF5_DIR="./testfiles/hdf5" +TESTFILES_HDF5_DIR="../../../tools/h5repack/testfiles" # Where the tool's expected output files are located -H5REPACK_TESTFILES_OUT_DIR="./testfiles/expected/h5repack" +H5REPACK_TESTFILES_OUT_DIR="../../../tools/h5repack/testfiles/expected" ###################################################################### # Output files @@ -171,9 +172,9 @@ COPY_EXPECTED_OUTPUT_FILES() filepath="$H5REPACK_TESTFILES_OUT_DIR/$outfile" # Use -f to make sure get a new copy - $CP -f $filepath $TEXT_OUTPUT_DIR - if [ $? -ne 0 ]; then - echo "Error: FAILED to copy expected output file: $filepath ." + $CP -f $filepath $TEXT_OUTPUT_DIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy expected output file: $filepath ." fi done } @@ -205,7 +206,7 @@ CLEAN_OUTPUT() # The re-repacked directory should only contain native HDF5 # files and can be deleted normally. $RM $REPACK_FROM_VOL_DIR - fi + fi } # Print a $* message left justified in a field of 70 characters @@ -345,7 +346,7 @@ VERIFY_LAYOUT_DSET() nerrors="`expr $nerrors + 1`" else echo " PASSED" - DIFF_HDF5 "1_NATIVE" $inpath $outpath +DIFF_HDF5 "1_NATIVE" $inpath $outpath fi #--------------------------------- @@ -356,11 +357,11 @@ VERIFY_LAYOUT_DSET() ) $GREP $expectlayout $layoutpath > /dev/null if [ $? -eq 0 ]; then - echo " PASSED" + echo " PASSED" else - echo " FAILED" - nerrors="`expr $nerrors + 1`" - fi + echo " FAILED" + nerrors="`expr $nerrors + 1`" + fi } #---------------------------------------- @@ -398,7 +399,7 @@ VERIFY_LAYOUT_ALL() # check if the other layouts still exist VERIFY "layouts" ( - echo + echo # if CONTIGUOUS if [ $expectlayout = "CONTIGUOUS" ]; then TESTING $H5DUMP -pH $outpath @@ -474,21 +475,21 @@ RUNTEST_HELP() { # Run test. TESTING $H5REPACK $@ ( - $RUNSERIAL $H5REPACK "$@" - ) >$actual 2>$actual_err - + $RUNSERIAL $H5REPACK "$@" + ) >$actual 2>$actual_err + if [ ! -f $expectdata ]; then - # 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`" + # 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" + echo " PASSED" else - echo "*FAILED*" - echo " Expected output (*.txt) differs from actual output (*.out)" - nerrors="`expr $nerrors + 1`" + echo "*FAILED*" + echo " Expected output (*.txt) differs from actual output (*.out)" + nerrors="`expr $nerrors + 1`" fi } @@ -602,3 +603,4 @@ else exit $EXIT_FAILURE fi + diff --git a/test/API/tools/testph5diff.sh b/test/API/tools/testph5diff.sh index c9b170dacbe..651fbc1ee71 100644 --- a/test/API/tools/testph5diff.sh +++ b/test/API/tools/testph5diff.sh @@ -43,7 +43,7 @@ RUNTEST() { ############################################################################## ############################################################################## -### T H E T E S T S ### +### T H E T E S T S ### ############################################################################## ############################################################################## @@ -58,3 +58,4 @@ if test $nerrors -eq 0 ; then else exit $EXIT_FAILURE fi +