2011-07-27 14:45:04 +02:00
|
|
|
# NON-REGRESSION TESTS ON THIS DATASET LOCATED ${OPJ_DATA_ROOT}/input/nonregression
|
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Temporary)
|
2011-07-27 14:45:04 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set(TEMP ${CMAKE_CURRENT_BINARY_DIR}/Temporary)
|
|
|
|
set(BASELINE_NR ${OPJ_DATA_ROOT}/baseline/nonregression)
|
|
|
|
set(INPUT_NR ${OPJ_DATA_ROOT}/input/nonregression)
|
2011-07-27 14:45:04 +02:00
|
|
|
|
2011-10-20 17:10:59 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set(INPUT_NR_PATH ${INPUT_NR})
|
|
|
|
set(TEMP_PATH ${TEMP})
|
|
|
|
set(INPUT_CONF_PATH ${OPJ_DATA_ROOT}/input/conformance)
|
2011-08-30 18:07:43 +02:00
|
|
|
|
2011-12-02 16:30:19 +01:00
|
|
|
# need kdu_expand if possible
|
|
|
|
find_package(KAKADU)
|
2011-10-20 17:10:59 +02:00
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
#########################################################################
|
2011-10-20 17:10:59 +02:00
|
|
|
# GENERATION OF THE TEST SUITE (DUMP)
|
|
|
|
# Dump all files with the selected extension inside the input directory
|
|
|
|
|
2014-02-26 11:48:06 +01:00
|
|
|
# technically opj_dump should simply parse these one, since syntax is ok.
|
|
|
|
set(BLACKLIST_JPEG2000_TMP
|
|
|
|
2539.pdf.SIGFPE.706.1712.jp2
|
|
|
|
0290cb77c5df21828fa74cf2ab2c84d8.SIGFPE.d25.31.jp2
|
|
|
|
26ccf3651020967f7778238ef5af08af.SIGFPE.d25.527.jp2
|
2014-02-28 16:14:53 +01:00
|
|
|
4035.pdf.SIGSEGV.d8b.3375.jp2
|
2014-03-03 11:38:41 +01:00
|
|
|
3635.pdf.asan.77.2930.jp2
|
2014-03-14 16:01:13 +01:00
|
|
|
issue165.jp2
|
2014-03-18 11:21:11 +01:00
|
|
|
#edf_c2_1103421.jp2
|
|
|
|
edf_c2_1178956.jp2
|
|
|
|
edf_c2_1000290.jp2
|
|
|
|
#edf_c2_1000691.jp2 # ok
|
|
|
|
#edf_c2_20.jp2 #looks ok as per kdu_jp2info
|
|
|
|
edf_c2_1377017.jp2
|
|
|
|
edf_c2_1002767.jp2
|
|
|
|
#edf_c2_10025.jp2
|
|
|
|
edf_c2_1000234.jp2
|
|
|
|
edf_c2_225881.jp2
|
|
|
|
edf_c2_1000671.jp2
|
|
|
|
#edf_c2_1013627.jp2 # weird box, but kdu_jp2info ok
|
|
|
|
edf_c2_1015644.jp2
|
|
|
|
edf_c2_101463.jp2
|
|
|
|
edf_c2_1674177.jp2
|
|
|
|
edf_c2_1673169.jp2
|
2014-11-21 00:47:09 +01:00
|
|
|
issue429.jp2
|
2014-12-18 23:19:52 +01:00
|
|
|
issue427-null-image-size.jp2
|
2014-12-18 23:56:38 +01:00
|
|
|
issue427-illegal-tile-offset.jp2
|
2014-02-26 11:48:06 +01:00
|
|
|
)
|
|
|
|
|
2011-10-20 17:10:59 +02:00
|
|
|
# Define a list of file which should be gracefully rejected:
|
2012-08-30 19:20:03 +02:00
|
|
|
set(BLACKLIST_JPEG2000
|
2014-02-26 11:48:06 +01:00
|
|
|
${BLACKLIST_JPEG2000_TMP}
|
2014-12-20 16:08:55 +01:00
|
|
|
broken1.jp2
|
2012-11-12 17:32:28 +01:00
|
|
|
broken2.jp2
|
|
|
|
broken3.jp2
|
|
|
|
broken4.jp2
|
2012-11-27 10:24:24 +01:00
|
|
|
gdal_fuzzer_assert_in_opj_j2k_read_SQcd_SQcc.patch.jp2
|
|
|
|
gdal_fuzzer_check_comp_dx_dy.jp2
|
|
|
|
gdal_fuzzer_check_number_of_tiles.jp2
|
|
|
|
gdal_fuzzer_unchecked_numresolutions.jp2
|
2014-02-26 10:57:38 +01:00
|
|
|
mem-b2ace68c-1381.jp2
|
2014-02-26 11:48:06 +01:00
|
|
|
1851.pdf.SIGSEGV.ce9.948.jp2
|
2014-10-22 12:30:35 +02:00
|
|
|
1888.pdf.asan.35.988.jp2
|
2014-10-23 00:38:55 +02:00
|
|
|
issue362-2863.jp2 #kdu_jp2info ok
|
|
|
|
issue362-2866.jp2
|
|
|
|
issue362-2894.jp2
|
|
|
|
issue400.jp2 #kdu_jp2info ok
|
2014-11-17 23:02:38 +01:00
|
|
|
issue364-38.jp2
|
|
|
|
issue364-903.jp2 #kdu_jp2info ok
|
|
|
|
issue393.jp2 #kdu_jp2info ok
|
|
|
|
issue408.jp2 #kdu_jp2info ok
|
|
|
|
issue420.jp2 #kdu_jp2info ok
|
2014-12-20 16:08:55 +01:00
|
|
|
27ac957758a35d00d6765a0c86350d9c.SIGFPE.d25.537.jpc #kdu_jp2info crash
|
|
|
|
3672da2f1f67bbecad27d7181b4e9d7c.SIGFPE.d25.805.jpc #kdu_jp2info crash
|
2015-05-19 22:13:37 +02:00
|
|
|
issue476.jp2 #kdu_jp2info ok
|
2015-05-19 23:24:44 +02:00
|
|
|
issue475.jp2 #kdu_jp2info ok
|
|
|
|
issue413.jp2 #kdu_jp2info ok
|
2011-10-20 17:10:59 +02:00
|
|
|
)
|
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
file(GLOB_RECURSE OPJ_DATA_NR_LIST
|
2011-10-20 17:10:59 +02:00
|
|
|
"${INPUT_NR}/*.j2k"
|
|
|
|
"${INPUT_NR}/*.j2c"
|
2014-01-22 19:44:11 +01:00
|
|
|
"${INPUT_NR}/*.jp2"
|
2014-03-14 16:51:53 +01:00
|
|
|
"${INPUT_NR}/*.jpc"
|
2011-10-20 17:10:59 +02:00
|
|
|
#"${INPUT_NR}/*.jpx"
|
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
foreach(INPUT_FILENAME ${OPJ_DATA_NR_LIST})
|
|
|
|
get_filename_component(INPUT_FILENAME_NAME ${INPUT_FILENAME} NAME)
|
2014-02-26 11:48:06 +01:00
|
|
|
#get_filename_component(INPUT_FILENAME_NAME_WE ${INPUT_FILENAME_NAME} NAME_WE)
|
|
|
|
# cannot use longest extension function, since some name contains multiples
|
|
|
|
# dots. Instead write out own shortest extension function:
|
|
|
|
string(FIND ${INPUT_FILENAME_NAME} "." SHORTEST_EXT_POS REVERSE)
|
|
|
|
string(SUBSTRING ${INPUT_FILENAME_NAME} 0 ${SHORTEST_EXT_POS} INPUT_FILENAME_NAME_WE)
|
2012-08-30 19:14:39 +02:00
|
|
|
string(REGEX MATCH ${INPUT_FILENAME_NAME} bad_jpeg2000 ${BLACKLIST_JPEG2000})
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2011-10-20 17:10:59 +02:00
|
|
|
# Dump the input image
|
2014-02-24 13:48:23 +01:00
|
|
|
add_test(NAME NR-${INPUT_FILENAME_NAME}-dump
|
|
|
|
COMMAND opj_dump
|
2011-10-20 17:10:59 +02:00
|
|
|
-i ${INPUT_FILENAME}
|
|
|
|
-o ${TEMP}/${INPUT_FILENAME_NAME}.txt
|
|
|
|
-v
|
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
if(bad_jpeg2000)
|
|
|
|
set_tests_properties(NR-${INPUT_FILENAME_NAME}-dump
|
2011-10-20 17:10:59 +02:00
|
|
|
PROPERTIES WILL_FAIL TRUE)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
else()
|
|
|
|
|
2011-10-20 17:10:59 +02:00
|
|
|
# Compare the dump output with the baseline
|
2014-02-24 13:48:23 +01:00
|
|
|
add_test(NAME NR-${INPUT_FILENAME_NAME}-compare_dump2base
|
|
|
|
COMMAND compare_dump_files
|
2012-08-30 19:20:03 +02:00
|
|
|
-b ${BASELINE_NR}/opj_v2_${INPUT_FILENAME_NAME_WE}.txt
|
2011-10-20 17:10:59 +02:00
|
|
|
-t ${TEMP}/${INPUT_FILENAME_NAME}.txt
|
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set_tests_properties(NR-${INPUT_FILENAME_NAME}-compare_dump2base
|
2011-10-20 17:10:59 +02:00
|
|
|
PROPERTIES DEPENDS
|
|
|
|
NR-${INPUT_FILENAME_NAME}-dump)
|
2012-08-30 19:20:03 +02:00
|
|
|
endif()
|
2011-10-20 17:10:59 +02:00
|
|
|
|
2012-08-30 19:20:03 +02:00
|
|
|
endforeach()
|
2011-10-20 17:10:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
#########################################################################
|
|
|
|
# GENERATION OF THE TEST SUITE (DECODE AND ENCODE)
|
2012-08-30 19:20:03 +02:00
|
|
|
# Read one and more input file(s) (located in ${OPJ_DATA_ROOT}/input/nonregression)
|
2011-10-07 16:20:15 +02:00
|
|
|
# to know which files processed and with which options.
|
|
|
|
|
|
|
|
# Configure the test suite file:
|
2012-08-30 19:14:39 +02:00
|
|
|
configure_file("test_suite.ctest.in"
|
2011-10-07 16:20:15 +02:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/test_suite.ctest"
|
|
|
|
@ONLY)
|
2011-08-30 18:07:43 +02:00
|
|
|
|
|
|
|
# Read the file into a list
|
2012-08-30 19:14:39 +02:00
|
|
|
file(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/test_suite.ctest OPJ_TEST_CMD_LINE_LIST)
|
2011-08-30 18:07:43 +02:00
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
# Try to find and configure and read another test suite file
|
2012-08-30 19:14:39 +02:00
|
|
|
file(GLOB TEST_SUITE_FILES *.ctest.in)
|
|
|
|
if (TEST_SUITE_FILES)
|
|
|
|
foreach(TEST_SUITE_FILE ${TEST_SUITE_FILES})
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
# Avoid to process the official test suite
|
2012-08-30 19:14:39 +02:00
|
|
|
set(FILE_ALREADY_READ 0)
|
|
|
|
get_filename_component(TEST_SUITE_FILENAME ${TEST_SUITE_FILE} NAME)
|
|
|
|
string(REGEX MATCH "^test_suite.ctest.in$" FILE_ALREADY_READ ${TEST_SUITE_FILENAME})
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
if(NOT FILE_ALREADY_READ)
|
2011-10-07 16:20:15 +02:00
|
|
|
# Configure the additional test suite file:
|
2012-08-30 19:14:39 +02:00
|
|
|
get_filename_component(TEST_SUITE_FILE_SUB ${TEST_SUITE_FILE} NAME_WE)
|
|
|
|
configure_file("${TEST_SUITE_FILE}"
|
2011-10-07 16:20:15 +02:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${TEST_SUITE_FILE_SUB}.ctest"
|
|
|
|
@ONLY)
|
|
|
|
# Read the additional file into a list
|
2012-08-30 19:14:39 +02:00
|
|
|
file(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/${TEST_SUITE_FILE_SUB}.ctest OPJ_TEST_CMD_LINE_LIST_TEMP)
|
2011-10-07 16:20:15 +02:00
|
|
|
# Append the list of command
|
2012-08-30 19:20:03 +02:00
|
|
|
set(OPJ_TEST_CMD_LINE_LIST ${OPJ_TEST_CMD_LINE_LIST} ${OPJ_TEST_CMD_LINE_LIST_TEMP})
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endforeach()
|
2011-10-07 16:20:15 +02:00
|
|
|
|
2012-08-30 19:20:03 +02:00
|
|
|
else()
|
2011-08-30 18:07:43 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
message(FATAL_ERROR "One test suite should be available (test_suite.ctest.in) !!!")
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
endif()
|
2011-08-30 18:07:43 +02:00
|
|
|
|
|
|
|
|
2014-03-14 16:51:53 +01:00
|
|
|
set(nonregression_filenames_used)
|
2011-10-07 16:20:15 +02:00
|
|
|
# Parse the command line found in the file(s)
|
2012-08-30 19:14:39 +02:00
|
|
|
set(IT_TEST_ENC 0)
|
|
|
|
set(IT_TEST_DEC 0)
|
|
|
|
foreach(OPJ_TEST_CMD_LINE ${OPJ_TEST_CMD_LINE_LIST})
|
2011-11-09 15:23:03 +01:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set(IGNORE_LINE_FOUND 0)
|
2011-10-07 16:20:15 +02:00
|
|
|
|
|
|
|
# Replace space by ; to generate a list
|
2012-08-30 19:14:39 +02:00
|
|
|
string(REPLACE " " ";" CMD_ARG_LIST ${OPJ_TEST_CMD_LINE})
|
2011-11-09 15:23:03 +01:00
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
# Check if the first argument begin by the comment sign
|
2012-08-30 19:14:39 +02:00
|
|
|
list(GET CMD_ARG_LIST 0 EXE_NAME)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
if(EXE_NAME)
|
|
|
|
string(REGEX MATCH "^#" IGNORE_LINE_FOUND ${EXE_NAME})
|
2012-08-30 19:20:03 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(IGNORE_LINE_FOUND OR NOT EXE_NAME)
|
2011-11-09 15:23:03 +01:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
#message( STATUS "Current line is ignored: ${OPJ_TEST_CMD_LINE}")
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
else()
|
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
# Check if the first argument begin by the failed sign
|
2012-08-30 19:14:39 +02:00
|
|
|
set(FAILED_TEST_FOUND 0)
|
|
|
|
string(REGEX MATCH "^!" FAILED_TEST_FOUND ${EXE_NAME})
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
if (FAILED_TEST_FOUND)
|
2012-09-30 18:28:32 +02:00
|
|
|
# Manage the different cases with the failed sign to remove the first argument which must be opj_compress
|
2012-08-30 19:14:39 +02:00
|
|
|
set(FAILED_TEST_FOUND_1 0)
|
2012-09-30 18:28:32 +02:00
|
|
|
string(REGEX MATCH "^!opj_compress$|^!opj_decompress$" FAILED_TEST_FOUND_1 ${EXE_NAME})
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
if (FAILED_TEST_FOUND_1)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
list(REMOVE_AT CMD_ARG_LIST 0)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
else ()
|
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set(FAILED_TEST_FOUND_2 0)
|
|
|
|
list(GET CMD_ARG_LIST 1 EXE_NAME)
|
2012-09-30 18:28:32 +02:00
|
|
|
string(REGEX MATCH "^opj_compress$|^opj_decompress$" FAILED_TEST_FOUND_2 ${EXE_NAME})
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
if (FAILED_TEST_FOUND_2)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
list(REMOVE_AT CMD_ARG_LIST 0)
|
|
|
|
list(REMOVE_AT CMD_ARG_LIST 0)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
else ()
|
|
|
|
|
2012-09-30 18:28:32 +02:00
|
|
|
message( FATAL_ERROR "${EXE_NAME} is not the right executable name to encode file (try to use opj_compress or opj_decompress)")
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
else ()
|
2012-09-30 18:28:32 +02:00
|
|
|
# Check if the first argument is equal to opj_compress
|
|
|
|
string(REGEX MATCH "^opj_compress$|^opj_decompress$" EXE_NAME_FOUND ${EXE_NAME})
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
if(EXE_NAME_FOUND)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-09-30 18:28:32 +02:00
|
|
|
string(REGEX MATCH "opj_compress" ENC_TEST_FOUND ${EXE_NAME})
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
else()
|
|
|
|
|
2012-09-30 18:28:32 +02:00
|
|
|
message( FATAL_ERROR "${EXE_NAME} is not the right executable name to encode file (try to use opj_compress)")
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
endif()
|
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
list(REMOVE_AT CMD_ARG_LIST 0)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
endif ()
|
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
# Parse the argument list to find the input filename and output filename
|
2012-08-30 19:14:39 +02:00
|
|
|
set(CMD_ARG_LIST_2 "")
|
|
|
|
set(ARG_POS 0)
|
|
|
|
set(INPUT_ARG_POS 0)
|
|
|
|
set(OUTPUT_ARG_POS 0)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
foreach(CMD_ARG_ELT ${CMD_ARG_LIST})
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
math(EXPR ARG_POS "${ARG_POS}+1" )
|
2011-08-30 18:07:43 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
string(COMPARE EQUAL ${CMD_ARG_ELT} "-i" INPUT_ARG_FOUND)
|
|
|
|
if(INPUT_ARG_FOUND)
|
|
|
|
set(INPUT_ARG_POS ${ARG_POS})
|
|
|
|
set(INPUT_ARG_FOUND 0)
|
2012-08-30 19:20:03 +02:00
|
|
|
endif()
|
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
string(COMPARE EQUAL ${CMD_ARG_ELT} "-o" OUTPUT_ARG_FOUND)
|
|
|
|
if(OUTPUT_ARG_FOUND)
|
|
|
|
set(OUTPUT_ARG_POS ${ARG_POS})
|
|
|
|
set(OUTPUT_ARG_FOUND 0)
|
2012-08-30 19:20:03 +02:00
|
|
|
endif()
|
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
list (APPEND CMD_ARG_LIST_2 ${CMD_ARG_ELT})
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
endforeach()
|
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
list(GET CMD_ARG_LIST_2 ${INPUT_ARG_POS} INPUT_FILENAME)
|
|
|
|
get_filename_component(INPUT_FILENAME_NAME ${INPUT_FILENAME} NAME)
|
|
|
|
get_filename_component(INPUT_FILENAME_NAME_WE ${INPUT_FILENAME_NAME} NAME_WE)
|
|
|
|
list(GET CMD_ARG_LIST_2 ${OUTPUT_ARG_POS} OUTPUT_FILENAME)
|
|
|
|
get_filename_component(OUTPUT_FILENAME_NAME_WE ${OUTPUT_FILENAME} NAME_WE)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
#-----
|
|
|
|
# Now we can add the test suite corresponding to a line command in the file
|
|
|
|
#-----
|
|
|
|
# ENCODER TEST SUITE
|
2012-08-30 19:14:39 +02:00
|
|
|
if(ENC_TEST_FOUND)
|
2011-10-07 16:20:15 +02:00
|
|
|
math(EXPR IT_TEST_ENC "${IT_TEST_ENC}+1" )
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
# Encode an image into the jpeg2000 format
|
2014-02-24 13:48:23 +01:00
|
|
|
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode
|
|
|
|
COMMAND opj_compress
|
2011-10-07 16:20:15 +02:00
|
|
|
${CMD_ARG_LIST_2}
|
2011-08-30 18:07:43 +02:00
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
if(FAILED_TEST_FOUND)
|
|
|
|
set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode PROPERTIES WILL_FAIL TRUE)
|
2012-08-30 19:20:03 +02:00
|
|
|
else()
|
|
|
|
|
|
|
|
# Dump the encoding file
|
2014-02-24 13:48:23 +01:00
|
|
|
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-dump
|
|
|
|
COMMAND opj_dump
|
2011-10-07 16:20:15 +02:00
|
|
|
-i ${OUTPUT_FILENAME}
|
|
|
|
-o ${OUTPUT_FILENAME}-ENC-${IT_TEST_ENC}.txt
|
|
|
|
)
|
2012-08-30 19:14:39 +02:00
|
|
|
set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-dump
|
2012-08-30 19:20:03 +02:00
|
|
|
PROPERTIES DEPENDS
|
|
|
|
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode)
|
|
|
|
|
|
|
|
# Compare the dump file with the baseline
|
2014-02-24 13:48:23 +01:00
|
|
|
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dump2base
|
|
|
|
COMMAND compare_dump_files
|
2012-06-01 09:53:44 +02:00
|
|
|
-b ${BASELINE_NR}/opj_v2_${OUTPUT_FILENAME_NAME_WE}-ENC-${IT_TEST_ENC}.txt
|
2011-10-07 16:20:15 +02:00
|
|
|
-t ${OUTPUT_FILENAME}-ENC-${IT_TEST_ENC}.txt
|
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dump2base
|
2012-08-30 19:20:03 +02:00
|
|
|
PROPERTIES DEPENDS
|
|
|
|
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-dump)
|
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
# Decode the encoding file with kakadu expand command
|
2012-08-30 19:14:39 +02:00
|
|
|
if (KDU_EXPAND_EXECUTABLE)
|
2014-02-24 13:48:23 +01:00
|
|
|
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref
|
|
|
|
COMMAND ${KDU_EXPAND_EXECUTABLE}
|
2011-12-02 16:30:19 +01:00
|
|
|
-i ${OUTPUT_FILENAME}
|
|
|
|
-o ${OUTPUT_FILENAME}.raw
|
2011-10-07 16:20:15 +02:00
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref
|
2012-08-30 19:20:03 +02:00
|
|
|
PROPERTIES DEPENDS
|
|
|
|
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode)
|
|
|
|
|
|
|
|
# Compare the decoding file with baseline generated from the kdu_expand and baseline.j2k
|
2014-02-24 13:48:23 +01:00
|
|
|
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dec-ref-out2base
|
2014-03-07 17:24:24 +01:00
|
|
|
COMMAND compare_raw_files
|
2011-10-07 16:20:15 +02:00
|
|
|
-b ${BASELINE_NR}/opj_${OUTPUT_FILENAME_NAME_WE}-ENC-${IT_TEST_ENC}.raw
|
|
|
|
-t ${OUTPUT_FILENAME}.raw
|
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dec-ref-out2base
|
2012-08-30 19:20:03 +02:00
|
|
|
PROPERTIES DEPENDS
|
2011-10-07 16:20:15 +02:00
|
|
|
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
endif()
|
2012-08-30 19:20:03 +02:00
|
|
|
endif()
|
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
# DECODER TEST SUITE
|
2012-08-30 19:20:03 +02:00
|
|
|
else()
|
2014-03-14 16:51:53 +01:00
|
|
|
string(FIND ${INPUT_FILENAME} "nonregression" nr_pos)
|
|
|
|
if(${nr_pos} GREATER 0)
|
|
|
|
list(APPEND nonregression_filenames_used ${INPUT_FILENAME_NAME})
|
|
|
|
endif()
|
2011-10-07 16:20:15 +02:00
|
|
|
math(EXPR IT_TEST_DEC "${IT_TEST_DEC}+1" )
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2011-10-07 16:20:15 +02:00
|
|
|
# Decode the input image
|
2014-02-24 13:48:23 +01:00
|
|
|
add_test(NAME NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode
|
|
|
|
COMMAND opj_decompress
|
2011-10-07 16:20:15 +02:00
|
|
|
${CMD_ARG_LIST_2}
|
2011-08-31 15:33:40 +02:00
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
if(FAILED_TEST_FOUND)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set_tests_properties(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode PROPERTIES WILL_FAIL TRUE)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
else()
|
2014-02-24 17:07:21 +01:00
|
|
|
# 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
|
2014-03-06 15:43:21 +01:00
|
|
|
-DOUTFILENAME:STRING=${OUTPUT_FILENAME}
|
2014-02-24 17:07:21 +01:00
|
|
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/checkmd5refs.cmake)
|
|
|
|
|
2014-02-28 17:04:11 +01:00
|
|
|
set_tests_properties(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode-md5
|
|
|
|
PROPERTIES DEPENDS NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode
|
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
|
|
|
# FIXME: add a compare2base function base on raw which
|
|
|
|
# can output png diff files if necesary
|
2012-08-30 19:14:39 +02:00
|
|
|
# add_test(NR-${filename}-compare2base
|
2014-03-07 17:24:24 +01:00
|
|
|
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
|
2011-10-07 16:20:15 +02:00
|
|
|
# -b ${BASELINE_NR}/opj_${filenameRef}
|
|
|
|
# -t ${TEMP}/${filename}.pgx
|
|
|
|
# -n ${nbComponents}
|
2012-08-30 19:20:03 +02:00
|
|
|
# -d
|
2011-10-07 16:20:15 +02:00
|
|
|
# -s b_t_
|
|
|
|
# )
|
|
|
|
#
|
2012-08-30 19:20:03 +02:00
|
|
|
# set_tests_properties(NR-${filename}-compare2base
|
|
|
|
# PROPERTIES DEPENDS
|
|
|
|
# NR-${filename}-decode)
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endif()
|
2011-08-30 18:07:43 +02:00
|
|
|
|
2012-08-30 19:20:03 +02:00
|
|
|
endif()
|
2011-08-30 18:07:43 +02:00
|
|
|
|
2012-08-30 19:20:03 +02:00
|
|
|
endforeach()
|
2014-03-14 16:51:53 +01:00
|
|
|
|
|
|
|
set(existing_filenames)
|
|
|
|
foreach(f ${OPJ_DATA_NR_LIST})
|
|
|
|
get_filename_component(ff ${f} NAME)
|
|
|
|
list(APPEND existing_filenames ${ff})
|
|
|
|
endforeach()
|
2014-03-25 16:29:19 +01:00
|
|
|
if(existing_filenames)
|
2014-03-14 16:51:53 +01:00
|
|
|
list(REMOVE_ITEM existing_filenames ${nonregression_filenames_used})
|
2014-03-25 16:29:19 +01:00
|
|
|
endif()
|
2014-03-14 16:51:53 +01:00
|
|
|
|
|
|
|
# keep track of new addition:
|
|
|
|
# if we reach here, then a J2K files was added but no test is present in
|
|
|
|
# test_suite.ctest.in:
|
|
|
|
foreach(found_but_no_test ${existing_filenames})
|
|
|
|
add_test(NAME Found-But-No-Test-${found_but_no_test} COMMAND ${CMAKE_COMMAND} -E echo "${found_but_no_test}")
|
|
|
|
set_tests_properties(Found-But-No-Test-${found_but_no_test} PROPERTIES WILL_FAIL TRUE)
|
|
|
|
endforeach()
|