summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2015-09-16 17:04:51 +0200
committerAntonin Descampe <antonin@gmail.com>2015-09-16 17:04:51 +0200
commit93c79f8fb1a19c3f253081df7fc9b17604483e5a (patch)
treecb4eefdecd8e8c54d5a9039a38be268c27e7757d
parente755ebd1b004648dfb5c3e17e1223e12f3a87ad7 (diff)
modified checkmd5
-rw-r--r--tests/nonregression/checkmd5refs.cmake50
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/nonregression/checkmd5refs.cmake b/tests/nonregression/checkmd5refs.cmake
index 80de4ea9..40e019b7 100644
--- a/tests/nonregression/checkmd5refs.cmake
+++ b/tests/nonregression/checkmd5refs.cmake
@@ -16,40 +16,40 @@
# decoding process that the output would be bitwise different (while PSNR would
# be kept identical).
-#message("0: ${REFFILE}")
-#message("1: ${CMAKE_CURRENT_BINARY_DIR}")
-#message("2: ${FILENAME}")
-file(GLOB globfiles "Temporary/${FILENAME}*.pgx" )
-#message("6: ${globfiles}")
+# Another more conventional approach is to store the generated output from
+# openjpeg however storing the full generated output is generally useless since
+# we do not really care about the exact pixel value, we simply need to known
+# when a code change impact output generation. furthermore storing the
+# complete generated output file, tends to make the svn:/openjpeg-data really
+# big.
-# REFFILE follow what md5sum -c would expect as input:
+# 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)
+string(FIND ${OUTFILENAME_NAME} "." SHORTEST_EXT_POS REVERSE)
+string(SUBSTRING ${OUTFILENAME_NAME} 0 ${SHORTEST_EXT_POS} OUTFILENAME_NAME_WE)
+file(GLOB globfiles "Temporary/${OUTFILENAME_NAME_WE}*.pgx" "Temporary/${OUTFILENAME_NAME_WE}*.png" "Temporary/${OUTFILENAME_NAME_WE}*.tif")
+if(NOT globfiles)
+ message(SEND_ERROR "Could not find output PGX files: ${OUTFILENAME_NAME_WE}")
+endif()
+
+# REFFILE follow what `md5sum -c` would expect as input:
file(READ ${REFFILE} variable)
-#string(REGEX REPLACE "\r?\n" ";" variable "${variable}")
foreach(pgxfullpath ${globfiles})
+ file(MD5 ${pgxfullpath} output)
get_filename_component(pgxfile ${pgxfullpath} NAME)
- #message("8: ${pgxfile}")
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E md5sum ${pgxfile}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Temporary
- RESULT_VARIABLE res
- OUTPUT_VARIABLE output
- ERROR_VARIABLE error_output
- OUTPUT_STRIP_TRAILING_WHITESPACE # important
- )
- # Pass the output back to ctest
- if(res)
- message(SEND_ERROR "md5 could not be computed, it failed with value ${res}. Output was: ${error_output}")
- endif()
- #message("3: ${output}")
-
- #message("4: ${variable}")
string(REGEX MATCH "[0-9a-f]+ ${pgxfile}" output_var "${variable}")
- #message("5: ${output_var}")
+
+ set(output "${output} ${pgxfile}")
if("${output_var}" STREQUAL "${output}")
- #message("6: eqal")
+ message(STATUS "equal: [${output_var}] vs [${output}]")
else()
message(SEND_ERROR "not equal: [${output_var}] vs [${output}]")
endif()