]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed failed tools tests when source directory is read-only.
authorNathan Moinvaziri <nathan@nathanm.com>
Sat, 9 Apr 2022 04:43:54 +0000 (21:43 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 22 Apr 2022 11:50:33 +0000 (13:50 +0200)
CMakeLists.txt
cmake/run-and-compare.cmake

index f049a0c823fa47649d5e1f9ec75c8386c9b122ad..0dd196130cbc8480109bd53dd898bebcd1a63a6a 100644 (file)
@@ -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)
index 209d31e9e620f301d4a3a27c7b5668c8c391e1dd..16f4821e55223444df4dc1e5de162216e8e14269 100644 (file)
@@ -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