]> 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, 17 Mar 2023 20:27:56 +0000 (21:27 +0100)
CMakeLists.txt
cmake/run-and-compare.cmake

index 71964604cd69499b2bb557c1c7c1c1aa93c6f232..aaf1424be419c7041bec8e45ff6bdfe30b83db2e 100644 (file)
@@ -1192,7 +1192,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)
@@ -1206,7 +1206,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)
@@ -1220,7 +1220,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)
@@ -1229,7 +1229,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