diff options
author | Jonathan Kim <jkm@hdfgroup.org> | 2011-07-01 22:22:58 (GMT) |
---|---|---|
committer | Jonathan Kim <jkm@hdfgroup.org> | 2011-07-01 22:22:58 (GMT) |
commit | 07f28d80714a29fc6f490c16d2b1aca8e6460cf9 (patch) | |
tree | 94a7e5390a92e3a1f5c3c80b33af0f0ea926ce7b /tools/h5import | |
parent | 66a087c974bc7431a51344420dd74dab563f3eee (diff) | |
download | hdf5-07f28d80714a29fc6f490c16d2b1aca8e6460cf9.zip hdf5-07f28d80714a29fc6f490c16d2b1aca8e6460cf9.tar.gz hdf5-07f28d80714a29fc6f490c16d2b1aca8e6460cf9.tar.bz2 |
[svn-r21064] Purpose:
Work for HDFFV-7602 - HDF5 command tools: Provide framework for reusable
test files among tools
Description:
Merged from HDF5 trunk r21057
Provide framework to share test files among tools for tools test.
Tested:
jam (linux32-LE), koala (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE)
Diffstat (limited to 'tools/h5import')
-rwxr-xr-x | tools/h5import/h5importtestutil.sh | 141 |
1 files changed, 125 insertions, 16 deletions
diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh index d558eba..8a895f5 100755 --- a/tools/h5import/h5importtestutil.sh +++ b/tools/h5import/h5importtestutil.sh @@ -20,9 +20,111 @@ TESTNAME=h5import EXIT_SUCCESS=0 EXIT_FAILURE=1 +CP='cp' + # initialize errors variable nerrors=0 +# The build (current) directory might be different than the source directory. +if test -z "$srcdir"; then + srcdir=. +fi + +# source dirs +SRC_TOOLS="$srcdir/.." +SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" + +# testfiles source dirs for tools +SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES" +SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES" +SRC_H5DIFF_TESTFILES="$SRC_TOOLS/h5diff/testfiles" +SRC_H5COPY_TESTFILES="$SRC_TOOLS/h5copy/testfiles" +SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles" +SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles" +SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles" +SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles" + +TESTDIR=./testfiles +test -d $TESTDIR || mkdir $TESTDIR + +###################################################################### +# test files +# -------------------------------------------------------------------- +# All the test files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# Any test files from other tools can be used in this framework. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_HDF5_TEST_FILES=" +$SRC_H5IMPORT_TESTFILES/test1.h5 +$SRC_H5IMPORT_TESTFILES/test2.h5 +$SRC_H5IMPORT_TESTFILES/test3.h5 +$SRC_H5IMPORT_TESTFILES/test4.h5 +$SRC_H5IMPORT_TESTFILES/test5.h5 +$SRC_H5IMPORT_TESTFILES/test6.h5 +$SRC_H5IMPORT_TESTFILES/test7.h5 +$SRC_H5IMPORT_TESTFILES/test8.h5 +$SRC_H5IMPORT_TESTFILES/test9.h5 +$SRC_H5IMPORT_TESTFILES/test10.h5 +$SRC_H5IMPORT_TESTFILES/test11.h5 +$SRC_H5IMPORT_TESTFILES/test12.h5 +$SRC_H5IMPORT_TESTFILES/test13.h5 +$SRC_H5IMPORT_TESTFILES/test14.h5 +$SRC_H5IMPORT_TESTFILES/test15.h5 +" + +LIST_OTHER_TEST_FILES=" +$SRC_H5IMPORT_TESTFILES/binfp32.conf +$SRC_H5IMPORT_TESTFILES/binfp64.conf +$SRC_H5IMPORT_TESTFILES/binin8.conf +$SRC_H5IMPORT_TESTFILES/binin16.conf +$SRC_H5IMPORT_TESTFILES/binin32.conf +$SRC_H5IMPORT_TESTFILES/binuin16.conf +$SRC_H5IMPORT_TESTFILES/binuin32.conf +$SRC_H5IMPORT_TESTFILES/textfp32.conf +$SRC_H5IMPORT_TESTFILES/textfp64.conf +$SRC_H5IMPORT_TESTFILES/textin8.conf +$SRC_H5IMPORT_TESTFILES/textin16.conf +$SRC_H5IMPORT_TESTFILES/textin32.conf +$SRC_H5IMPORT_TESTFILES/textuin16.conf +$SRC_H5IMPORT_TESTFILES/textuin32.conf +$SRC_H5IMPORT_TESTFILES/textpfe.conf +$SRC_H5IMPORT_TESTFILES/textstr.conf +$SRC_H5IMPORT_TESTFILES/fp1.txt +$SRC_H5IMPORT_TESTFILES/fp2.txt +$SRC_H5IMPORT_TESTFILES/in1.txt +$SRC_H5IMPORT_TESTFILES/in16.txt +$SRC_H5IMPORT_TESTFILES/in32.txt +$SRC_H5IMPORT_TESTFILES/in64.txt +$SRC_H5IMPORT_TESTFILES/str.txt +" + +# +# 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_TO_TESTDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_TESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + if [ -a $tstfile ]; then + $CP -f $tstfile $TESTDIR + else + echo "Error: FAILED to copy $tstfile" + echo " $tstfile doesn't exist!" + exit $EXIT_FAILURE + fi + fi + done +} + TESTING() { SPACES=" " echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' @@ -58,55 +160,62 @@ if [ -f h5import -a -f h5importtest ]; then rm -f output.h5 log1 tx* b* *.dat +# prepare for test +COPY_TESTFILES_TO_TESTDIR + mkdir tmp_testfiles -cp $srcdir/testfiles/*.h5 tmp_testfiles/ +cp $TESTDIR/*.h5 tmp_testfiles/ $RUNSERIAL ./h5importtest +################################################ +### T H E T E S T S +################################################ + TESTING "ASCII I32 rank 3 - Output BE " ; -TOOLTEST $srcdir/testfiles/in32.txt -c $srcdir/testfiles/textin32.conf -o test1.h5 +TOOLTEST $TESTDIR/in32.txt -c $TESTDIR/textin32.conf -o test1.h5 TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended" -TOOLTEST $srcdir/testfiles/in16.txt -c $srcdir/testfiles/textin16.conf -o test2.h5 +TOOLTEST $TESTDIR/in16.txt -c $TESTDIR/textin16.conf -o test2.h5 TESTING "ASCII I8 - rank 3 - Output I8 LE-Chunked+Extended+Compressed " -TOOLTEST $srcdir/testfiles/in16.txt -c $srcdir/testfiles/textin8.conf -o test3.h5 +TOOLTEST $TESTDIR/in16.txt -c $TESTDIR/textin8.conf -o test3.h5 TESTING "ASCII UI32 - rank 3 - Output BE" -TOOLTEST $srcdir/testfiles/in1.txt -c $srcdir/testfiles/textuin32.conf -o test4.h5 +TOOLTEST $TESTDIR/in1.txt -c $TESTDIR/textuin32.conf -o test4.h5 TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed " -TOOLTEST $srcdir/testfiles/in1.txt -c $srcdir/testfiles/textuin16.conf -o test5.h5 +TOOLTEST $TESTDIR/in1.txt -c $TESTDIR/textuin16.conf -o test5.h5 TESTING "ASCII F32 - rank 3 - Output LE " -TOOLTEST $srcdir/testfiles/fp1.txt -c $srcdir/testfiles/textfp32.conf -o test6.h5 +TOOLTEST $TESTDIR/fp1.txt -c $TESTDIR/textfp32.conf -o test6.h5 TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed " -TOOLTEST $srcdir/testfiles/fp2.txt -c $srcdir/testfiles/textfp64.conf -o test7.h5 +TOOLTEST $TESTDIR/fp2.txt -c $TESTDIR/textfp64.conf -o test7.h5 TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " -TOOLTEST binfp64.bin -c $srcdir/testfiles/binfp64.conf -o test8.h5 +TOOLTEST binfp64.bin -c $TESTDIR/binfp64.conf -o test8.h5 TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " -TOOLTEST binin16.bin -c $srcdir/testfiles/binin16.conf -o test9.h5 +TOOLTEST binin16.bin -c $TESTDIR/binin16.conf -o test9.h5 TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " -TOOLTEST binin8.bin -c $srcdir/testfiles/binin8.conf -o test10.h5 +TOOLTEST binin8.bin -c $TESTDIR/binin8.conf -o test10.h5 TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED " -TOOLTEST binin32.bin -c $srcdir/testfiles/binin32.conf -o test11.h5 +TOOLTEST binin32.bin -c $TESTDIR/binin32.conf -o test11.h5 TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED " -TOOLTEST binuin16.bin -c $srcdir/testfiles/binuin16.conf -o test12.h5 +TOOLTEST binuin16.bin -c $TESTDIR/binuin16.conf -o test12.h5 TESTING "BINARY UI32 - rank 3 - Output LE + CHUNKED " -TOOLTEST binuin32.bin -c $srcdir/testfiles/binuin32.conf -o test13.h5 +TOOLTEST binuin32.bin -c $TESTDIR/binuin32.conf -o test13.h5 TESTING "STR" -TOOLTEST $srcdir/testfiles/str.txt -c $srcdir/testfiles/textstr.conf -o test14.h5 +TOOLTEST $TESTDIR/str.txt -c $TESTDIR/textstr.conf -o test14.h5 TESTING "ASCII F64 - rank 1 - INPUT-CLASS TEXTFPE " -TOOLTEST $srcdir/testfiles/in64.txt -c $srcdir/testfiles/textpfe.conf -o test15.h5 +TOOLTEST $TESTDIR/in64.txt -c $TESTDIR/textpfe.conf -o test15.h5 rm -f txtin32.txt txtin16.txt *.bin *.h5 rm -rf tmp_testfiles |