diff options
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | tools/misc/CMakeLists.txt | 30 | ||||
-rw-r--r-- | tools/misc/testfiles/h5mkgrp_help.txt | 7 | ||||
-rw-r--r-- | tools/misc/testfiles/h5mkgrp_version.txt.in | 1 | ||||
-rw-r--r-- | tools/misc/testh5mkgrp.sh | 43 |
6 files changed, 80 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b34024..b1808e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,7 +165,8 @@ SET (HDF5_PACKAGE_NAME "HDF5") SET (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}") SET (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}") SET (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}") -SET (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION}") +SET (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") +SET (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION_STRING}") SET (HDF5_PACKAGE_TARNAME "hdf5") SET (HDF5_PACKAGE_URL "http://www.hdfgroup.org") SET (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org") @@ -1113,6 +1113,8 @@ ./tools/misc/testh5mkgrp.sh ./tools/misc/testh5repart.sh.in ./tools/misc/talign.c +./tools/misc/testfiles/h5mkgrp_help.txt +./tools/misc/testfiles/h5mkgrp_version.txt.in # h5stat sources ./tools/h5stat/Makefile.am diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt index 77962ec..2d8ccc8 100644 --- a/tools/misc/CMakeLists.txt +++ b/tools/misc/CMakeLists.txt @@ -91,8 +91,8 @@ IF (BUILD_TESTING) ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) SET (HDF5_MKGRP_TEST_FILES - h5mkgrp_help - h5mkgrp_version + #h5mkgrp_help + #h5mkgrp_version h5mkgrp_single h5mkgrp_single_latest h5mkgrp_several @@ -115,6 +115,14 @@ IF (BUILD_TESTING) ) ENDFOREACH (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) + ADD_CUSTOM_COMMAND ( + TARGET h5mkgrp + POST_BUILD + COMMAND ${XLATE_UTILITY} + ARGS ${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_help.txt ${PROJECT_BINARY_DIR}/h5mkgrp_help.txt -l0 + ) + CONFIGURE_FILE (${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_version.txt.in ${PROJECT_BINARY_DIR}/h5mkgrp_version.txt @ONLY) + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -155,6 +163,20 @@ IF (BUILD_TESTING) ) ENDMACRO (ADD_H5_TEST resultfile resultcode resultoption) + MACRO (ADD_H5_CMP resultfile resultcode) + ADD_TEST ( + NAME H5MKGRP-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5mkgrp>" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.txt" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + ENDMACRO (ADD_H5_CMP resultfile resultcode) + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -202,8 +224,8 @@ IF (BUILD_TESTING) ) # Check that help & version is displayed properly - ADD_H5_TEST (h5mkgrp_help 1 "-h") - ADD_H5_TEST (h5mkgrp_version 1 "-V") + ADD_H5_CMP (h5mkgrp_help 0 "-h") + ADD_H5_CMP (h5mkgrp_version 0 "-V") # Create single group at root level ADD_H5_TEST (h5mkgrp_single 0 " " single) diff --git a/tools/misc/testfiles/h5mkgrp_help.txt b/tools/misc/testfiles/h5mkgrp_help.txt new file mode 100644 index 0000000..ba130f6 --- /dev/null +++ b/tools/misc/testfiles/h5mkgrp_help.txt @@ -0,0 +1,7 @@ +usage: h5mkgrp [OPTIONS] FILE GROUP... + OPTIONS + -h, --help Print a usage message and exit + -l, --latest Use latest version of file format to create groups + -p, --parents No error if existing, make parent groups as needed + -v, --verbose Print information about OBJECTS and OPTIONS + -V, --version Print version number and exit diff --git a/tools/misc/testfiles/h5mkgrp_version.txt.in b/tools/misc/testfiles/h5mkgrp_version.txt.in new file mode 100644 index 0000000..75c13a5 --- /dev/null +++ b/tools/misc/testfiles/h5mkgrp_version.txt.in @@ -0,0 +1 @@ +h5mkgrp: Version @HDF5_PACKAGE_VERSION_STRING@ diff --git a/tools/misc/testh5mkgrp.sh b/tools/misc/testh5mkgrp.sh index e6cb96e..7b8dc05 100644 --- a/tools/misc/testh5mkgrp.sh +++ b/tools/misc/testh5mkgrp.sh @@ -158,12 +158,53 @@ echo "FILEOUT=" $FILEOUT fi } +# Single run of tool +# +# Assumed arguments: +# $1 is test expected output file +# $2 is h5mkgrp options +# $* are groups to create +CMPTEST() +{ + FILEOUT=$OUTDIR/$1 + expect="$srcdir/testfiles/`basename $1 .h5`.txt" + actual="./testfiles/`basename $1 .h5`.out" + actual_err="./testfiles/`basename $1 .h5`.err" + shift + + # Stderr is included in stdout so that the diff can detect + # any unexpected output from that stream too. + TESTING $H5MKGRP $@ + ( + $RUNSERIAL $H5MKGRP_BIN $@ + ) >$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 + 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 + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi +} + ############################################################################## ### T H E T E S T S ### ############################################################################## # Check that help & version is displayed properly -RUNTEST h5mkgrp_help.h5 "-h" +CMPTEST h5mkgrp_help.h5 "-h" RUNTEST h5mkgrp_version.h5 "-V" # Create single group at root level |