[1.5] Import md5 checker from trunk back onto 1.5 branch
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Tue, 25 Feb 2014 14:28:30 +0000 (14:28 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Tue, 25 Feb 2014 14:28:30 +0000 (14:28 +0000)
tests/nonregression/CMakeLists.txt
tests/nonregression/checkmd5refs.cmake [new file with mode: 0644]
tests/nonregression/md5refs.txt [new file with mode: 0644]
tests/nonregression/test_suite.ctest.in

index 84b5393a7059de39b932ffd177197835374e5ae2..41cb9876958c1c400087073f517cd931bce35d7c 100644 (file)
@@ -237,7 +237,12 @@ FOREACH(OPJ_TEST_CMD_LINE ${OPJ_TEST_CMD_LINE_LIST})
         SET_TESTS_PROPERTIES(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode PROPERTIES WILL_FAIL TRUE)
      
       ELSE(FAILED_TEST_FOUND)
-  
+        # if not failed, check against registered md5:
+        add_test(NAME NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode-md5 COMMAND ${CMAKE_COMMAND}
+          -DREFFILE:STRING=${CMAKE_CURRENT_SOURCE_DIR}/md5refs.txt
+          -DFILENAME:STRING=${INPUT_FILENAME_NAME}
+          -P ${CMAKE_CURRENT_SOURCE_DIR}/checkmd5refs.cmake)
+
 # FIXME: add a compare2base function base on raw which 
 # can output png diff files if necesary 
 #  ADD_TEST(NR-${filename}-compare2base
diff --git a/tests/nonregression/checkmd5refs.cmake b/tests/nonregression/checkmd5refs.cmake
new file mode 100644 (file)
index 0000000..80de4ea
--- /dev/null
@@ -0,0 +1,56 @@
+#  Copyright (c) 2014 Mathieu Malaterre <mathieu.malaterre@voxxl.com>
+#
+#  Redistribution and use is allowed according to the terms of the New
+#  BSD license.
+#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# check md5 refs
+#
+# This script will be used to make sure we never introduce a regression on any
+# of the nonregression file.
+#
+# The approach is relatively simple, we compute a md5sum for each of the decode
+# file. Anytime the md5sum is different from the reference one, we assume
+# something went wrong and simply fails.  of course if could happen during the
+# course of openjpeg development that the internals are changed that impact the
+# 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}")
+
+# REFFILE follow what md5sum -c would expect as input:
+file(READ ${REFFILE} variable)
+#string(REGEX REPLACE "\r?\n" ";" variable "${variable}")
+
+foreach(pgxfullpath ${globfiles})
+  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}")
+  
+  if("${output_var}" STREQUAL "${output}")
+    #message("6: eqal")
+  else()
+    message(SEND_ERROR "not equal: [${output_var}] vs [${output}]")
+  endif()
+endforeach()
diff --git a/tests/nonregression/md5refs.txt b/tests/nonregression/md5refs.txt
new file mode 100644 (file)
index 0000000..8d98c56
--- /dev/null
@@ -0,0 +1,84 @@
+6f22c9a9bd474202ac6cd3a066e15200  _00042.j2k_0.pgx
+a3a0606dfa0779d657c6a923b90e4678  _00042.j2k_1.pgx
+106954dc468dfe0884d02268e91f9f5b  _00042.j2k_2.pgx
+8889def55f1e18dae6002b9b3a6dd152  123.j2c_0.pgx
+4a0daf7a9065101379eaebc28e436b1e  Bretagne2.j2k_0.pgx
+07578fc7bf81d3da694de8ae27308b82  Bretagne2.j2k_1.pgx
+3690c42f83bad42f4abea48525d45e0e  Bretagne2.j2k_2.pgx
+8889def55f1e18dae6002b9b3a6dd152  bug.j2c_0.pgx
+22c8d33a956ba83079d1102457bc77a1  buxI.j2k_0.pgx
+b8f473c07ba5ebfc195bdd53c3b3b97f  buxR.j2k_0.pgx
+05c062aca83d13b8095460f38a690a08  Cannotreaddatawithnosizeknown.j2k_0.pgx
+6276da0ec5fac44d683d3468b290331d  cthead1.j2k_0.pgx
+8afcac9a696cc8d753b0eb9f4ae692ff  CT_Phillips_JPEG2K_Decompr_Problem.j2k_0.pgx
+04d35ab6160c9029549f72358df984da  file409752_0.pgx
+2813bd6fdc2c306b91b3da3688b8bf49  file409752_1.pgx
+e273e2aaea4a4fc1b2cf7c09c53c3cc6  file409752_2.pgx
+05c062aca83d13b8095460f38a690a08  illegalcolortransform.j2k_0.pgx
+cb28787aa7c223f03e6acad71e244108  issue104_jpxstream.jp2_0.pgx
+cb28787aa7c223f03e6acad71e244108  issue104_jpxstream.jp2_1.pgx
+cb28787aa7c223f03e6acad71e244108  issue104_jpxstream.jp2_2.pgx
+adda4f5e46845b96dd3df14a76aa7229  issue188_beach_64bitsbox.jp2_0.pgx
+90a9709c166019d1e101e7b96d257ed9  issue188_beach_64bitsbox.jp2_1.pgx
+37e23d2df06ee60bf0f9f5e1c16054d8  issue188_beach_64bitsbox.jp2_2.pgx
+cb89739232898a823355861d834b5734  issue205.jp2_0.pgx
+a09d34928fd86e6f2d7e6edc1764d2b7  issue205.jp2_1.pgx
+6f712d0685f2c5522f01b238365f4284  issue205.jp2_2.pgx
+de992d54d59032eb07d21983dbe8155b  issue205.jp2_3.pgx
+8fae7a39e459409f64e4529d2214087a  issue206_image-000.jp2_0.pgx
+555a504a93c9a14f61c894da3b393e87  issue206_image-000.jp2_1.pgx
+5f06b7c45446ae20c22cada46478a9dc  issue206_image-000.jp2_2.pgx
+e1807db57b5f5192c4b77b83e8b5c477  issue228.j2k_0.pgx
+4093cc34d838780b35a8be410247fa7f  j2k32.j2k_0.pgx
+ce4e556aaa0844b92a92c35c200fc43e  j2k32.j2k_1.pgx
+ea926520f990640862f3fe6616097613  j2k32.j2k_2.pgx
+66b60e866991e03f9a2de18e80d3102b  kakadu_v4-4_openjpegv2_broken.j2k_0.pgx
+12a8a4668315d9ae27969991251ce85f  kodak_2layers_lrcp.j2c_0.pgx
+56d0b0c547d6d5bb12f0c36e88722b11  kodak_2layers_lrcp.j2c_1.pgx
+48ba092fb40090c160bbd08bdf7bdbf2  kodak_2layers_lrcp.j2c_2.pgx
+05c062aca83d13b8095460f38a690a08  MarkerIsNotCompliant.j2k_0.pgx
+ff73d2bd32951d9e55b02186aac24aff  Marrin.jp2_0.pgx
+55ce884dd2346af6a5172a434ee578fa  Marrin.jp2_1.pgx
+29131264861b4ee21011149b27e4d488  mem-b2ace68c-1381.jp2_0.pgx
+29131264861b4ee21011149b27e4d488  mem-b2ace68c-1381.jp2_1.pgx
+29131264861b4ee21011149b27e4d488  mem-b2ace68c-1381.jp2_2.pgx
+df568fe0529219cc2c8f215e236f4b3d  mem-b2ace68c-1381.jp2_3.pgx
+41ec1a0228c703b10f95388c1160753b  mem-b2b86b74-2753.jp2_0.pgx
+41ec1a0228c703b10f95388c1160753b  mem-b2b86b74-2753.jp2_1.pgx
+41ec1a0228c703b10f95388c1160753b  mem-b2b86b74-2753.jp2_2.pgx
+97557ab9e38a7aff621e583fbb66b099  merged.jp2_0.pgx
+386fbdcd294429733e3272d62ed5a15a  merged.jp2_1.pgx
+d3907bbd67be1dae31b4377fa4dc0373  merged.jp2_2.pgx
+de8bba9ac366eeb2f170f0cf3605cf12  movie_00000.j2k_0.pgx
+334bac3285f7138e9dd29d59bdcb22ff  movie_00000.j2k_1.pgx
+5511d2c96d1d1f2062491e00d5234506  movie_00000.j2k_2.pgx
+de8bba9ac366eeb2f170f0cf3605cf12  movie_00001.j2k_0.pgx
+334bac3285f7138e9dd29d59bdcb22ff  movie_00001.j2k_1.pgx
+5511d2c96d1d1f2062491e00d5234506  movie_00001.j2k_2.pgx
+de8bba9ac366eeb2f170f0cf3605cf12  movie_00002.j2k_0.pgx
+334bac3285f7138e9dd29d59bdcb22ff  movie_00002.j2k_1.pgx
+5511d2c96d1d1f2062491e00d5234506  movie_00002.j2k_2.pgx
+951a55623a92e97a064a350f11c2637d  orb-blue10-lin-j2k.j2k_0.pgx
+5033aaf699dfa3dfe041af33c9ad688d  orb-blue10-lin-j2k.j2k_1.pgx
+dbe33d72484caedf9c2cc18fd670884c  orb-blue10-lin-j2k.j2k_2.pgx
+0fec67d9546171699958c6682e725b79  orb-blue10-lin-j2k.j2k_3.pgx
+84462261381b6732ec4f2addb0070d24  orb-blue10-lin-jp2.jp2_0.pgx
+6129edf57e5db2344fcde5ce99ae8732  orb-blue10-lin-jp2.jp2_1.pgx
+fdad26b1e078aa32bd4b77a5f44da43c  orb-blue10-lin-jp2.jp2_2.pgx
+0fec67d9546171699958c6682e725b79  orb-blue10-lin-jp2.jp2_3.pgx
+671feee525e2485060536edbf21380f1  orb-blue10-win-j2k.j2k_0.pgx
+912cdee24dd360b7999f7ee4a51083b4  orb-blue10-win-j2k.j2k_1.pgx
+64833b4b7557936b9233087e92f8ae28  orb-blue10-win-j2k.j2k_2.pgx
+789a299a1523b2d9d3f561d12a2da817  orb-blue10-win-j2k.j2k_3.pgx
+671feee525e2485060536edbf21380f1  orb-blue10-win-jp2.jp2_0.pgx
+7442756e83571c0e87493e03f12b2d34  orb-blue10-win-jp2.jp2_1.pgx
+5f99ff2aeb17e167fe7049bcf339d0b3  orb-blue10-win-jp2.jp2_2.pgx
+fe028d56d6c7aaee87239a115093412a  orb-blue10-win-jp2.jp2_3.pgx
+371aa0a7ff40a73b45f1fa41e210d1db  pacs.ge.j2k_0.pgx
+6ae110e1fb5a869af3dbc5fbc735b0bd  relax.jp2_0.pgx
+518a8f28dacc034982507f43763b88dd  relax.jp2_1.pgx
+c678b04f4d3e59b9d66a8bce37c553c0  relax.jp2_2.pgx
+cdb1d69eb48ffd8545751326b86d9d7e  test_lossless.j2k_0.pgx
+a37e7e5811d7c0c7adb61582790ccd33  text_GBR.jp2_0.pgx
+fc2173be54954a146b4e2887ee14be06  text_GBR.jp2_1.pgx
+14108b4fb8d9126750db0424417ed17d  text_GBR.jp2_2.pgx
index e98cb428e91b9cb0a30bd6d8531d3abd7a5604ec..661bc611bbeff6ff401cb50d664729a5034aad9e 100644 (file)
@@ -65,3 +65,4 @@ j2k_to_image -i  @INPUT_NR_PATH@/test_lossless.j2k -o @TEMP_PATH@/test_lossless.
 j2k_to_image -i  @INPUT_NR_PATH@/text_GBR.jp2 -o @TEMP_PATH@/text_GBR.jp2.pgx
 j2k_to_image -i  @INPUT_NR_PATH@/issue104_jpxstream.jp2 -o @TEMP_PATH@/issue104_jpxstream.jp2.pgx
 j2k_to_image -i  @INPUT_NR_PATH@/file409752.jp2 -o @TEMP_PATH@/file409752.jp2.pgx
+j2k_to_image -i  @INPUT_NR_PATH@/issue205.jp2 -o @TEMP_PATH@/issue205.jp2.pgx