[trunk] Add documentation to the checkmd5refs cmake module (used for regression testing)

This commit is contained in:
Mathieu Malaterre 2014-03-13 12:37:36 +00:00
parent 5624e4a25f
commit 68398b2a5a
2 changed files with 15 additions and 16 deletions

View File

@ -319,7 +319,6 @@ foreach(OPJ_TEST_CMD_LINE ${OPJ_TEST_CMD_LINE_LIST})
# if not failed, check against registered md5: # if not failed, check against registered md5:
add_test(NAME NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode-md5 COMMAND ${CMAKE_COMMAND} add_test(NAME NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode-md5 COMMAND ${CMAKE_COMMAND}
-DREFFILE:STRING=${CMAKE_CURRENT_SOURCE_DIR}/md5refs.txt -DREFFILE:STRING=${CMAKE_CURRENT_SOURCE_DIR}/md5refs.txt
-DFILENAME:STRING=${INPUT_FILENAME_NAME}
-DOUTFILENAME:STRING=${OUTPUT_FILENAME} -DOUTFILENAME:STRING=${OUTPUT_FILENAME}
-P ${CMAKE_CURRENT_SOURCE_DIR}/checkmd5refs.cmake) -P ${CMAKE_CURRENT_SOURCE_DIR}/checkmd5refs.cmake)

View File

@ -16,29 +16,32 @@
# decoding process that the output would be bitwise different (while PSNR would # decoding process that the output would be bitwise different (while PSNR would
# be kept identical). # be kept identical).
#message("0: ${REFFILE}") # Another more conventional approach is to store the generated output from
#message("1: ${CMAKE_CURRENT_BINARY_DIR}") # openjpeg however storing the full generated output is generally useless since
#message("2: ${FILENAME}") # we do not really care about the exact pixel value, we simply need to known
#get_filename_component(pgxfile ${pgxfullpath} NAME) # when a code change impact output generation. furthermore storing the
# complete generated output file, tends to make the svn:/openjpeg-data really
# big.
# This script expect two inputs
# REFFILE: Path to the md5sum.txt file
# OUTFILENAME: The name of the generated file we want to check The script will
# check whether a PGX or a PNG file was generated in the test suite (computed
# from OUTFILENAME)
get_filename_component(OUTFILENAME_NAME ${OUTFILENAME} NAME) get_filename_component(OUTFILENAME_NAME ${OUTFILENAME} NAME)
string(FIND ${OUTFILENAME_NAME} "." SHORTEST_EXT_POS REVERSE) string(FIND ${OUTFILENAME_NAME} "." SHORTEST_EXT_POS REVERSE)
string(SUBSTRING ${OUTFILENAME_NAME} 0 ${SHORTEST_EXT_POS} OUTFILENAME_NAME_WE) string(SUBSTRING ${OUTFILENAME_NAME} 0 ${SHORTEST_EXT_POS} OUTFILENAME_NAME_WE)
#message("3: ${OUTFILENAME_NAME}")
#message("4: ${OUTFILENAME_NAME_WE}")
#file(GLOB globfiles "Temporary/${FILENAME}*.pgx" "Temporary/${FILENAME}*.png")
file(GLOB globfiles "Temporary/${OUTFILENAME_NAME_WE}*.pgx" "Temporary/${OUTFILENAME_NAME_WE}*.png") file(GLOB globfiles "Temporary/${OUTFILENAME_NAME_WE}*.pgx" "Temporary/${OUTFILENAME_NAME_WE}*.png")
#message("6: ${globfiles}")
if(NOT globfiles) if(NOT globfiles)
message(SEND_ERROR "Could not find output PGX files: ${OUTFILENAME_NAME_WE}") message(SEND_ERROR "Could not find output PGX files: ${OUTFILENAME_NAME_WE}")
endif() endif()
# REFFILE follow what md5sum -c would expect as input: # REFFILE follow what `md5sum -c` would expect as input:
file(READ ${REFFILE} variable) file(READ ${REFFILE} variable)
#string(REGEX REPLACE "\r?\n" ";" variable "${variable}")
foreach(pgxfullpath ${globfiles}) foreach(pgxfullpath ${globfiles})
get_filename_component(pgxfile ${pgxfullpath} NAME) get_filename_component(pgxfile ${pgxfullpath} NAME)
#message("8: ${pgxfile}")
execute_process( execute_process(
COMMAND ${CMAKE_COMMAND} -E md5sum ${pgxfile} COMMAND ${CMAKE_COMMAND} -E md5sum ${pgxfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Temporary WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Temporary
@ -52,14 +55,11 @@ foreach(pgxfullpath ${globfiles})
if(res) if(res)
message(SEND_ERROR "md5 could not be computed, it failed with value ${res}. Output was: ${error_output}") message(SEND_ERROR "md5 could not be computed, it failed with value ${res}. Output was: ${error_output}")
endif() endif()
#message("3: ${output}")
#message("4: ${variable}")
string(REGEX MATCH "[0-9a-f]+ ${pgxfile}" output_var "${variable}") string(REGEX MATCH "[0-9a-f]+ ${pgxfile}" output_var "${variable}")
#message("5: ${output_var}")
if("${output_var}" STREQUAL "${output}") if("${output_var}" STREQUAL "${output}")
#message("6: eqal") message(STATUS "equal: [${output_var}] vs [${output}]")
else() else()
message(SEND_ERROR "not equal: [${output_var}] vs [${output}]") message(SEND_ERROR "not equal: [${output_var}] vs [${output}]")
endif() endif()