Skip to content

Commit

Permalink
Move changes from external repo to main repo (#3718)
Browse files Browse the repository at this point in the history
Co-authored-by: Glenn Song <[email protected]>
  • Loading branch information
glennsong09 and Glenn Song authored Oct 19, 2023
1 parent a06562e commit 4ad9eb9
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 129 deletions.
56 changes: 29 additions & 27 deletions test/API/tools/testh5copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#
# Tests for the h5copy tool

srcdir=@srcdir@

TESTNAME=h5copy
EXIT_SUCCESS=0
EXIT_FAILURE=1
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
46 changes: 24 additions & 22 deletions test/API/tools/testh5diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# Tests for the h5diff tool
#

srcdir=@srcdir@

TESTNAME=h5diff
EXIT_SUCCESS=0
EXIT_FAILURE=1
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}


Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 / /
Expand Down
42 changes: 22 additions & 20 deletions test/API/tools/testh5dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# Tests for the h5dump tool

# Assume we are on a little-endian system

srcdir=@srcdir@

WORDS_BIGENDIAN="no"

TESTNAME=h5dump
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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.
Expand Down Expand Up @@ -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 $@
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1133,4 +1136,3 @@ else
echo "$TESTNAME tests failed with $nerrors errors."
exit $EXIT_FAILURE
fi

Loading

0 comments on commit 4ad9eb9

Please sign in to comment.