Win: Enable testing cross-compiled builds

When cross-compiling, CMakeLists.txt now generates the CTest script
using relative paths, so that CTest can more easily be executed on a
different machine from the build machine.  Furthermore, Windows builds
are now tested using md5cmp, just like on Linux, rather than a CMake
script.  This prevents issues with differing CMake locations between
the build and test machines.

This also removes some trailing spaces from the md5cmp code and improves
the readability of the test code in CMakeLists.txt.
This commit is contained in:
DRC
2016-02-06 14:09:20 -06:00
parent ce0dd949b2
commit f9134384b7
6 changed files with 154 additions and 194 deletions

View File

@@ -320,6 +320,8 @@ add_executable(wrjpgcom wrjpgcom.c)
# Tests # Tests
# #
add_subdirectory(md5)
if(MSVC_IDE) if(MSVC_IDE)
set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/") set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/")
else() else()
@@ -454,6 +456,13 @@ if(ENABLE_STATIC)
set(TEST_LIBTYPES ${TEST_LIBTYPES} static) set(TEST_LIBTYPES ${TEST_LIBTYPES} static)
endif() endif()
set(TESTIMAGES ${CMAKE_SOURCE_DIR}/testimages)
set(MD5CMP ${CMAKE_CURRENT_BINARY_DIR}/md5/md5cmp)
if(CMAKE_CROSSCOMPILING)
file(RELATIVE_PATH TESTIMAGES ${CMAKE_CURRENT_BINARY_DIR} ${TESTIMAGES})
file(RELATIVE_PATH MD5CMP ${CMAKE_CURRENT_BINARY_DIR} ${MD5CMP})
endif()
foreach(libtype ${TEST_LIBTYPES}) foreach(libtype ${TEST_LIBTYPES})
if(libtype STREQUAL "shared") if(libtype STREQUAL "shared")
set(dir sharedlib/) set(dir sharedlib/)
@@ -475,219 +484,186 @@ foreach(libtype ${TEST_LIBTYPES})
# CC: null SAMP: fullsize FDCT: islow ENT: huff # CC: null SAMP: fullsize FDCT: islow ENT: huff
add_test(cjpeg${suffix}-rgb-islow add_test(cjpeg${suffix}-rgb-islow
${dir}cjpeg${suffix} -rgb -dct int -outfile testout_rgb_islow.jpg ${dir}cjpeg${suffix} -rgb -dct int
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -outfile testout_rgb_islow.jpg ${TESTIMAGES}/testorig.ppm)
add_test(cjpeg${suffix}-rgb-islow-cmp add_test(cjpeg${suffix}-rgb-islow-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_RGB_ISLOW} -DFILE=testout_rgb_islow.jpg ${MD5CMP} ${MD5_JPEG_RGB_ISLOW} testout_rgb_islow.jpg)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: null SAMP: fullsize IDCT: islow ENT: huff # CC: null SAMP: fullsize IDCT: islow ENT: huff
add_test(djpeg${suffix}-rgb-islow add_test(djpeg${suffix}-rgb-islow
${dir}djpeg${suffix} -dct int -ppm -outfile testout_rgb_islow.ppm ${dir}djpeg${suffix} -dct int -ppm
testout_rgb_islow.jpg) -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg)
add_test(djpeg${suffix}-rgb-islow-cmp add_test(djpeg${suffix}-rgb-islow-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_RGB_ISLOW} -DFILE=testout_rgb_islow.ppm ${MD5CMP} ${MD5_PPM_RGB_ISLOW} testout_rgb_islow.ppm)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
if(NOT WITH_12BIT) if(NOT WITH_12BIT)
# CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff
add_test(djpeg${suffix}-rgb-islow-565 add_test(djpeg${suffix}-rgb-islow-565
${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp
-outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg) -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg)
add_test(djpeg${suffix}-rgb-islow-565-cmp add_test(djpeg${suffix}-rgb-islow-565-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565} ${MD5CMP} ${MD5_BMP_RGB_ISLOW_565} testout_rgb_islow_565.bmp)
-DFILE=testout_rgb_islow_565.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
add_test(djpeg${suffix}-rgb-islow-565D add_test(djpeg${suffix}-rgb-islow-565D
${dir}djpeg${suffix} -dct int -rgb565 -bmp ${dir}djpeg${suffix} -dct int -rgb565 -bmp
-outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg) -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg)
add_test(djpeg${suffix}-rgb-islow-565D-cmp add_test(djpeg${suffix}-rgb-islow-565D-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_RGB_ISLOW_565D} ${MD5CMP} ${MD5_BMP_RGB_ISLOW_565D} testout_rgb_islow_565D.bmp)
-DFILE=testout_rgb_islow_565D.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endif() endif()
# CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff
add_test(cjpeg${suffix}-422-ifast-opt add_test(cjpeg${suffix}-422-ifast-opt
${dir}cjpeg${suffix} -sample 2x1 -dct fast -opt ${dir}cjpeg${suffix} -sample 2x1 -dct fast -opt
-outfile testout_422_ifast_opt.jpg -outfile testout_422_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm)
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
add_test(cjpeg${suffix}-422-ifast-opt-cmp add_test(cjpeg${suffix}-422-ifast-opt-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_422_IFAST_OPT} ${MD5CMP} ${MD5_JPEG_422_IFAST_OPT} testout_422_ifast_opt.jpg)
-DFILE=testout_422_ifast_opt.jpg
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff
add_test(djpeg${suffix}-422-ifast add_test(djpeg${suffix}-422-ifast
${dir}djpeg${suffix} -dct fast -outfile testout_422_ifast.ppm ${dir}djpeg${suffix} -dct fast
testout_422_ifast_opt.jpg) -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg)
add_test(djpeg${suffix}-422-ifast-cmp add_test(djpeg${suffix}-422-ifast-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_422_IFAST} -DFILE=testout_422_ifast.ppm ${MD5CMP} ${MD5_PPM_422_IFAST} testout_422_ifast.ppm)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff
add_test(djpeg${suffix}-422m-ifast add_test(djpeg${suffix}-422m-ifast
${dir}djpeg${suffix} -dct fast -nosmooth -outfile testout_422m_ifast.ppm ${dir}djpeg${suffix} -dct fast -nosmooth
testout_422_ifast_opt.jpg) -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg)
add_test(djpeg${suffix}-422m-ifast-cmp add_test(djpeg${suffix}-422m-ifast-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_422M_IFAST} -DFILE=testout_422m_ifast.ppm ${MD5CMP} ${MD5_PPM_422M_IFAST} testout_422m_ifast.ppm)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
if(NOT WITH_12BIT) if(NOT WITH_12BIT)
# CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff
add_test(djpeg${suffix}-422m-ifast-565 add_test(djpeg${suffix}-422m-ifast-565
${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp
-outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg) -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg)
add_test(djpeg${suffix}-422m-ifast-565-cmp add_test(djpeg${suffix}-422m-ifast-565-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565} ${MD5CMP} ${MD5_BMP_422M_IFAST_565} testout_422m_ifast_565.bmp)
-DFILE=testout_422m_ifast_565.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff
add_test(djpeg${suffix}-422m-ifast-565D add_test(djpeg${suffix}-422m-ifast-565D
${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp
-outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg) -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg)
add_test(djpeg${suffix}-422m-ifast-565D-cmp add_test(djpeg${suffix}-422m-ifast-565D-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_422M_IFAST_565D} ${MD5CMP} ${MD5_BMP_422M_IFAST_565D} testout_422m_ifast_565D.bmp)
-DFILE=testout_422m_ifast_565D.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endif() endif()
# CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff
add_test(cjpeg${suffix}-420-q100-ifast-prog add_test(cjpeg${suffix}-420-q100-ifast-prog
${dir}cjpeg${suffix} -sample 2x2 -quality 100 -dct fast -prog ${dir}cjpeg${suffix} -sample 2x2 -quality 100 -dct fast -prog
-outfile testout_420_q100_ifast_prog.jpg -outfile testout_420_q100_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm)
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
add_test(cjpeg${suffix}-420-q100-ifast-prog-cmp add_test(cjpeg${suffix}-420-q100-ifast-prog-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_IFAST_Q100_PROG} ${MD5CMP} ${MD5_JPEG_420_IFAST_Q100_PROG} testout_420_q100_ifast_prog.jpg)
-DFILE=testout_420_q100_ifast_prog.jpg
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff
add_test(djpeg${suffix}-420-q100-ifast-prog add_test(djpeg${suffix}-420-q100-ifast-prog
${dir}djpeg${suffix} -dct fast -outfile testout_420_q100_ifast.ppm ${dir}djpeg${suffix} -dct fast
testout_420_q100_ifast_prog.jpg) -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg)
add_test(djpeg${suffix}-420-q100-ifast-prog-cmp add_test(djpeg${suffix}-420-q100-ifast-prog-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_420_Q100_IFAST} ${MD5CMP} ${MD5_PPM_420_Q100_IFAST} testout_420_q100_ifast.ppm)
-DFILE=testout_420_q100_ifast.ppm
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff
add_test(djpeg${suffix}-420m-q100-ifast-prog add_test(djpeg${suffix}-420m-q100-ifast-prog
${dir}djpeg${suffix} -dct fast -nosmooth ${dir}djpeg${suffix} -dct fast -nosmooth
-outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg) -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg)
add_test(djpeg${suffix}-420m-q100-ifast-prog-cmp add_test(djpeg${suffix}-420m-q100-ifast-prog-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_Q100_IFAST} ${MD5CMP} ${MD5_PPM_420M_Q100_IFAST} testout_420m_q100_ifast.ppm)
-DFILE=testout_420m_q100_ifast.ppm
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff
add_test(cjpeg${suffix}-gray-islow add_test(cjpeg${suffix}-gray-islow
${dir}cjpeg${suffix} -gray -dct int -outfile testout_gray_islow.jpg ${dir}cjpeg${suffix} -gray -dct int
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -outfile testout_gray_islow.jpg ${TESTIMAGES}/testorig.ppm)
add_test(cjpeg${suffix}-gray-islow-cmp add_test(cjpeg${suffix}-gray-islow-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_GRAY_ISLOW} ${MD5CMP} ${MD5_JPEG_GRAY_ISLOW} testout_gray_islow.jpg)
-DFILE=testout_gray_islow.jpg
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff # CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff
add_test(djpeg${suffix}-gray-islow add_test(djpeg${suffix}-gray-islow
${dir}djpeg${suffix} -dct int -outfile testout_gray_islow.ppm ${dir}djpeg${suffix} -dct int
testout_gray_islow.jpg) -outfile testout_gray_islow.ppm testout_gray_islow.jpg)
add_test(djpeg${suffix}-gray-islow-cmp add_test(djpeg${suffix}-gray-islow-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW} ${MD5CMP} ${MD5_PPM_GRAY_ISLOW} testout_gray_islow.ppm)
-DFILE=testout_gray_islow.ppm
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff # CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff
add_test(djpeg${suffix}-gray-islow-rgb add_test(djpeg${suffix}-gray-islow-rgb
${dir}djpeg${suffix} -dct int -rgb -outfile testout_gray_islow_rgb.ppm ${dir}djpeg${suffix} -dct int -rgb
testout_gray_islow.jpg) -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg)
add_test(djpeg${suffix}-gray-islow-rgb-cmp add_test(djpeg${suffix}-gray-islow-rgb-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW_RGB} ${MD5CMP} ${MD5_PPM_GRAY_ISLOW_RGB} testout_gray_islow_rgb.ppm)
-DFILE=testout_gray_islow_rgb.ppm
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
if(NOT WITH_12BIT) if(NOT WITH_12BIT)
# CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff
add_test(djpeg${suffix}-gray-islow-565 add_test(djpeg${suffix}-gray-islow-565
${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp
-outfile testout_gray_islow_565.bmp testout_gray_islow.jpg) -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg)
add_test(djpeg${suffix}-gray-islow-565-cmp add_test(djpeg${suffix}-gray-islow-565-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565} ${MD5CMP} ${MD5_BMP_GRAY_ISLOW_565} testout_gray_islow_565.bmp)
-DFILE=testout_gray_islow_565.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
add_test(djpeg${suffix}-gray-islow-565D add_test(djpeg${suffix}-gray-islow-565D
${dir}djpeg${suffix} -dct int -rgb565 -bmp ${dir}djpeg${suffix} -dct int -rgb565 -bmp
-outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg) -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg)
add_test(djpeg${suffix}-gray-islow-565D-cmp add_test(djpeg${suffix}-gray-islow-565D-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_GRAY_ISLOW_565D} ${MD5CMP} ${MD5_BMP_GRAY_ISLOW_565D} testout_gray_islow_565D.bmp)
-DFILE=testout_gray_islow_565D.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endif() endif()
# CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow
# ENT: 2-pass huff # ENT: 2-pass huff
add_test(cjpeg${suffix}-420s-ifast-opt add_test(cjpeg${suffix}-420s-ifast-opt
${dir}cjpeg${suffix} -sample 2x2 -smooth 1 -dct int -opt -outfile ${dir}cjpeg${suffix} -sample 2x2 -smooth 1 -dct int -opt
testout_420s_ifast_opt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -outfile testout_420s_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm)
add_test(cjpeg${suffix}-420s-ifast-opt-cmp add_test(cjpeg${suffix}-420s-ifast-opt-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420S_IFAST_OPT} ${MD5CMP} ${MD5_JPEG_420S_IFAST_OPT} testout_420s_ifast_opt.jpg)
-DFILE=testout_420s_ifast_opt.jpg
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff
add_test(cjpeg${suffix}-3x2-float-prog add_test(cjpeg${suffix}-3x2-float-prog
${dir}cjpeg${suffix} -sample 3x2 -dct float -prog ${dir}cjpeg${suffix} -sample 3x2 -dct float -prog
-outfile testout_3x2_float_prog.jpg -outfile testout_3x2_float_prog.jpg ${TESTIMAGES}/testorig.ppm)
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
add_test(cjpeg${suffix}-3x2-float-prog-cmp add_test(cjpeg${suffix}-3x2-float-prog-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_3x2_FLOAT_PROG} ${MD5CMP} ${MD5_JPEG_3x2_FLOAT_PROG} testout_3x2_float_prog.jpg)
-DFILE=testout_3x2_float_prog.jpg
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff
add_test(djpeg${suffix}-3x2-float-prog add_test(djpeg${suffix}-3x2-float-prog
${dir}djpeg${suffix} -dct float -outfile testout_3x2_float.ppm ${dir}djpeg${suffix} -dct float
testout_3x2_float_prog.jpg) -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg)
add_test(djpeg${suffix}-3x2-float-prog-cmp add_test(djpeg${suffix}-3x2-float-prog-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_3x2_FLOAT} -DFILE=testout_3x2_float.ppm ${MD5CMP} ${MD5_PPM_3x2_FLOAT} testout_3x2_float.ppm)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
if(WITH_ARITH_ENC) if(WITH_ARITH_ENC)
# CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith
add_test(cjpeg${suffix}-420-islow-ari add_test(cjpeg${suffix}-420-islow-ari
${dir}cjpeg${suffix} -dct int -arithmetic ${dir}cjpeg${suffix} -dct int -arithmetic
-outfile testout_420_islow_ari.jpg -outfile testout_420_islow_ari.jpg ${TESTIMAGES}/testorig.ppm)
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
add_test(cjpeg${suffix}-420-islow-ari-cmp add_test(cjpeg${suffix}-420-islow-ari-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW_ARI} ${MD5CMP} ${MD5_JPEG_420_ISLOW_ARI} testout_420_islow_ari.jpg)
-DFILE=testout_420_islow_ari.jpg
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
add_test(jpegtran${suffix}-420-islow-ari add_test(jpegtran${suffix}-420-islow-ari
${dir}jpegtran${suffix} -arithmetic ${dir}jpegtran${suffix} -arithmetic
-outfile testout_420_islow_ari.jpg -outfile testout_420_islow_ari.jpg ${TESTIMAGES}/testimgint.jpg)
${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg)
add_test(jpegtran${suffix}-420-islow-ari-cmp add_test(jpegtran${suffix}-420-islow-ari-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW_ARI} ${MD5CMP} ${MD5_JPEG_420_ISLOW_ARI} testout_420_islow_ari.jpg)
-DFILE=testout_420_islow_ari.jpg
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith
add_test(cjpeg${suffix}-444-islow-progari add_test(cjpeg${suffix}-444-islow-progari
${dir}cjpeg${suffix} -sample 1x1 -dct int -prog -arithmetic ${dir}cjpeg${suffix} -sample 1x1 -dct int -prog -arithmetic
-outfile testout_444_islow_progari.jpg -outfile testout_444_islow_progari.jpg ${TESTIMAGES}/testorig.ppm)
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
add_test(cjpeg${suffix}-444-islow-progari-cmp add_test(cjpeg${suffix}-444-islow-progari-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_444_ISLOW_PROGARI} ${MD5CMP} ${MD5_JPEG_444_ISLOW_PROGARI} testout_444_islow_progari.jpg)
-DFILE=testout_444_islow_progari.jpg
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endif() endif()
if(WITH_ARITH_DEC) if(WITH_ARITH_DEC)
# CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith
add_test(djpeg${suffix}-420m-ifast-ari add_test(djpeg${suffix}-420m-ifast-ari
${dir}djpeg${suffix} -fast -ppm -outfile testout_420m_ifast_ari.ppm ${dir}djpeg${suffix} -fast -ppm
${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) -outfile testout_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg)
add_test(djpeg${suffix}-420m-ifast-ari-cmp add_test(djpeg${suffix}-420m-ifast-ari-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_IFAST_ARI} ${MD5CMP} ${MD5_PPM_420M_IFAST_ARI} testout_420m_ifast_ari.ppm)
-DFILE=testout_420m_ifast_ari.ppm
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
add_test(jpegtran${suffix}-420-islow add_test(jpegtran${suffix}-420-islow
${dir}jpegtran${suffix} -outfile testout_420_islow.jpg ${dir}jpegtran${suffix}
${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) -outfile testout_420_islow.jpg ${TESTIMAGES}/testimgari.jpg)
add_test(jpegtran${suffix}-420-islow-cmp add_test(jpegtran${suffix}-420-islow-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW} ${MD5CMP} ${MD5_JPEG_420_ISLOW} testout_420_islow.jpg)
-DFILE=testout_420_islow.jpg
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endif() endif()
# 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff # 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff
@@ -713,60 +689,46 @@ foreach(libtype ${TEST_LIBTYPES})
string(REGEX REPLACE "_" "/" scalearg ${scale}) string(REGEX REPLACE "_" "/" scalearg ${scale})
add_test(djpeg${suffix}-420m-islow-${scale} add_test(djpeg${suffix}-420m-islow-${scale}
${dir}djpeg${suffix} -dct int -scale ${scalearg} -nosmooth -ppm ${dir}djpeg${suffix} -dct int -scale ${scalearg} -nosmooth -ppm
-outfile testout_420m_islow_${scale}.ppm -outfile testout_420m_islow_${scale}.ppm ${TESTIMAGES}/${TESTORIG})
${CMAKE_SOURCE_DIR}/testimages/${TESTORIG})
add_test(djpeg${suffix}-420m-islow-${scale}-cmp add_test(djpeg${suffix}-420m-islow-${scale}-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_ISLOW_${scale}} ${MD5CMP} ${MD5_PPM_420M_ISLOW_${scale}} testout_420m_islow_${scale}.ppm)
-DFILE=testout_420m_islow_${scale}.ppm
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endforeach() endforeach()
if(NOT WITH_12BIT) if(NOT WITH_12BIT)
# CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
add_test(djpeg${suffix}-420-islow-256 add_test(djpeg${suffix}-420-islow-256
${dir}djpeg${suffix} -dct int -colors 256 -bmp ${dir}djpeg${suffix} -dct int -colors 256 -bmp
-outfile testout_420_islow_256.bmp -outfile testout_420_islow_256.bmp ${TESTIMAGES}/${TESTORIG})
${CMAKE_SOURCE_DIR}/testimages/${TESTORIG})
add_test(djpeg${suffix}-420-islow-256-cmp add_test(djpeg${suffix}-420-islow-256-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_256} ${MD5CMP} ${MD5_BMP_420_ISLOW_256} testout_420_islow_256.bmp)
-DFILE=testout_420_islow_256.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff
add_test(djpeg${suffix}-420-islow-565 add_test(djpeg${suffix}-420-islow-565
${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp
-outfile testout_420_islow_565.bmp -outfile testout_420_islow_565.bmp ${TESTIMAGES}/${TESTORIG})
${CMAKE_SOURCE_DIR}/testimages/${TESTORIG})
add_test(djpeg${suffix}-420-islow-565-cmp add_test(djpeg${suffix}-420-islow-565-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565} ${MD5CMP} ${MD5_BMP_420_ISLOW_565} testout_420_islow_565.bmp)
-DFILE=testout_420_islow_565.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
add_test(djpeg${suffix}-420-islow-565D add_test(djpeg${suffix}-420-islow-565D
${dir}djpeg${suffix} -dct int -rgb565 -bmp ${dir}djpeg${suffix} -dct int -rgb565 -bmp
-outfile testout_420_islow_565D.bmp -outfile testout_420_islow_565D.bmp ${TESTIMAGES}/${TESTORIG})
${CMAKE_SOURCE_DIR}/testimages/${TESTORIG})
add_test(djpeg${suffix}-420-islow-565D-cmp add_test(djpeg${suffix}-420-islow-565D-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_565D} ${MD5CMP} ${MD5_BMP_420_ISLOW_565D} testout_420_islow_565D.bmp)
-DFILE=testout_420_islow_565D.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff
add_test(djpeg${suffix}-420m-islow-565 add_test(djpeg${suffix}-420m-islow-565
${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp
-outfile testout_420m_islow_565.bmp -outfile testout_420m_islow_565.bmp ${TESTIMAGES}/${TESTORIG})
${CMAKE_SOURCE_DIR}/testimages/${TESTORIG})
add_test(djpeg${suffix}-420m-islow-565-cmp add_test(djpeg${suffix}-420m-islow-565-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565} ${MD5CMP} ${MD5_BMP_420M_ISLOW_565} testout_420m_islow_565.bmp)
-DFILE=testout_420m_islow_565.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff
add_test(djpeg${suffix}-420m-islow-565D add_test(djpeg${suffix}-420m-islow-565D
${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp
-outfile testout_420m_islow_565D.bmp -outfile testout_420m_islow_565D.bmp ${TESTIMAGES}/${TESTORIG})
${CMAKE_SOURCE_DIR}/testimages/${TESTORIG})
add_test(djpeg${suffix}-420m-islow-565D-cmp add_test(djpeg${suffix}-420m-islow-565D-cmp
${CMAKE_COMMAND} -DMD5=${MD5_BMP_420M_ISLOW_565D} ${MD5CMP} ${MD5_BMP_420M_ISLOW_565D} testout_420m_islow_565D.bmp)
-DFILE=testout_420m_islow_565D.bmp
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endif() endif()
# Partial decode tests. These tests are designed to cover all of the # Partial decode tests. These tests are designed to cover all of the
@@ -775,96 +737,90 @@ foreach(libtype ${TEST_LIBTYPES})
# Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff # Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff
add_test(djpeg${suffix}-420-islow-skip15_31 add_test(djpeg${suffix}-420-islow-skip15_31
${dir}djpeg${suffix} -dct int -skip 15,31 -ppm ${dir}djpeg${suffix} -dct int -skip 15,31 -ppm
-outfile testout_420_islow_skip15,31.ppm -outfile testout_420_islow_skip15,31.ppm ${TESTIMAGES}/${TESTORIG})
${CMAKE_SOURCE_DIR}/testimages/${TESTORIG})
add_test(djpeg${suffix}-420-islow-skip15_31-cmp add_test(djpeg${suffix}-420-islow-skip15_31-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_420_ISLOW_SKIP15_31} ${MD5CMP} ${MD5_PPM_420_ISLOW_SKIP15_31} testout_420_islow_skip15,31.ppm)
-DFILE=testout_420_islow_skip15,31.ppm
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith
if(WITH_ARITH_DEC) if(WITH_ARITH_DEC)
add_test(djpeg${suffix}-420-islow-ari-skip16_139 add_test(djpeg${suffix}-420-islow-ari-skip16_139
${dir}djpeg${suffix} -dct int -skip 16,139 -ppm ${dir}djpeg${suffix} -dct int -skip 16,139 -ppm
-outfile testout_420_islow_ari_skip16,139.ppm -outfile testout_420_islow_ari_skip16,139.ppm
${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) ${TESTIMAGES}/testimgari.jpg)
add_test(djpeg${suffix}-420-islow-ari_skip16_139-cmp add_test(djpeg${suffix}-420-islow-ari_skip16_139-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_420_ISLOW_ARI_SKIP16_139} ${MD5CMP} ${MD5_PPM_420_ISLOW_ARI_SKIP16_139}
-DFILE=testout_420_islow_ari_skip16,139.ppm testout_420_islow_ari_skip16,139.ppm)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endif() endif()
# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff
add_test(cjpeg${suffix}-420-islow-prog add_test(cjpeg${suffix}-420-islow-prog
${dir}cjpeg${suffix} -dct int -prog -outfile testout_420_islow_prog.jpg ${dir}cjpeg${suffix} -dct int -prog
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -outfile testout_420_islow_prog.jpg ${TESTIMAGES}/testorig.ppm)
add_test(djpeg${suffix}-420-islow-prog-strip71_132 add_test(djpeg${suffix}-420-islow-prog-strip71_132
${dir}djpeg${suffix} -dct int -strip 71,132 -ppm ${dir}djpeg${suffix} -dct int -strip 71,132 -ppm
-outfile testout_420_islow_strip71,132.ppm testout_420_islow_prog.jpg) -outfile testout_420_islow_strip71,132.ppm testout_420_islow_prog.jpg)
add_test(djpeg${suffix}-420-islow-prog-strip71_132-cmp add_test(djpeg${suffix}-420-islow-prog-strip71_132-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_420_ISLOW_PROG_STRIP71_132} ${MD5CMP} ${MD5_PPM_420_ISLOW_PROG_STRIP71_132}
-DFILE=testout_420_islow_strip71,132.ppm testout_420_islow_strip71,132.ppm)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith
if(WITH_ARITH_DEC) if(WITH_ARITH_DEC)
add_test(djpeg${suffix}-420-islow-ari-strip4_56 add_test(djpeg${suffix}-420-islow-ari-strip4_56
${dir}djpeg${suffix} -dct int -strip 4,56 -ppm ${dir}djpeg${suffix} -dct int -strip 4,56 -ppm
-outfile testout_420_islow_ari_strip4,56.ppm -outfile testout_420_islow_ari_strip4,56.ppm
${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) ${TESTIMAGES}/testimgari.jpg)
add_test(djpeg${suffix}-420-islow-ari-strip4_56-cmp add_test(djpeg${suffix}-420-islow-ari-strip4_56-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_420_ISLOW_ARI_STRIP4_56} ${MD5CMP} ${MD5_PPM_420_ISLOW_ARI_STRIP4_56}
-DFILE=testout_420_islow_ari_strip4,56.ppm testout_420_islow_ari_strip4,56.ppm)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endif() endif()
# Context rows: No Intra-iMCU row: Yes ENT: huff # Context rows: No Intra-iMCU row: Yes ENT: huff
add_test(cjpeg${suffix}-444-islow add_test(cjpeg${suffix}-444-islow
${dir}cjpeg${suffix} -dct int -sample 1x1 -outfile testout_444_islow.jpg ${dir}cjpeg${suffix} -dct int -sample 1x1
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) -outfile testout_444_islow.jpg ${TESTIMAGES}/testorig.ppm)
add_test(djpeg${suffix}-444-islow-skip1_6 add_test(djpeg${suffix}-444-islow-skip1_6
${dir}djpeg${suffix} -dct int -skip 1,6 -ppm ${dir}djpeg${suffix} -dct int -skip 1,6 -ppm
-outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg) -outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg)
add_test(djpeg${suffix}-444-islow-skip1_6-cmp add_test(djpeg${suffix}-444-islow-skip1_6-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_444_ISLOW_SKIP1_6} ${MD5CMP} ${MD5_PPM_444_ISLOW_SKIP1_6} testout_444_islow_skip1,6.ppm)
-DFILE=testout_444_islow_skip1,6.ppm
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# Context rows: No Intra-iMCU row: No ENT: prog huff # Context rows: No Intra-iMCU row: No ENT: prog huff
add_test(cjpeg${suffix}-444-islow-prog add_test(cjpeg${suffix}-444-islow-prog
${dir}cjpeg${suffix} -dct int -prog -sample 1x1 ${dir}cjpeg${suffix} -dct int -prog -sample 1x1
-outfile testout_444_islow_prog.jpg -outfile testout_444_islow_prog.jpg ${TESTIMAGES}/testorig.ppm)
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
add_test(djpeg${suffix}-444-islow-prog-strip13_110 add_test(djpeg${suffix}-444-islow-prog-strip13_110
${dir}djpeg${suffix} -dct int -strip 13,110 -ppm ${dir}djpeg${suffix} -dct int -strip 13,110 -ppm
-outfile testout_444_islow_prog_strip13,110.ppm testout_444_islow_prog.jpg) -outfile testout_444_islow_prog_strip13,110.ppm
testout_444_islow_prog.jpg)
add_test(djpeg${suffix}-444-islow-prog_strip13_110-cmp add_test(djpeg${suffix}-444-islow-prog_strip13_110-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_444_ISLOW_PROG_STRIP13_110} ${MD5CMP} ${MD5_PPM_444_ISLOW_PROG_STRIP13_110}
-DFILE=testout_444_islow_prog_strip13,110.ppm testout_444_islow_prog_strip13,110.ppm)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
# Context rows: No Intra-iMCU row: No ENT: arith # Context rows: No Intra-iMCU row: No ENT: arith
if(WITH_ARITH_ENC) if(WITH_ARITH_ENC)
add_test(cjpeg${suffix}-444-islow-ari add_test(cjpeg${suffix}-444-islow-ari
${dir}cjpeg${suffix} -dct int -arithmetic -sample 1x1 ${dir}cjpeg${suffix} -dct int -arithmetic -sample 1x1
-outfile testout_444_islow_ari.jpg -outfile testout_444_islow_ari.jpg ${TESTIMAGES}/testorig.ppm)
${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
if(WITH_ARITH_DEC) if(WITH_ARITH_DEC)
add_test(djpeg${suffix}-444-islow-ari-strip0_36 add_test(djpeg${suffix}-444-islow-ari-strip0_36
${dir}djpeg${suffix} -dct int -strip 0,36 -ppm ${dir}djpeg${suffix} -dct int -strip 0,36 -ppm
-outfile testout_444_islow_ari_strip0,36.ppm -outfile testout_444_islow_ari_strip0,36.ppm
testout_444_islow_ari.jpg) testout_444_islow_ari.jpg)
add_test(djpeg${suffix}-444-islow-ari-strip0_36-cmp add_test(djpeg${suffix}-444-islow-ari-strip0_36-cmp
${CMAKE_COMMAND} -DMD5=${MD5_PPM_444_ISLOW_ARI_STRIP0_36} ${MD5CMP} ${MD5_PPM_444_ISLOW_ARI_STRIP0_36}
-DFILE=testout_444_islow_ari_strip0,36.ppm testout_444_islow_ari_strip0,36.ppm)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endif() endif()
endif() endif()
add_test(jpegtran${suffix}-crop add_test(jpegtran${suffix}-crop
${dir}jpegtran${suffix} -crop 120x90+20+50 -transpose -perfect ${dir}jpegtran${suffix} -crop 120x90+20+50 -transpose -perfect
-outfile testout_crop.jpg ${CMAKE_SOURCE_DIR}/testimages/${TESTORIG}) -outfile testout_crop.jpg ${TESTIMAGES}/${TESTORIG})
add_test(jpegtran${suffix}-crop-cmp add_test(jpegtran${suffix}-crop-cmp
${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testout_crop.jpg ${MD5CMP} ${MD5_JPEG_CROP} testout_crop.jpg)
-P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
endforeach() endforeach()
add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P add_custom_target(testclean COMMAND ${MD5CMP} -P
${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake) ${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake)

View File

@@ -1,15 +0,0 @@
if(NOT MD5)
message(FATAL_ERROR "MD5 not specified")
endif()
if(NOT FILE)
message(FATAL_ERROR "FILE not specified")
endif()
file(MD5 ${FILE} MD5FILE)
if(NOT MD5 STREQUAL MD5FILE)
message(FATAL_ERROR "MD5 of ${FILE} should be ${MD5}, not ${MD5FILE}.")
else()
message(STATUS "${MD5}: OK")
endif()

1
md5/CMakeLists.txt Normal file
View File

@@ -0,0 +1 @@
add_executable(md5cmp md5cmp.c md5.c md5hl.c)

View File

@@ -36,7 +36,7 @@ static void MD5Transform(unsigned int [4], const unsigned char [64]);
#if (BYTE_ORDER == LITTLE_ENDIAN) #if (BYTE_ORDER == LITTLE_ENDIAN)
#define Encode memcpy #define Encode memcpy
#define Decode memcpy #define Decode memcpy
#else #else
/* /*
* OS X doesn't have le32toh() or htole32() * OS X doesn't have le32toh() or htole32()
@@ -134,7 +134,7 @@ MD5Init (context)
context->state[3] = 0x10325476; context->state[3] = 0x10325476;
} }
/* /*
* MD5 block update operation. Continues an MD5 message-digest * MD5 block update operation. Continues an MD5 message-digest
* operation, processing another message block, and updating the * operation, processing another message block, and updating the
* context. * context.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C)2013 D. R. Commander. All Rights Reserved. * Copyright (C)2013, 2016 D. R. Commander. All Rights Reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
@@ -30,6 +30,7 @@
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include "./md5.h" #include "./md5.h"
#include "../tjutil.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {

View File

@@ -4,12 +4,25 @@
* can do whatever you want with this stuff. If we meet some day, and you think * can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* libjpeg-turbo Modifications:
* Copyright (C) 2016, D. R. Commander
* Modifications are under the same license as the original code (see above)
* ----------------------------------------------------------------------------
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef _WIN32
#include <io.h>
#define close _close
#define fstat _fstat
#define lseek _lseek
#define read _read
#define stat _stat
#else
#include <unistd.h> #include <unistd.h>
#endif
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@@ -55,7 +68,11 @@ MD5FileChunk(const char *filename, char *buf, off_t ofs, off_t len)
off_t n; off_t n;
MD5Init(&ctx); MD5Init(&ctx);
#if _WIN32
f = _open(filename, O_RDONLY|O_BINARY);
#else
f = open(filename, O_RDONLY); f = open(filename, O_RDONLY);
#endif
if (f < 0) if (f < 0)
return 0; return 0;
if (fstat(f, &stbuf) < 0) if (fstat(f, &stbuf) < 0)
@@ -73,11 +90,11 @@ MD5FileChunk(const char *filename, char *buf, off_t ofs, off_t len)
i = read(f, buffer, sizeof(buffer)); i = read(f, buffer, sizeof(buffer));
else else
i = read(f, buffer, n); i = read(f, buffer, n);
if (i < 0) if (i < 0)
break; break;
MD5Update(&ctx, buffer, i); MD5Update(&ctx, buffer, i);
n -= i; n -= i;
} }
e = errno; e = errno;
close(f); close(f);
errno = e; errno = e;