diff options
Diffstat (limited to 'tools/misc')
-rw-r--r-- | tools/misc/CMakeLists.txt | 57 | ||||
-rw-r--r-- | tools/misc/Makefile.in | 3 | ||||
-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 |
5 files changed, 96 insertions, 15 deletions
diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt index 77962ec..6694458 100644 --- a/tools/misc/CMakeLists.txt +++ b/tools/misc/CMakeLists.txt @@ -12,18 +12,15 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- #-- Misc Executables ADD_EXECUTABLE (h5debug ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5debug.c) -H5_NAMING (h5debug) -TARGET_WIN_PROPERTIES (h5debug) +H5_NAMING (h5debug ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5debug ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) ADD_EXECUTABLE (h5repart ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart.c) -H5_NAMING (h5repart) -TARGET_WIN_PROPERTIES (h5repart) +H5_NAMING (h5repart ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5repart ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) ADD_EXECUTABLE (h5mkgrp ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5mkgrp.c) -H5_NAMING (h5mkgrp) -TARGET_WIN_PROPERTIES (h5mkgrp) +H5_NAMING (h5mkgrp ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5mkgrp ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES @@ -44,15 +41,13 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5repart_gentest ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart_gentest.c) - H5_NAMING (h5repart_gentest) - TARGET_WIN_PROPERTIES (h5repart_gentest) + H5_NAMING (h5repart_gentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>) ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c) - H5_NAMING (h5repart_test) - TARGET_WIN_PROPERTIES (h5repart_test) + H5_NAMING (h5repart_test ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) # -------------------------------------------------------------------- @@ -91,8 +86,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 +110,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 ### @@ -141,6 +144,7 @@ IF (BUILD_TESTING) COMMAND $<TARGET_FILE:h5mkgrp> ${PROJECT_BINARY_DIR}/../testfiles/${resultfile}.h5 ${ARGN} ) ENDIF (NOT ${resultoption} STREQUAL " ") + SET_TESTS_PROPERTIES (H5MKGRP-${resultfile}${resultoption} PROPERTIES DEPENDS H5MKGRP-clear-${resultfile}${resultoption}) ADD_TEST ( NAME H5MKGRP-H5LS-${resultfile}${resultoption} COMMAND "${CMAKE_COMMAND}" @@ -153,8 +157,23 @@ IF (BUILD_TESTING) -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) + SET_TESTS_PROPERTIES (H5MKGRP-H5LS-${resultfile}${resultoption} PROPERTIES DEPENDS H5MKGRP-${resultfile}${resultoption}) 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 ### @@ -170,6 +189,7 @@ IF (BUILD_TESTING) ) # repartition family member size to 20,000 bytes. ADD_TEST (NAME h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5) + SET_TESTS_PROPERTIES (h5repart_20K PROPERTIES DEPENDS h5repart_20K-clear-objects) # Remove any output file left over from previous test run ADD_TEST ( @@ -183,6 +203,7 @@ IF (BUILD_TESTING) ) # repartition family member size to 5 KB. ADD_TEST (NAME h5repart_5K COMMAND $<TARGET_FILE:h5repart> -m 5k family_file%05d.h5 scd_family%05d.h5) + SET_TESTS_PROPERTIES (h5repart_5K PROPERTIES DEPENDS h5repart_5K-clear-objects) # Remove any output file left over from previous test run ADD_TEST ( @@ -193,17 +214,25 @@ IF (BUILD_TESTING) ) # convert family file to sec2 file of 20,000 bytes ADD_TEST (NAME h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) + SET_TESTS_PROPERTIES (h5repart_sec2 PROPERTIES DEPENDS h5repart_sec2-clear-objects) # test the output files repartitioned above. ADD_TEST (NAME h5repart_test COMMAND $<TARGET_FILE:h5repart_test>) + SET_TESTS_PROPERTIES (h5repart_test PROPERTIES DEPENDS h5repart_sec2 h5repart_5K h5repart_20K) SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5repart_test ) + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5MKGRP-help COMMAND h5mkgrp -h) + ADD_TEST (NAME H5MKGRP-version COMMAND h5mkgrp -V) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + # 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/Makefile.in b/tools/misc/Makefile.in index b33d14d..cb770a1 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -194,6 +194,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -255,6 +256,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -311,6 +313,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 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..46264c2 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="$OUTDIR/`basename $1 .h5`.out" + actual_err="$OUTDIR/`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 |