Skip to content

Commit

Permalink
Remove use of err files in autotools test scripts (HDFGroup#4461)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF authored May 6, 2024
1 parent 6114d1a commit ea3a3a2
Show file tree
Hide file tree
Showing 71 changed files with 264 additions and 2,166 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ tools/h5diff/testfiles/tmpSingleSiteBethe.output.h5 -text
tools/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 -text
tools/h5diff/testfiles/tmptest.he5 -text
tools/h5diff/testfiles/tmptest2.he5 -text
tools/h5dump/errfiles/non_existing.err -text
tools/h5format_convert/CMakeLists.txt -text
tools/h5format_convert/CMakeTests.cmake -text
tools/h5format_convert/Makefile.am -text
Expand Down
2 changes: 1 addition & 1 deletion config/cmake/ZLIB/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ endif ()
# Compiler specific flags : Shouldn't there be compiler tests for these
#-----------------------------------------------------------------------------
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-strict-prototypes")
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-strict-prototypes -Wno-implicit-function-declaration")
endif ()
if (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -Wno-implicit-function-declaration")
Expand Down
1 change: 0 additions & 1 deletion tools/test/h5copy/expected/h5copy_misc1.err

This file was deleted.

136 changes: 43 additions & 93 deletions tools/test/h5copy/testh5copy.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ $SRC_H5COPY_TESTFILES/h5copy_extlinks_trg.h5
# List of expect files that will be copied over to local test dir
LIST_OTHER_TEST_FILES="
$SRC_H5COPY_OUTFILES/h5copy_misc1.out
$SRC_H5COPY_OUTFILES/h5copy_misc1.err
$SRC_H5COPY_OUTFILES/h5copy_help1.ddl
$SRC_H5COPY_OUTFILES/h5copy_help2.ddl
"
Expand All @@ -79,6 +78,7 @@ CP='cp'
DIRNAME='dirname'
LS='ls'
AWK='awk'
GREP='grep'

nerrors=0
verbose=yes
Expand Down Expand Up @@ -188,8 +188,8 @@ VERIFY_OUTPUT()

TOOLTEST()
{
actualout="$TESTDIR/tooltest.actualout"
actualerr="$TESTDIR/tooltest.actualerr"
actual="$TESTDIR/tooltest.actual"
actual_err="$TESTDIR/tooltest.actual_err"
runh5diff=yes
if [ "$1" = -i ]; then
inputfile=$2
Expand Down Expand Up @@ -219,13 +219,13 @@ TOOLTEST()
echo " output for '$H5COPY $@'"
echo "#############################"
$RUNSERIAL $H5COPY_BIN $@
) > $actualout 2> $actualerr
) > $actual 2> $actual_err
RET=$?

if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
cat $actualout
cat $actual
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
Expand All @@ -236,16 +236,16 @@ TOOLTEST()

# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actualout $actualerr $outputfile
rm -f $actual $actual_err $outputfile
fi
fi
}

# TOOLTEST back-to-back
TOOLTEST_PREFILL()
{
actualout="$TESTDIR/tooltest.actualout"
actualerr="$TESTDIR/tooltest.actualerr"
actual="$TESTDIR/tooltest.actual"
actual_err="$TESTDIR/tooltest.actual_err"
runh5diff=yes
if [ "$1" = -i ]; then
inputfile=$2
Expand All @@ -269,13 +269,13 @@ TOOLTEST_PREFILL()
echo " output for '$H5COPY $@'"
echo "#############################"
$RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name2
) > $actualout 2> $actualerr
) > $actual 2> $actual_err
RET=$?

if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
cat $actualout
cat $actual
nerrors="`expr $nerrors + 1`"
else
TESTING $H5COPY $@
Expand All @@ -284,13 +284,13 @@ TOOLTEST_PREFILL()
echo " output for '$H5COPY $@'"
echo "#############################"
$RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $obj_name -d $obj_name2
) > $actualout 2> $actualerr
) > $actual 2> $actual_err
RET=$?

if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
cat $actualout
cat $actual
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
Expand All @@ -301,7 +301,7 @@ TOOLTEST_PREFILL()

# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actualout $actualerr $outputfile
rm -f $actual $actual_err $outputfile
fi
fi
fi
Expand All @@ -310,8 +310,8 @@ TOOLTEST_PREFILL()
# TOOLTEST back-to-back
TOOLTEST_SAME()
{
actualout="$TESTDIR/tooltest.actualout"
actualerr="$TESTDIR/tooltest.actualerr"
actual="$TESTDIR/tooltest.actual"
actual_err="$TESTDIR/tooltest.actual_err"
runh5diff=yes
if [ "$1" = -i ]; then
inputfile=$2
Expand All @@ -334,13 +334,13 @@ TOOLTEST_SAME()
echo " output for '$H5COPY $@'"
echo "#############################"
$RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name
) > $actualout 2> $actualerr
) > $actual 2> $actual_err
RET=$?

if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
cat $actualout
cat $actual
nerrors="`expr $nerrors + 1`"
else
TESTING $H5COPY $@
Expand All @@ -349,13 +349,13 @@ TOOLTEST_SAME()
echo " output for '$H5COPY $@'"
echo "#############################"
$RUNSERIAL $H5COPY_BIN -i $outputfile -o $outputfile -v -s $grp_name -d $grp_name2
) > $actualout 2> $actualerr
) > $actual 2> $actual_err
RET=$?

if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
cat $actualout
cat $actual
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
Expand All @@ -366,50 +366,25 @@ TOOLTEST_SAME()

# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actualout $actualerr $outputfile
rm -f $actual $actual_err $outputfile
fi
fi
fi
}


# Compare the two text files
# PASS if same
# FAIL if different, and show the diff
#
# Assumed arguments:
# $1 is text file1 (expected output)
# $2 is text file2 (actual output)
CMP_OUTPUT()
{
expect=$1
actual=$2

VERIFY_OUTPUT $@
if [ ! -f $expect ]; then
# 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
echo "*FAILED*"
echo " Expected output differs from actual output"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
}

TOOLTEST_FAIL()
# Call the h5copy tool and grep for a value
# txttype ERRTXT greps test error output, otherwise greps test output
GREPTEST()
{
expectout="$TESTDIR/$1"
expecterr="$TESTDIR/`basename $1 .out`.err"
actualout="$TESTDIR/$1.actualout"
actualerr="$TESTDIR/$1.actualerr"
actualout_sav=${actualout}-sav
actualerr_sav=${actualerr}-sav
txttype=$1
expectdata=$2
expectout="$TESTDIR/$3"
expecterr="$TESTDIR/`basename $3 .out`.err"
actual="$TESTDIR/$3.actual"
actual_err="$TESTDIR/$3.actual_err"
shift
shift
shift
if [ "$1" = -i ]; then
inputfile=$2
Expand All @@ -419,41 +394,32 @@ TOOLTEST_FAIL()
outputfile=$4
fi

# Run test.
TESTING $H5COPY $@
(
#echo "#############################"
#echo " output for '$H5COPY $@'"
#echo "#############################"
$RUNSERIAL $H5COPY_BIN $@
) > $actualout 2> $actualerr
) > $actual 2> $actual_err
RET=$?

# save actualout and actualerr in case they are needed later.
cp $actualout $actualout_sav
STDOUT_FILTER $actualout
cp $actualerr $actualerr_sav
STDERR_FILTER $actualerr
if [ $RET != 0 ]; then
if [ "$txttype" = "ERRTXT" ]; then
$GREP "$expectdata" $actual_err > /dev/null
else
$GREP "$expectdata" $actual > /dev/null
fi

if [ $? -eq 0 ]; then
echo " PASSED"
# Verifying output text from h5copy
if [ "$expectout" != "SKIP" ]; then
CMP_OUTPUT $expecterr $actualerr
fi
else
echo "*FAILED*"
echo "failed result is:"
cat $actualout
echo " FAILED"
nerrors="`expr $nerrors + 1`"
fi


# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actualout $actualerr $actualout_sav $actualerr_sav $outputfile
rm -f $actual $actual_err
fi
}


# Call the h5diff tool
#
H5DIFFTEST()
Expand All @@ -469,22 +435,6 @@ H5DIFFTEST()
fi
}

# Call the h5diff tool with a call that is expected to fail
#
H5DIFFTEST_FAIL()
{
VERIFY $@
$RUNSERIAL $H5DIFF_BIN -q "$@"
RET=$?

if [ $h5haveexitcode = 'yes' -a $RET != 1 ] ; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
fi
}

# ADD_HELP_TEST
TOOLTEST_HELP() {

Expand Down Expand Up @@ -630,7 +580,7 @@ TEST_MISC()
TESTFILE="$TESTDIR/h5copytst.h5"

echo "Test copying object into group which doesn't exist, without -p"
TOOLTEST_FAIL h5copy_misc1.out -i $TESTFILE -o $TESTDIR/h5copy_misc1.out.h5 -v -s /simple -d /g1/g2/simple
GREPTEST ERRTXT "h5copy error" h5copy_misc1.out -i $TESTFILE -o $TESTDIR/h5copy_misc1.out.h5 -v -s /simple -d /g1/g2/simple

echo "Test copying objects to the same file "
TOOLTEST_SAME -i $TESTFILE -o $TESTDIR/samefile1.out.h5 /simple /simple_cp
Expand Down
4 changes: 0 additions & 4 deletions tools/test/h5diff/expected/dangling_link.err

This file was deleted.

4 changes: 0 additions & 4 deletions tools/test/h5diff/expected/h5diff_601_ERR.err

This file was deleted.

12 changes: 0 additions & 12 deletions tools/test/h5diff/expected/h5diff_udfail.err

This file was deleted.

Loading

0 comments on commit ea3a3a2

Please sign in to comment.