From: Nathan Moinvaziri Date: Sat, 9 Apr 2022 04:43:54 +0000 (-0700) Subject: Fixed failed tools tests when source directory is read-only. X-Git-Tag: 2.1.0-beta1~269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd5100d857bfafe890a524b5763785c71f2d7730;p=thirdparty%2Fzlib-ng.git Fixed failed tools tests when source directory is read-only. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f049a0c8..0dd19613 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1217,7 +1217,7 @@ if(ZLIB_ENABLE_TESTS) add_test(NAME makefixed COMMAND ${CMAKE_COMMAND} "-DCOMMAND=${MAKEFIXED_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/inffixed_tbl._h + -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/inffixed_tbl._h -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/inffixed_tbl.h -DIGNORE_LINE_ENDINGS=ON -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) @@ -1231,7 +1231,7 @@ if(ZLIB_ENABLE_TESTS) add_test(NAME maketrees COMMAND ${CMAKE_COMMAND} "-DCOMMAND=${MAKETREES_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/trees_tbl._h + -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/trees_tbl._h -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/trees_tbl.h -DIGNORE_LINE_ENDINGS=ON -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) @@ -1245,7 +1245,7 @@ if(ZLIB_ENABLE_TESTS) add_test(NAME makecrct-crc32 COMMAND ${CMAKE_COMMAND} "-DCOMMAND=${MAKECRCT_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/crc32_tbl._h + -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/crc32_tbl._h -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/crc32_tbl.h -DIGNORE_LINE_ENDINGS=ON -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) @@ -1254,7 +1254,7 @@ if(ZLIB_ENABLE_TESTS) add_test(NAME makecrct-crc32-combine COMMAND ${CMAKE_COMMAND} "-DCOMMAND=${MAKECRCT_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/crc32_comb_tbl._h + -DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/crc32_comb_tbl._h -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/crc32_comb_tbl.h -DIGNORE_LINE_ENDINGS=ON -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) diff --git a/cmake/run-and-compare.cmake b/cmake/run-and-compare.cmake index 209d31e9..16f4821e 100644 --- a/cmake/run-and-compare.cmake +++ b/cmake/run-and-compare.cmake @@ -41,10 +41,16 @@ endif() # Use configure_file to normalize line-endings if(IGNORE_LINE_ENDINGS) - configure_file(${COMPARE} ${COMPARE}.cmp NEWLINE_STYLE LF) - set(COMPARE ${COMPARE}.cmp) - configure_file(${OUTPUT} ${OUTPUT}.cmp NEWLINE_STYLE LF) - set(OUTPUT ${OUTPUT}.cmp) + # Rewrite files with normalized line endings to temporary directory + get_filename_component(COMPARE_NAME ${COMPARE} NAME) + set(COMPARE_TEMP ${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/${COMPARE_NAME}.cmp) + configure_file(${COMPARE} ${COMPARE_TEMP} NEWLINE_STYLE LF) + set(COMPARE ${COMPARE_TEMP}) + + get_filename_component(OUTPUT_NAME ${OUTPUT} NAME) + set(OUTPUT_TEMP ${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/${OUTPUT_NAME}.cmp) + configure_file(${OUTPUT} ${OUTPUT_TEMP} NEWLINE_STYLE LF) + set(OUTPUT ${OUTPUT_TEMP}) endif() # Compare that output is equal to specified file