HDFFV-10632 update autotools test scripts to match cmake

This commit is contained in:
Allen Byrne
2018-12-06 12:48:39 -06:00
parent 2998dbfc70
commit 11b4c1f3af
11 changed files with 329 additions and 107 deletions

View File

@@ -32,19 +32,19 @@ fi
#echo #echo
#exit 0 #exit 0
H5WATCH=h5watch # The tool name H5WATCH=h5watch # The tool name
H5WATCH_BIN=`pwd`/$H5WATCH # The path of H5WATCH H5WATCH_BIN=`pwd`/$H5WATCH # The path of H5WATCH
EXTEND_DSET=extend_dset # Routine to extend the dataset when watching EXTEND_DSET=extend_dset # Routine to extend the dataset when watching
EXTEND_BIN=`pwd`/$EXTEND_DSET # The path of EXTEND_DSET EXTEND_BIN=`pwd`/$EXTEND_DSET # The path of EXTEND_DSET
# #
EXIT_SUCCESS=0 EXIT_SUCCESS=0
EXIT_FAILURE=1 EXIT_FAILURE=1
# #
GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets
GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST
WATCHFILE=`pwd`/WATCH.h5 # The HDF5 file generated to test h5watch WATCHFILE=`pwd`/WATCH.h5 # The HDF5 file generated to test h5watch
TESTFILE=TEST.h5 # The temporary file (a copy of WATCH.h5) used by tests TESTFILE=TEST.h5 # The temporary file (a copy of WATCH.h5) used by tests
TRY_MAX=30 # Try running the test again TRY_MAX=30 # Try running the test again
# #
# These 3 defines should be the same as the defines in ./extend_dset.c # These 3 defines should be the same as the defines in ./extend_dset.c
WRITER_MESSAGE=writer_message # The message file created by the "extend" process WRITER_MESSAGE=writer_message # The message file created by the "extend" process
@@ -53,7 +53,7 @@ MESSAGE_TIMEOUT=300 # Message timeout length in secs
# #
CMP='cmp -s' CMP='cmp -s'
DIFF='diff -c' DIFF='diff -c'
NLINES=20 # Max. lines of output to display if test fails NLINES=20 # Max. lines of output to display if test fails
# #
# Mac OS: just to make sure echo "backslash backslash" behaves properly # Mac OS: just to make sure echo "backslash backslash" behaves properly
if test `uname -s` = 'Darwin'; then if test `uname -s` = 'Darwin'; then
@@ -83,9 +83,9 @@ TESTING() {
# Overall algorithm: # Overall algorithm:
# #
# Run a test and print PASSED or FAILED # Run a test and print PASSED or FAILED
# If a test did not return with the expected return code, # If a test did not return with the expected return code,
# increment the `nerrors' global variable and (if $verbose is set) display up to $NLINES # increment the `nerrors' global variable and (if $verbose is set) display up to $NLINES
# lines of the actual output from the test. # lines of the actual output from the test.
# If the test did return the expected code, # If the test did return the expected code,
# compare the actual output with the expected output; # compare the actual output with the expected output;
# If the outputs are the same, print PASSED, # If the outputs are the same, print PASSED,
@@ -137,7 +137,54 @@ TOOLTEST() {
# Clean up output file # Clean up output file
if test -z "$HDF5_NOCLEANUP"; then if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err rm -f $actual $actual_err
fi
}
#
# TOOLTEST_ERR():
# same as toolset only compare error file
#
# Arguments:
#
# $1 -- expected output
# $2 -- expected return code
# $3 and on -- arguments for h5watch
TOOLTEST_ERR() {
expect="$srcdir/../testfiles/$1"
expect_err="$srcdir/../testfiles/`basename $1 .ddl`.err"
actual="../testfiles/`basename $1 .ddl`.out"
actual_err="../testfiles/`basename $1 .ddl`.out.err"
shift
retvalexpect=$1
shift
# Run test.
TESTING $H5WATCH $@
(
$RUNSERIAL $H5WATCH_BIN "$@"
) > $actual 2>$actual_err
exitcode=$?
if [ $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
elif $CMP $expect_err $actual_err; then
$ECHO " PASSED"
else
$ECHO "*FAILED*"
$ECHO " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err
fi fi
} }
@@ -176,15 +223,15 @@ do
# Wait for message from "extend_dset" process to start h5watch-- # Wait for message from "extend_dset" process to start h5watch--
# To wait for the writer message file or till the maximum # of seconds is reached # To wait for the writer message file or till the maximum # of seconds is reached
# This performs similar function as the routine h5_wait_message() in test/h5test.c # This performs similar function as the routine h5_wait_message() in test/h5test.c
mexist=0 # Indicate whether the message file is found mexist=0 # Indicate whether the message file is found
t0=`date +%s` # Get current time in seconds t0=`date +%s` # Get current time in seconds
difft=0 # Initialize the time difference difft=0 # Initialize the time difference
while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out
do do
t1=`date +%s` # Get current time in seconds t1=`date +%s` # Get current time in seconds
difft=`expr $t1 - $t0` # Calculate the time difference difft=`expr $t1 - $t0` # Calculate the time difference
if [ -e $WRITER_MESSAGE ]; then # If message file is found: if [ -e $WRITER_MESSAGE ]; then # If message file is found:
mexist=1 # indicate the message file is found mexist=1 # indicate the message file is found
rm $WRITER_MESSAGE # remove the message file rm $WRITER_MESSAGE # remove the message file
break # get out of the while loop break # get out of the while loop
fi fi
@@ -211,8 +258,8 @@ do
wait $extend_pid # Wait for "extend" process to complete wait $extend_pid # Wait for "extend" process to complete
extend_exit=$? # Collect "extend" process' exit code extend_exit=$? # Collect "extend" process' exit code
sleep 1 # Sleep to make sure output is flushed sleep 1 # Sleep to make sure output is flushed
kill $watch_pid # Kill h5watch kill $watch_pid # Kill h5watch
wait $watch_pid # Wait for "h5watch" process to complete wait $watch_pid # Wait for "h5watch" process to complete
# #
if [ $extend_exit -ne 0 ]; then # Error returned from "extend" process if [ $extend_exit -ne 0 ]; then # Error returned from "extend" process
$ECHO "*FAILED*" $ECHO "*FAILED*"
@@ -265,7 +312,7 @@ done;
# DSET_ONE: one-dimensional dataset # # DSET_ONE: one-dimensional dataset #
# DSET_TWO: two-dimensional dataset # # DSET_TWO: two-dimensional dataset #
# DSET_CMPD: one-dimensional dataset with compound type # # DSET_CMPD: one-dimensional dataset with compound type #
# DSET_CMPD_ESC: one-dimensional dataset with compound type & escape/separator characters # # DSET_CMPD_ESC: one-dimensional dataset with compound type & escape/separator characters #
# DSET_CMPD_TWO: two-dimensional dataset with compound type # # DSET_CMPD_TWO: two-dimensional dataset with compound type #
# # # #
# The following datasets are one-dimensional, chunked, max. dimension setting: # # The following datasets are one-dimensional, chunked, max. dimension setting: #
@@ -282,11 +329,11 @@ done;
################################################################################################# #################################################################################################
# # # #
# Tests on expected failures: # # Tests on expected failures: #
# Invalid file name # # Invalid file name #
# Unable to find dataset, invalid dataset # # Unable to find dataset, invalid dataset #
# DSET_NONE and DSET_NOMAX # # DSET_NONE and DSET_NOMAX #
# Invalid input to options --width and --polling # # Invalid input to options --width and --polling #
# Invalid field names for -f option # # Invalid field names for -f option #
# # # #
################################################################################################# #################################################################################################
# #
@@ -296,21 +343,21 @@ $GEN_TEST_BIN
TOOLTEST w-help1.ddl 0 --help TOOLTEST w-help1.ddl 0 --help
# #
# Tests on expected failures # Tests on expected failures
TOOLTEST w-err-dset1.ddl 1 WATCH.h5 TOOLTEST_ERR w-err-dset1.ddl 1 WATCH.h5
TOOLTEST w-err-dset2.ddl 1 WATCH.h5/group/DSET_CMPD TOOLTEST_ERR w-err-dset2.ddl 1 WATCH.h5/group/DSET_CMPD
TOOLTEST w-err-dset-none.ddl 1 WATCH.h5/DSET_NONE TOOLTEST_ERR w-err-dset-none.ddl 1 WATCH.h5/DSET_NONE
TOOLTEST w-err-dset-nomax.ddl 1 WATCH.h5/DSET_NOMAX TOOLTEST_ERR w-err-dset-nomax.ddl 1 WATCH.h5/DSET_NOMAX
TOOLTEST w-err-file.ddl 1 ../WATCH.h5/DSET_CMPD TOOLTEST_ERR w-err-file.ddl 1 ../WATCH.h5/DSET_CMPD
TOOLTEST w-err-width.ddl 1 --width=-8 WATCH.h5/DSET_ONE TOOLTEST w-err-width.ddl 1 --width=-8 WATCH.h5/DSET_ONE
TOOLTEST w-err-poll.ddl 1 --polling=-8 WATCH.h5/DSET_ONE TOOLTEST w-err-poll.ddl 1 --polling=-8 WATCH.h5/DSET_ONE
TOOLTEST w-err-poll0.ddl 1 --polling=0 WATCH.h5/DSET_ONE TOOLTEST w-err-poll0.ddl 1 --polling=0 WATCH.h5/DSET_ONE
# #
# Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD # Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD
TOOLTEST w-err-cmpd1.ddl 1 --fields=fieldx WATCH.h5/DSET_CMPD TOOLTEST_ERR w-err-cmpd1.ddl 1 --fields=fieldx WATCH.h5/DSET_CMPD
TOOLTEST w-err-cmpd2.ddl 1 --fields=field1,field2. WATCH.h5/DSET_CMPD TOOLTEST_ERR w-err-cmpd2.ddl 1 --fields=field1,field2. WATCH.h5/DSET_CMPD
TOOLTEST w-err-cmpd3.ddl 1 --fields=field1,field2, WATCH.h5/DSET_CMPD TOOLTEST_ERR w-err-cmpd3.ddl 1 --fields=field1,field2, WATCH.h5/DSET_CMPD
TOOLTEST w-err-cmpd4.ddl 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD TOOLTEST_ERR w-err-cmpd4.ddl 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD
TOOLTEST w-err-cmpd5.ddl 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD TOOLTEST_ERR w-err-cmpd5.ddl 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD
# #
echo "DONE WITH 1st SET OF TESTS" echo "DONE WITH 1st SET OF TESTS"
# #

View File

@@ -38,17 +38,20 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
minor: Unable to open file minor: Unable to open file
#001: (file name) line (number) in H5VL_file_open(): open failed #001: (file name) line (number) in H5VL_file_open(): open failed
major: Virtual Object Layer major: Virtual Object Layer
minor: Unable to initialize object minor: Can't open object
#002: (file name) line (number) in H5VL_native_file_open(): unable to open file #002: (file name) line (number) in H5VL__file_open(): open failed
major: Virtual Object Layer
minor: Can't open object
#003: (file name) line (number) in H5VL__native_file_open(): unable to open file
major: File accessibility major: File accessibility
minor: Unable to open file minor: Unable to open file
#003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 #004: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1
major: File accessibility major: File accessibility
minor: Unable to open file minor: Unable to open file
#004: (file name) line (number) in H5FD_open(): open failed #005: (file name) line (number) in H5FD_open(): open failed
major: Virtual File Layer major: Virtual File Layer
minor: Unable to initialize object minor: Unable to initialize object
#005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 #006: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2
major: File accessibility major: File accessibility
minor: Unable to open file minor: Unable to open file
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
@@ -57,16 +60,19 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
minor: Unable to open file minor: Unable to open file
#001: (file name) line (number) in H5VL_file_open(): open failed #001: (file name) line (number) in H5VL_file_open(): open failed
major: Virtual Object Layer major: Virtual Object Layer
minor: Unable to initialize object minor: Can't open object
#002: (file name) line (number) in H5VL_native_file_open(): unable to open file #002: (file name) line (number) in H5VL__file_open(): open failed
major: Virtual Object Layer
minor: Can't open object
#003: (file name) line (number) in H5VL__native_file_open(): unable to open file
major: File accessibility major: File accessibility
minor: Unable to open file minor: Unable to open file
#003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 #004: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1
major: File accessibility major: File accessibility
minor: Unable to open file minor: Unable to open file
#004: (file name) line (number) in H5FD_open(): open failed #005: (file name) line (number) in H5FD_open(): open failed
major: Virtual File Layer major: Virtual File Layer
minor: Unable to initialize object minor: Unable to initialize object
#005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 #006: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2
major: File accessibility major: File accessibility
minor: Unable to open file minor: Unable to open file

View File

@@ -60,6 +60,7 @@ $SRC_H5COPY_TESTFILES/h5copy_extlinks_trg.h5
# List of expect files that will be copied over to local test dir # List of expect files that will be copied over to local test dir
LIST_OTHER_TEST_FILES=" LIST_OTHER_TEST_FILES="
$SRC_H5COPY_TESTFILES/h5copy_misc1.out $SRC_H5COPY_TESTFILES/h5copy_misc1.out
$SRC_H5COPY_TESTFILES/h5copy_misc1.err
" "
H5COPY=../../src/h5copy/h5copy # The tool name H5COPY=../../src/h5copy/h5copy # The tool name
@@ -396,6 +397,7 @@ CMP_OUTPUT()
TOOLTEST_FAIL() TOOLTEST_FAIL()
{ {
expectout="$TESTDIR/$1" expectout="$TESTDIR/$1"
expecterr="$TESTDIR/`basename $1 .out`.err"
actualout="$TESTDIR/$1.actualout" actualout="$TESTDIR/$1.actualout"
actualerr="$TESTDIR/$1.actualerr" actualerr="$TESTDIR/$1.actualerr"
actualout_sav=${actualout}-sav actualout_sav=${actualout}-sav
@@ -426,10 +428,7 @@ TOOLTEST_FAIL()
echo " PASSED" echo " PASSED"
# Verifying output text from h5copy # Verifying output text from h5copy
if [ "$expectout" != "SKIP" ]; then if [ "$expectout" != "SKIP" ]; then
# combine stderr to stdout to compare the output at once. CMP_OUTPUT $expecterr $actualerr
# We may seperate stdout and stderr later.
cat $actualerr >> $actualout
CMP_OUTPUT $expectout $actualout
fi fi
else else
echo "*FAILED*" echo "*FAILED*"

View File

@@ -62,6 +62,7 @@ LIST_HDF5_TEST_FILES="
$SRC_H5DIFF_TESTFILES/tudfilter.h5 $SRC_H5DIFF_TESTFILES/tudfilter.h5
$SRC_H5DIFF_TESTFILES/tudfilter2.h5 $SRC_H5DIFF_TESTFILES/tudfilter2.h5
$SRC_H5DIFF_TESTFILES/h5diff_ud.txt $SRC_H5DIFF_TESTFILES/h5diff_ud.txt
$SRC_H5DIFF_TESTFILES/h5diff_udfail.err
$SRC_H5DIFF_TESTFILES/h5diff_udfail.txt $SRC_H5DIFF_TESTFILES/h5diff_udfail.txt
" "
@@ -204,7 +205,7 @@ VERIFY() {
TOOLTEST() { TOOLTEST() {
expect="$TESTDIR/$1" expect="$TESTDIR/$1"
actual="$TESTDIR/`basename $1 .txt`.out" actual="$TESTDIR/`basename $1 .txt`.out"
actual_err="$TESTDIR/`basename $1 .txt`.err" actual_err="$TESTDIR/`basename $1 .txt`.out.err"
actual_sav=${actual}-sav actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav actual_err_sav=${actual_err}-sav
shift shift
@@ -287,6 +288,90 @@ TOOLTEST() {
rm -f $actual_sorted $expect_sorted rm -f $actual_sorted $expect_sorted
fi fi
} }
# Same as TOOLSET except only err file checked
TOOLTEST_ERR() {
expect="$TESTDIR/$1"
expect_err="$TESTDIR/`basename $1 .txt`.err"
actual="$TESTDIR/`basename $1 .txt`.out"
actual_err="$TESTDIR/`basename $1 .txt`.out.err"
actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav
shift
if test -n "$pmode"; then
RUNCMD=$RUNPARALLEL
else
RUNCMD=$RUNSERIAL
fi
# Run test.
TESTING $H5DIFF $@
(
#echo "#############################"
#echo "Expected output for '$H5DIFF $@'"
#echo "#############################"
cd $TESTDIR
eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@"
) >$actual 2>$actual_err
EXIT_CODE=$?
# save actual and actual_err in case they are needed later.
cp $actual $actual_sav
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
# 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.
if test $h5haveexitcode = 'yes' -a -z "$pmode"; then
echo "EXIT CODE: $EXIT_CODE" >> $actual
fi
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_err $actual_err; then
echo " PASSED"
elif test $h5haveexitcode = 'yes' -a -z "$pmode"; then
echo "*FAILED*"
echo " Expected result ($expect_err) differs from actual result ($actual_err)"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /'
else
# parallel mode output are often of different ordering from serial
# output. If the sorted expect_err and actual_err files compare the same,
# it is safe to assume the actual output match the expected file.
expect_sorted=expect_sorted
actual_sorted=actual_sorted
sort $expect_err -o $expect_sorted
sort $actual_err -o $actual_sorted
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 ""
fi
fi
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $actual $actual_err $actual_sav $actual_err_sav
rm -f $actual_sorted $expect_sorted
fi
}
############################################################################## ##############################################################################
### T H E T E S T S ### T H E T E S T S

View File

@@ -226,6 +226,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_451.txt
$SRC_H5DIFF_TESTFILES/h5diff_452.txt $SRC_H5DIFF_TESTFILES/h5diff_452.txt
$SRC_H5DIFF_TESTFILES/h5diff_453.txt $SRC_H5DIFF_TESTFILES/h5diff_453.txt
$SRC_H5DIFF_TESTFILES/h5diff_454.txt $SRC_H5DIFF_TESTFILES/h5diff_454.txt
$SRC_H5DIFF_TESTFILES/dangling_link.err
$SRC_H5DIFF_TESTFILES/h5diff_455.txt $SRC_H5DIFF_TESTFILES/h5diff_455.txt
$SRC_H5DIFF_TESTFILES/h5diff_456.txt $SRC_H5DIFF_TESTFILES/h5diff_456.txt
$SRC_H5DIFF_TESTFILES/h5diff_457.txt $SRC_H5DIFF_TESTFILES/h5diff_457.txt
@@ -286,6 +287,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_62.txt
$SRC_H5DIFF_TESTFILES/h5diff_63.txt $SRC_H5DIFF_TESTFILES/h5diff_63.txt
$SRC_H5DIFF_TESTFILES/h5diff_600.txt $SRC_H5DIFF_TESTFILES/h5diff_600.txt
$SRC_H5DIFF_TESTFILES/h5diff_601.txt $SRC_H5DIFF_TESTFILES/h5diff_601.txt
$SRC_H5DIFF_TESTFILES/h5diff_601_ERR.err
$SRC_H5DIFF_TESTFILES/h5diff_603.txt $SRC_H5DIFF_TESTFILES/h5diff_603.txt
$SRC_H5DIFF_TESTFILES/h5diff_604.txt $SRC_H5DIFF_TESTFILES/h5diff_604.txt
$SRC_H5DIFF_TESTFILES/h5diff_605.txt $SRC_H5DIFF_TESTFILES/h5diff_605.txt
@@ -462,8 +464,9 @@ TESTING() {
# #
TOOLTEST() { TOOLTEST() {
expect="$TESTDIR/$1" expect="$TESTDIR/$1"
expect_err="$TESTDIR/`basename $1 .txt`.err"
actual="$TESTDIR/`basename $1 .txt`.out" actual="$TESTDIR/`basename $1 .txt`.out"
actual_err="$TESTDIR/`basename $1 .txt`.err" actual_err="$TESTDIR/`basename $1 .txt`.out.err"
actual_sav=${actual}-sav actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav actual_err_sav=${actual_err}-sav
shift shift
@@ -488,7 +491,6 @@ TOOLTEST() {
STDOUT_FILTER $actual STDOUT_FILTER $actual
cp $actual_err $actual_err_sav cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err STDERR_FILTER $actual_err
cat $actual_err >> $actual
# don't add exit code check in pmode, as it causes failure. (exit code # don't add exit code check in pmode, as it causes failure. (exit code
# is from mpirun not tool) # is from mpirun not tool)
# if any problem occurs relate to an exit code, it will be caught in # if any problem occurs relate to an exit code, it will be caught in

View File

@@ -490,7 +490,6 @@ TOOLTEST() {
STDOUT_FILTER $actual STDOUT_FILTER $actual
cp $actual_err $actual_err_sav cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err STDERR_FILTER $actual_err
cat $actual_err >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Create the expect file if it doesn't yet exist.
@@ -534,7 +533,6 @@ TOOLTEST2() {
cd $TESTDIR cd $TESTDIR
$RUNSERIAL $DUMPER_BIN "$@" $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err ) >$actual 2>$actual_err
cat $actual_err >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Create the expect file if it doesn't yet exist.
@@ -593,7 +591,6 @@ TOOLTEST2A() {
cd $TESTDIR cd $TESTDIR
$RUNSERIAL $DUMPER_BIN "$@" $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err ) >$actual 2>$actual_err
cat $actual_err >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Create the expect file if it doesn't yet exist.
@@ -660,7 +657,6 @@ TOOLTEST2B() {
cd $TESTDIR cd $TESTDIR
$RUNSERIAL $DUMPER_BIN "$@" $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err ) >$actual 2>$actual_err
cat $actual_err >> $actual
if [ ! -f $expectdata ]; then if [ ! -f $expectdata ]; then
# Create the expect data file if it doesn't yet exist. # Create the expect data file if it doesn't yet exist.
@@ -717,7 +713,6 @@ TOOLTEST3() {
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
$actual_err > $actual_ext $actual_err > $actual_ext
cat $actual_ext >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Create the expect file if it doesn't yet exist.
@@ -776,7 +771,6 @@ TOOLTEST4() {
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
$actual_err > $actual_ext $actual_err > $actual_ext
#cat $actual_ext >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Create the expect file if it doesn't yet exist.
@@ -842,7 +836,6 @@ TOOLTEST5() {
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
$actual_err > $actual_ext $actual_err > $actual_ext
#cat $actual_ext >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Create the expect file if it doesn't yet exist.
@@ -886,7 +879,6 @@ TOOLTEST_HELP() {
cd $TESTDIR cd $TESTDIR
$RUNSERIAL $DUMPER_BIN "$@" $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err ) >$actual 2>$actual_err
cat $actual_err >> $actual
if [ ! -f $expectdata ]; then if [ ! -f $expectdata ]; then
# Create the expect data file if it doesn't yet exist. # Create the expect data file if it doesn't yet exist.

View File

@@ -235,7 +235,6 @@ TOOLTEST() {
STDOUT_FILTER $actual STDOUT_FILTER $actual
cp $actual_err $actual_err_sav cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err STDERR_FILTER $actual_err
cat $actual_err >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Create the expect file if it doesn't yet exist.
@@ -278,7 +277,6 @@ TOOLTEST2() {
cd $TESTDIR cd $TESTDIR
$RUNSERIAL $DUMPER_BIN "$@" $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err ) >$actual 2>$actual_err
cat $actual_err >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Create the expect file if it doesn't yet exist.
@@ -348,7 +346,6 @@ TOOLTEST3() {
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
$actual_err > $actual_ext $actual_err > $actual_ext
cat $actual_ext >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Create the expect file if it doesn't yet exist.
@@ -406,7 +403,6 @@ TOOLTEST4() {
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
$actual_err > $actual_ext $actual_err > $actual_ext
#cat $actual_ext >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Create the expect file if it doesn't yet exist.

View File

@@ -103,13 +103,18 @@ $SRC_H5FORMCONV_TESTFILES/old_h5fc_ext3_isf.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_err_level.h5 $SRC_H5FORMCONV_TESTFILES/h5fc_err_level.h5
" "
LIST_ERR_TEST_FILES="
$SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl.err
$SRC_H5FORMCONV_TESTFILES/h5fc_dname.err
$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistfile.ddl.err
$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistdset_file.ddl.err
"
LIST_OTHER_TEST_FILES=" LIST_OTHER_TEST_FILES="
$SRC_H5FORMCONV_TESTFILES/h5fc_help.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_help.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_nooption.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_nooption.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistfile.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_dname.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_dname.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistdset_file.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_v_non_chunked.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_non_chunked.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_v_bt1.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_bt1.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_v_ndata_bt1.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_ndata_bt1.ddl
@@ -137,7 +142,7 @@ $SRC_H5FORMCONV_TESTFILES/h5fc_v_err.ddl.err
# #
# copy test files and expected output files from source dirs to test dir # copy test files and expected output files from source dirs to test dir
# #
COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES" COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_ERR_TEST_FILES $LIST_OTHER_TEST_FILES"
COPY_TESTFILES_TO_TESTDIR() COPY_TESTFILES_TO_TESTDIR()
{ {
@@ -193,6 +198,9 @@ TESTING() {
echo "Testing $* $SPACES" | cut -c1-80 | tr -d '\012' echo "Testing $* $SPACES" | cut -c1-80 | tr -d '\012'
} }
# Source in the output filter function definitions.
. $srcdir/../../../bin/output_filter.sh
# Run a test and print PASS or *FAIL*. If a test fails then increment # Run a test and print PASS or *FAIL*. If a test fails then increment
# the `nerrors' global variable and (if $verbose is set) display the # the `nerrors' global variable and (if $verbose is set) display the
# difference between the actual output and the expected output. The # difference between the actual output and the expected output. The
@@ -212,8 +220,9 @@ TESTING() {
TOOLTEST_OUT() { TOOLTEST_OUT() {
# Prepare expected and actual output # Prepare expected and actual output
expect="$TESTDIR/$1" expect="$TESTDIR/$1"
expect_err="$TESTDIR/`basename $1 .ddl`.err"
actual="$TESTDIR/`basename $1 .ddl`.out" actual="$TESTDIR/`basename $1 .ddl`.out"
actual_err="$TESTDIR/`basename $1 .ddl`.err" actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
actual_sav=${actual}-sav actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav actual_err_sav=${actual_err}-sav
@@ -233,7 +242,6 @@ TOOLTEST_OUT() {
) >$actual 2>$actual_err ) >$actual 2>$actual_err
cp $actual $actual_sav cp $actual $actual_sav
cp $actual_err $actual_err_sav cp $actual_err $actual_err_sav
cat $actual_err >> $actual
# Compare output # Compare output
COMPARE_OUT $expect $actual COMPARE_OUT $expect $actual
@@ -251,7 +259,7 @@ TOOLTEST_MASK_OUT() {
expect_err="$TESTDIR/$1.err" expect_err="$TESTDIR/$1.err"
actual_ext="$TESTDIR/$1.ext" actual_ext="$TESTDIR/$1.ext"
actual="$TESTDIR/`basename $1 .ddl`.out" actual="$TESTDIR/`basename $1 .ddl`.out"
actual_err="$TESTDIR/`basename $1 .ddl`.err" actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
actual_sav=${actual}-sav actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav actual_err_sav=${actual_err}-sav
@@ -305,6 +313,42 @@ TOOLTEST_MASK_OUT() {
$RM $actual $actual_err $actual_sav $actual_err_sav $RM $actual $actual_err $actual_sav $actual_err_sav
fi fi
} }
# Same as TOOLTEST_OUT except only compares error outout
TOOLTEST_ERR() {
# Prepare expected and actual output
expect="$TESTDIR/$1"
expect_err="$TESTDIR/$1.err"
actual="$TESTDIR/`basename $1 .ddl`.out"
actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav
# Prepare the test file
$RM $TESTDIR/$TMPOUTFILE
TFILE=$2
if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then
$CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE
TFILE=$TMPOUTFILE
fi
# Run test.
TESTING $FORMCONV $3 $4 $5 $6 $2
(
cd $TESTDIR
$RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE
) >$actual 2>$actual_err
cp $actual $actual_sav
cp $actual_err $actual_err_sav
# Compare output
COMPARE_OUT $expect_err $actual_err
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
$RM $actual $actual_err
$RM $actual $actual_err $actual_sav $actual_err_sav
fi
}
# To check that the tool exits success, no output # To check that the tool exits success, no output
# Assume all short options # Assume all short options
@@ -406,7 +450,7 @@ COPY_TESTFILES_TO_TESTDIR
# h5format_convert nonexist.h5 (no options, file does not exist) # h5format_convert nonexist.h5 (no options, file does not exist)
TOOLTEST_OUT h5fc_help.ddl '' --help TOOLTEST_OUT h5fc_help.ddl '' --help
TOOLTEST_OUT h5fc_nooption.ddl '' TOOLTEST_OUT h5fc_nooption.ddl ''
TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5 TOOLTEST_ERR h5fc_nonexistfile.ddl nonexist.h5
# #
# #
# h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists) # h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists)
@@ -416,7 +460,7 @@ TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5
TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 -d TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 -d
TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 --dname TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 --dname
TOOLTEST_OUT h5fc_dname.ddl '' --dname TOOLTEST_OUT h5fc_dname.ddl '' --dname
TOOLTEST_OUT h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist TOOLTEST_ERR h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist
# #
# #
# #

View File

@@ -53,6 +53,7 @@ SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles" SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles" SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles" SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
SRC_H5LS_ERRFILES="$SRC_TOOLS/test/h5ls/errfiles"
TESTDIR=./testfiles TESTDIR=./testfiles
test -d $TESTDIR || mkdir $TESTDIR test -d $TESTDIR || mkdir $TESTDIR
@@ -93,6 +94,12 @@ $SRC_H5LS_TESTFILES/tvldtypes1.h5
$SRC_H5LS_TESTFILES/tdset_idx.h5 $SRC_H5LS_TESTFILES/tdset_idx.h5
" "
LIST_ERROR_TEST_FILES="
$SRC_H5LS_ERRFILES/nosuchfile.err
$SRC_H5LS_ERRFILES/textlinksrc-nodangle-1.err
$SRC_H5LS_ERRFILES/tgroup-1.err
"
LIST_OTHER_TEST_FILES=" LIST_OTHER_TEST_FILES="
$SRC_H5LS_TESTFILES/help-1.ls $SRC_H5LS_TESTFILES/help-1.ls
$SRC_H5LS_TESTFILES/help-2.ls $SRC_H5LS_TESTFILES/help-2.ls
@@ -228,8 +235,9 @@ TESTING() {
# $2 and on -- argument for the h5ls tool # $2 and on -- argument for the h5ls tool
TOOLTEST() { TOOLTEST() {
expect="$TESTDIR/$1" expect="$TESTDIR/$1"
expect_err="$TESTDIR/`basename $1 .ls`.err"
actual="$TESTDIR/`basename $1 .ls`.out" actual="$TESTDIR/`basename $1 .ls`.out"
actual_err="$TESTDIR/`basename $1 .ls`.err" actual_err="$TESTDIR/`basename $1 .ls`.out.err"
actual_sav=${actual}-sav actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav actual_err_sav=${actual_err}-sav
shift shift
@@ -251,7 +259,6 @@ TOOLTEST() {
STDOUT_FILTER $actual STDOUT_FILTER $actual
cp $actual_err $actual_err_sav cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err STDERR_FILTER $actual_err
cat $actual_err >> $actual
if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
echo "*FAILED*" echo "*FAILED*"
nerrors="`expr $nerrors + 1`" nerrors="`expr $nerrors + 1`"

View File

@@ -79,6 +79,18 @@ $SRC_H5STAT_TESTFILES/h5stat_idx.h5
$SRC_H5STAT_TESTFILES/h5stat_threshold.h5 $SRC_H5STAT_TESTFILES/h5stat_threshold.h5
" "
LIST_ERR_TEST_FILES="
$SRC_H5STAT_TESTFILES/h5stat_err_refcount.err
$SRC_H5STAT_TESTFILES/h5stat_err_old_layout.err
$SRC_H5STAT_TESTFILES/h5stat_err_old_fill.err
$SRC_H5STAT_TESTFILES/h5stat_err1_links.err
$SRC_H5STAT_TESTFILES/h5stat_err1_dims.err
$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.err
$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.err
$SRC_H5STAT_TESTFILES/h5stat_notexist.err
$SRC_H5STAT_TESTFILES/h5stat_nofile.err
"
LIST_OTHER_TEST_FILES=" LIST_OTHER_TEST_FILES="
$SRC_H5STAT_TESTFILES/h5stat_err_refcount.ddl $SRC_H5STAT_TESTFILES/h5stat_err_refcount.ddl
$SRC_H5STAT_TESTFILES/h5stat_err_old_layout.ddl $SRC_H5STAT_TESTFILES/h5stat_err_old_layout.ddl
@@ -100,17 +112,13 @@ $SRC_H5STAT_TESTFILES/h5stat_newgrat.ddl
$SRC_H5STAT_TESTFILES/h5stat_newgrat-UG.ddl $SRC_H5STAT_TESTFILES/h5stat_newgrat-UG.ddl
$SRC_H5STAT_TESTFILES/h5stat_newgrat-UA.ddl $SRC_H5STAT_TESTFILES/h5stat_newgrat-UA.ddl
$SRC_H5STAT_TESTFILES/h5stat_idx.ddl $SRC_H5STAT_TESTFILES/h5stat_idx.ddl
$SRC_H5STAT_TESTFILES/h5stat_err1_links.ddl
$SRC_H5STAT_TESTFILES/h5stat_links1.ddl $SRC_H5STAT_TESTFILES/h5stat_links1.ddl
$SRC_H5STAT_TESTFILES/h5stat_links2.ddl $SRC_H5STAT_TESTFILES/h5stat_links2.ddl
$SRC_H5STAT_TESTFILES/h5stat_links3.ddl $SRC_H5STAT_TESTFILES/h5stat_links3.ddl
$SRC_H5STAT_TESTFILES/h5stat_links4.ddl $SRC_H5STAT_TESTFILES/h5stat_links4.ddl
$SRC_H5STAT_TESTFILES/h5stat_links5.ddl $SRC_H5STAT_TESTFILES/h5stat_links5.ddl
$SRC_H5STAT_TESTFILES/h5stat_err1_dims.ddl
$SRC_H5STAT_TESTFILES/h5stat_dims1.ddl $SRC_H5STAT_TESTFILES/h5stat_dims1.ddl
$SRC_H5STAT_TESTFILES/h5stat_dims2.ddl $SRC_H5STAT_TESTFILES/h5stat_dims2.ddl
$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.ddl
$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.ddl
$SRC_H5STAT_TESTFILES/h5stat_numattrs1.ddl $SRC_H5STAT_TESTFILES/h5stat_numattrs1.ddl
$SRC_H5STAT_TESTFILES/h5stat_numattrs2.ddl $SRC_H5STAT_TESTFILES/h5stat_numattrs2.ddl
$SRC_H5STAT_TESTFILES/h5stat_numattrs3.ddl $SRC_H5STAT_TESTFILES/h5stat_numattrs3.ddl
@@ -120,7 +128,7 @@ $SRC_H5STAT_TESTFILES/h5stat_numattrs4.ddl
# #
# copy test files and expected output files from source dirs to test dir # copy test files and expected output files from source dirs to test dir
# #
COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES" COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_ERR_TEST_FILES $LIST_OTHER_TEST_FILES"
COPY_TESTFILES_TO_TESTDIR() COPY_TESTFILES_TO_TESTDIR()
{ {
@@ -184,8 +192,9 @@ TESTING() {
# #
TOOLTEST() { TOOLTEST() {
expect="$TESTDIR/$1" expect="$TESTDIR/$1"
expect_err="$TESTDIR/`basename $1 .ddl`.err"
actual="$TESTDIR/`basename $1 .ddl`.out" actual="$TESTDIR/`basename $1 .ddl`.out"
actual_err="$TESTDIR/`basename $1 .ddl`.err" actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
actual_sav=${actual}-sav actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav actual_err_sav=${actual_err}-sav
shift shift
@@ -202,14 +211,17 @@ TOOLTEST() {
STDOUT_FILTER $actual STDOUT_FILTER $actual
cp $actual_err $actual_err_sav cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err STDERR_FILTER $actual_err
cat $actual_err >> $actual
if [ ! -f $expect ]; then if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist. # Compare error files if the expect file doesn't exist.
echo " CREATED" if $CMP $expect_err $actual_err; then
cp $actual $expect echo " PASSED"
echo " Expected result (*.ddl) missing" else
nerrors="`expr $nerrors + 1`" echo "*FAILED*"
echo " Expected result (*.err) differs from actual result (*.out.err)"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /'
fi
elif $CMP $expect $actual; then elif $CMP $expect $actual; then
echo " PASSED" echo " PASSED"
else else

View File

@@ -62,10 +62,10 @@ test -d $TESTDIR || mkdir -p $TESTDIR
# copy test files and expected output files from source dirs to test dir # copy test files and expected output files from source dirs to test dir
# #
COPY_TESTFILES=" COPY_TESTFILES="
$SRC_H5CLEAR_TESTFILES/h5clear_open_fail.err
$SRC_H5CLEAR_TESTFILES/h5clear_no_mdc_image.err
$SRC_H5CLEAR_TESTFILES/h5clear_usage.ddl $SRC_H5CLEAR_TESTFILES/h5clear_usage.ddl
$SRC_H5CLEAR_TESTFILES/h5clear_open_fail.ddl
$SRC_H5CLEAR_TESTFILES/h5clear_missing_file.ddl $SRC_H5CLEAR_TESTFILES/h5clear_missing_file.ddl
$SRC_H5CLEAR_TESTFILES/h5clear_no_mdc_image.ddl
$SRC_H5CLEAR_TESTFILES/h5clear_status_noclose_after_size.ddl $SRC_H5CLEAR_TESTFILES/h5clear_status_noclose_after_size.ddl
$SRC_H5CLEAR_TESTFILES/h5clear_noclose_before_size.ddl $SRC_H5CLEAR_TESTFILES/h5clear_noclose_before_size.ddl
$SRC_H5CLEAR_TESTFILES/h5clear_noclose_after_size.ddl $SRC_H5CLEAR_TESTFILES/h5clear_noclose_after_size.ddl
@@ -179,8 +179,9 @@ TOOLTEST_OUT() {
expected=$5 expected=$5
# Prepare expected and actual output # Prepare expected and actual output
expect="$TESTDIR/$expected" expect="$TESTDIR/$expected"
expect_err="$TESTDIR/`basename $expected .ddl`.err"
actual="$TESTDIR/`basename $expected .ddl`.out" actual="$TESTDIR/`basename $expected .ddl`.out"
actual_err="$TESTDIR/`basename $expected .ddl`.err" actual_err="$TESTDIR/`basename $expected .ddl`.out.err"
actual_sav=${actual}-sav actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav actual_err_sav=${actual_err}-sav
@@ -192,7 +193,6 @@ TOOLTEST_OUT() {
) >$actual 2>$actual_err ) >$actual 2>$actual_err
cp $actual $actual_sav cp $actual $actual_sav
cp $actual_err $actual_err_sav cp $actual_err $actual_err_sav
cat $actual_err >> $actual
# Compare output # Compare output
COMPARE_OUT $expect $actual COMPARE_OUT $expect $actual
@@ -202,6 +202,38 @@ TOOLTEST_OUT() {
$RM $actual $actual_err $actual_sav $actual_err_sav $RM $actual $actual_err $actual_sav $actual_err_sav
fi fi
} }
# same as TOOLTEST_OUT just compare stderr
TOOLTEST_ERR() {
fname=$1
option1=$2
option2=$3
option3=$4
expected=$5
# Prepare expected and actual output
expect_err="$TESTDIR/$expected"
expect="$TESTDIR/`basename $expected .err`.ddl"
actual="$TESTDIR/`basename $expected .err`.out"
actual_err="$TESTDIR/`basename $expected .err`.out.err"
actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav
# Run test.
TESTING $H5CLEAR $option1 $option2 $option3 $option4 $fname
(
cd $TESTDIR
$RUNSERIAL $H5CLEAR_BIN $option1 $option2 $option3 $option4 $fname
) >$actual 2>$actual_err
cp $actual $actual_sav
cp $actual_err $actual_err_sav
# Compare output
COMPARE_OUT $expect_err $actual_err
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
$RM $actual $actual_err $actual_sav $actual_err_sav
fi
}
# $1 is the filename to open # $1 is the filename to open
# $2 is the expected return from the open/check program # $2 is the expected return from the open/check program
@@ -274,11 +306,11 @@ TOOLTEST_OUT "" "" "" "" h5clear_usage.ddl
TOOLTEST_OUT junk.h5 "" "" "" h5clear_usage.ddl TOOLTEST_OUT junk.h5 "" "" "" h5clear_usage.ddl
TOOLTEST_OUT orig_h5clear_sec2_v3.h5 "" "" "" h5clear_usage.ddl TOOLTEST_OUT orig_h5clear_sec2_v3.h5 "" "" "" h5clear_usage.ddl
TOOLTEST_OUT "" -m "" "" h5clear_missing_file.ddl TOOLTEST_OUT "" -m "" "" h5clear_missing_file.ddl
TOOLTEST_OUT junk.h5 -s "" "" h5clear_open_fail.ddl TOOLTEST_ERR junk.h5 -s "" "" h5clear_open_fail.err
TOOLTEST_OUT "" -m -s "" h5clear_missing_file.ddl TOOLTEST_OUT "" -m -s "" h5clear_missing_file.ddl
TOOLTEST_OUT junk.h5 -m -s "" h5clear_open_fail.ddl TOOLTEST_ERR junk.h5 -m -s "" h5clear_open_fail.err
TOOLTEST_OUT orig_h5clear_sec2_v2.h5 -m "" "" h5clear_no_mdc_image.ddl TOOLTEST_ERR orig_h5clear_sec2_v2.h5 -m "" "" h5clear_no_mdc_image.err
TOOLTEST_OUT orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.ddl TOOLTEST_ERR orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.err
# #
# #
# The following are tests to verify the expected exit code from h5clear: # The following are tests to verify the expected exit code from h5clear:
@@ -308,8 +340,8 @@ TOOLTEST h5clear_sec2_v0.h5 -l -m $FAIL
# #
# #
# h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear: # h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear:
TOOLTEST_OUT mod_h5clear_mdc_image.h5 -m "" "" h5clear_no_mdc_image.ddl TOOLTEST_ERR mod_h5clear_mdc_image.h5 -m "" "" h5clear_no_mdc_image.err
TOOLTEST_OUT mod_h5clear_mdc_image.h5 -s -m "" h5clear_no_mdc_image.ddl TOOLTEST_ERR mod_h5clear_mdc_image.h5 -s -m "" h5clear_no_mdc_image.err
# #
# #
# #
@@ -342,16 +374,16 @@ OPEN_CHK h5clear_sec2_v2.h5 $SUCCEED
# #
# #
# #
# (1) h5clear_status_noclose.h5 # (1) h5clear_status_noclose.h5
# "h5clear --filesize h5clear_status_noclose.h5" (unable to open the file because status_flag is on) # "h5clear --filesize h5clear_status_noclose.h5" (unable to open the file because status_flag is on)
# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) # "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0)
# (no output, check exit code) # (no output, check exit code)
# "h5clear --filesize h5clear_status_noclose_user.h5" (print EOA/EOF after the last action) # "h5clear --filesize h5clear_status_noclose_user.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_open_fail.ddl TOOLTEST_ERR h5clear_status_noclose.h5 --filesize "" "" h5clear_open_fail.err
TOOLTEST h5clear_status_noclose.h5 -s --increment=0 $SUCCEED TOOLTEST h5clear_status_noclose.h5 -s --increment=0 $SUCCEED
TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_status_noclose_after_size.ddl TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_status_noclose_after_size.ddl
# #
# (2) h5clear_fsm_persist_noclose.h5 # (2) h5clear_fsm_persist_noclose.h5
# "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF before the next action) # "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF before the next action)
# "h5clear --increment=0 h5clear_fsm_persist_noclose.h5" (EOA = MAX(EOA, EOF)) (no output, check exit code) # "h5clear --increment=0 h5clear_fsm_persist_noclose.h5" (EOA = MAX(EOA, EOF)) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF after the last action) # "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF after the last action)
@@ -364,7 +396,7 @@ TOOLTEST_OUT h5clear_fsm_persist_noclose.h5 --filesize "" "" h5clear_noclose_aft
# "h5clear --increment h5clear_fsm_persist_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code) # "h5clear --increment h5clear_fsm_persist_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF after the last action) # "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_before_size.ddl TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_before_size.ddl
TOOLTEST h5clear_fsm_persist_equal.h5 --increment "" $SUCCEED TOOLTEST h5clear_fsm_persist_equal.h5 --increment "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_after_size.ddl TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_after_size.ddl
# #
# (4) h5clear_fsm_persist_greater.h5 # (4) h5clear_fsm_persist_greater.h5
@@ -372,7 +404,7 @@ TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_after_s
# "h5clear --increment=0 h5clear_fsm_persist_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code) # "h5clear --increment=0 h5clear_fsm_persist_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF after the last action) # "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_before_size.ddl TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_before_size.ddl
TOOLTEST h5clear_fsm_persist_greater.h5 --increment=0 "" $SUCCEED TOOLTEST h5clear_fsm_persist_greater.h5 --increment=0 "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_after_size.ddl TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_after_size.ddl
# #
# (5) h5clear_fsm_persist_less.h5 # (5) h5clear_fsm_persist_less.h5
@@ -380,7 +412,7 @@ TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_aft
# "h5clear --increment=200 h5clear_fsm_persist_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code) # "h5clear --increment=200 h5clear_fsm_persist_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF after the last action) # "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_before_size.ddl TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_before_size.ddl
TOOLTEST h5clear_fsm_persist_less.h5 --increment=200 "" $SUCCEED TOOLTEST h5clear_fsm_persist_less.h5 --increment=200 "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_after_size.ddl TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_after_size.ddl
# #
# (6) h5clear_fsm_persist_user_equal.h5 # (6) h5clear_fsm_persist_user_equal.h5
@@ -388,7 +420,7 @@ TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_after_siz
# "h5clear --increment h5clear_fsm_persist_user_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code) # "h5clear --increment h5clear_fsm_persist_user_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF after the last action) # "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_before_size.ddl TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_before_size.ddl
TOOLTEST h5clear_fsm_persist_user_equal.h5 --increment "" $SUCCEED TOOLTEST h5clear_fsm_persist_user_equal.h5 --increment "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_after_size.ddl TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_after_size.ddl
# #
# (7) h5clear_fsm_persist_user_greater.h5 # (7) h5clear_fsm_persist_user_greater.h5
@@ -396,7 +428,7 @@ TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equ
# "h5clear --increment=0 h5clear_fsm_persist_user_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code) # "h5clear --increment=0 h5clear_fsm_persist_user_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF after the last action) # "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_before_size.ddl TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_before_size.ddl
TOOLTEST h5clear_fsm_persist_user_greater.h5 --increment=0 "" $SUCCEED TOOLTEST h5clear_fsm_persist_user_greater.h5 --increment=0 "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_after_size.ddl TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_after_size.ddl
# #
# (8) h5clear_fsm_persist_user_less.h5 # (8) h5clear_fsm_persist_user_less.h5
@@ -404,7 +436,7 @@ TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_g
# "h5clear --increment=200 h5clear_fsm_persist_user_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code) # "h5clear --increment=200 h5clear_fsm_persist_user_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF after the last action) # "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_before_size.ddl TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_before_size.ddl
TOOLTEST h5clear_fsm_persist_user_less.h5 --increment=200 "" $SUCCEED TOOLTEST h5clear_fsm_persist_user_less.h5 --increment=200 "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_after_size.ddl TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_after_size.ddl
# #
# #