From c55e164e87fcdc2a974474863d7c550f0218598f Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Mon, 24 Feb 2014 16:55:13 +0000 Subject: [PATCH] [trunk] Make sure to always output pgx file. Handle case where multiple pgx files are generated. Fixes all tests. --- tests/nonregression/checkmd5refs.cmake | 56 ++++++++++------- tests/nonregression/md5refs.txt | 83 +++++++++++++++++++++++++ tests/nonregression/test_suite.ctest.in | 8 +-- 3 files changed, 119 insertions(+), 28 deletions(-) diff --git a/tests/nonregression/checkmd5refs.cmake b/tests/nonregression/checkmd5refs.cmake index fd583e2a..80de4ea9 100644 --- a/tests/nonregression/checkmd5refs.cmake +++ b/tests/nonregression/checkmd5refs.cmake @@ -19,30 +19,38 @@ #message("0: ${REFFILE}") #message("1: ${CMAKE_CURRENT_BINARY_DIR}") #message("2: ${FILENAME}") -execute_process( - COMMAND ${CMAKE_COMMAND} -E md5sum ${FILENAME}.png - 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}") +file(GLOB globfiles "Temporary/${FILENAME}*.pgx" ) +#message("6: ${globfiles}") +# REFFILE follow what md5sum -c would expect as input: file(READ ${REFFILE} variable) -#message("4: ${variable}") -string(REGEX MATCH "^.*${FILENAME}.png" output_var ${variable}) +#string(REGEX REPLACE "\r?\n" ";" variable "${variable}") -#message("5: ${output_var}") - -if("${output_var}" STREQUAL "${output}") - #message("6: eqal") -else() - message(SEND_ERROR "not equal: [${output_var}] vs [${output}]") -endif() +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 index e69de29b..94cec750 100644 --- a/tests/nonregression/md5refs.txt +++ b/tests/nonregression/md5refs.txt @@ -0,0 +1,83 @@ +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 +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 diff --git a/tests/nonregression/test_suite.ctest.in b/tests/nonregression/test_suite.ctest.in index d551cbb0..aa60876d 100644 --- a/tests/nonregression/test_suite.ctest.in +++ b/tests/nonregression/test_suite.ctest.in @@ -92,13 +92,13 @@ opj_decompress -i @INPUT_NR_PATH@/mem-b2b86b74-2753.jp2 -o @TEMP_PATH@/mem-b2b8 # issue 194 raised by the gdal fuzzer test (should nicely failed) ! opj_decompress -i @INPUT_NR_PATH@/gdal_fuzzer_check_comp_dx_dy.jp2 -o @TEMP_PATH@/gdal_fuzzer_check_comp_dx_dy.pgx # issue 202 -opj_decompress -i @INPUT_NR_PATH@/file409752.jp2 -o @TEMP_PATH@/file409752.png +opj_decompress -i @INPUT_NR_PATH@/file409752.jp2 -o @TEMP_PATH@/file409752.pgx # issue 188 -opj_decompress -i @INPUT_NR_PATH@/issue188_beach_64bitsbox.jp2 -o @TEMP_PATH@/issue188_beach_64bitsbox.jp2.tif +opj_decompress -i @INPUT_NR_PATH@/issue188_beach_64bitsbox.jp2 -o @TEMP_PATH@/issue188_beach_64bitsbox.jp2.pgx # issue 206 -opj_decompress -i @INPUT_NR_PATH@/issue206_image-000.jp2 -o @TEMP_PATH@/issue206_image-000.jp2.png +opj_decompress -i @INPUT_NR_PATH@/issue206_image-000.jp2 -o @TEMP_PATH@/issue206_image-000.jp2.pgx # issue 205 -opj_decompress -i @INPUT_NR_PATH@/issue205.jp2 -o @TEMP_PATH@/issue205.jp2.png +opj_decompress -i @INPUT_NR_PATH@/issue205.jp2 -o @TEMP_PATH@/issue205.jp2.pgx # decode with specific area # prec=12; nb_c=1