Commit 2da4816 for zlib

commit 2da4816791e00eb7601dc96bf0574f72aae7159b
Author: Vollstrecker <werner@vollstreckernet.de>
Date:   Sat Feb 28 12:14:19 2026 +0100

    CMake: Move iostream3 tests into test directory.

diff --git a/contrib/iostream3/CMakeLists.txt b/contrib/iostream3/CMakeLists.txt
index 092a2f2..8035bd6 100644
--- a/contrib/iostream3/CMakeLists.txt
+++ b/contrib/iostream3/CMakeLists.txt
@@ -40,24 +40,6 @@ if(WIN32 OR CYGWIN)
     set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
 endif(WIN32 OR CYGWIN)

-
-function(iostreamv3_findTestEnv testName)
-    set(testEnv "PATH=")
-
-    if(MSVC OR MINGW)
-        set(separator "\\\;")
-    else()
-        set(separator ":")
-    endif()
-
-    string(APPEND testEnv
-        "$<TARGET_FILE_DIR:${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3>${separator}")
-    string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}")
-    string(APPEND testEnv "$ENV{PATH}")
-
-    set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
-endfunction(iostreamv3_findTestEnv testName)
-
 if(ZLIB_IOSTREAM3_BUILD_SHARED)
     add_library(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3 SHARED
                 zfstream.cc
@@ -80,33 +62,6 @@ if(ZLIB_IOSTREAM3_BUILD_SHARED)

     target_link_libraries(${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3
         PUBLIC ZLIB::ZLIB)
-
-    if(ZLIB_IOSTREAM3_BUILD_TESTING)
-        enable_testing()
-
-        add_executable(${ZLIB_CONTRIB_PREFIX}iostream3_test test.cc zfstream.h)
-
-        target_link_libraries(${ZLIB_CONTRIB_PREFIX}iostream3_test
-            PRIVATE IOSTREAMV3::IOSTREAMV3)
-
-        add_test(NAME ${ZLIB_CONTRIB_PREFIX}iostream3_test
-            COMMAND ${ZLIB_CONTRIB_PREFIX}iostream3_test)
-
-        set_tests_properties(${ZLIB_CONTRIB_PREFIX}iostream3_test
-            PROPERTIES
-                FIXTURES_REQUIRED ${ZLIB_CONTRIB_PREFIX}iostream3_cleanup)
-
-        if(MSVC
-           OR MSYS
-           OR MINGW
-           OR CYGWIN)
-            iostreamv3_findtestenv(${ZLIB_CONTRIB_PREFIX}iostream3_test)
-        endif(
-            MSVC
-            OR MSYS
-            OR MINGW
-            OR CYGWIN)
-    endif(ZLIB_IOSTREAM3_BUILD_TESTING)
 endif(ZLIB_IOSTREAM3_BUILD_SHARED)

 if(ZLIB_IOSTREAM3_BUILD_STATIC)
@@ -125,41 +80,7 @@ if(ZLIB_IOSTREAM3_BUILD_STATIC)
             EXPORT_NAME IOSTREAMV3STATIC
             OUTPUT_NAME
                 iostream3${${ZLIB_CONTRIB_PREFIX}IOStream3_static_suffix})
-
-    if(ZLIB_IOSTREAM3_BUILD_TESTING)
-        enable_testing()
-
-        add_executable(${ZLIB_CONTRIB_PREFIX}iostream3_testStatic
-            test.cc
-            zfstream.h)
-
-        target_link_libraries(${ZLIB_CONTRIB_PREFIX}iostream3_testStatic
-            PRIVATE IOSTREAMV3::IOSTREAMV3STATIC)
-
-        add_test(NAME ${ZLIB_CONTRIB_PREFIX}iostream3_testStatic
-                 COMMAND ${ZLIB_CONTRIB_PREFIX}iostream3_testStatic)
-
-        set_tests_properties(${ZLIB_CONTRIB_PREFIX}iostream3_testStatic
-            PROPERTIES
-                FIXTURES_REQUIRED ${ZLIB_CONTRIB_PREFIX}iostream3_cleanup)
-    endif(ZLIB_IOSTREAM3_BUILD_TESTING)
 endif(ZLIB_IOSTREAM3_BUILD_STATIC)
-
-if(ZLIB_IOSTREAM3_BUILD_TESTING)
-    add_test(NAME ${ZLIB_CONTRIB_PREFIX}iostream3_cleanup
-        COMMAND ${CMAKE_COMMAND}
-            -E
-            rm
-            ${CMAKE_CURRENT_BINARY_DIR}/test1.txt.gz
-            ${CMAKE_CURRENT_BINARY_DIR}/test2.txt.gz)
-
-    set_tests_properties(${ZLIB_CONTRIB_PREFIX}iostream3_cleanup
-        PROPERTIES
-            FIXTURES_CLEANUP ${ZLIB_CONTRIB_PREFIX}iostream3_cleanup)
-
-        add_subdirectory(test)
-endif(ZLIB_IOSTREAM3_BUILD_TESTING)
-
 if(ZLIB_IOSTREAM3_INSTALL)
     if(ZLIB_IOSTREAM3_BUILD_SHARED)
         install(
@@ -216,3 +137,8 @@ if(ZLIB_IOSTREAM3_INSTALL)
         COMPONENT Development
         DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
 endif(ZLIB_IOSTREAM3_INSTALL)
+
+if(ZLIB_IOSTREAM3_BUILD_TESTING)
+    enable_testing()
+    add_subdirectory(test/)
+endif(ZLIB_IOSTREAM3_BUILD_TESTING)
diff --git a/contrib/iostream3/test/CMakeLists.txt b/contrib/iostream3/test/CMakeLists.txt
index abfbb02..7646147 100644
--- a/contrib/iostream3/test/CMakeLists.txt
+++ b/contrib/iostream3/test/CMakeLists.txt
@@ -17,6 +17,23 @@ if(NOT DEFINED ZLIB_BUILD_IOSTREAM3)
             FIXTURES_SETUP ${ZLIB_CONTRIB_PREFIX}iostream3_install)
 endif(NOT DEFINED ZLIB_BUILD_IOSTREAM3)

+function(iostreamv3_findTestEnv testName)
+    set(testEnv "PATH=")
+
+    if(MSVC OR MINGW)
+        set(separator "\\\;")
+    else()
+        set(separator ":")
+    endif()
+
+    string(APPEND testEnv
+        "$<TARGET_FILE_DIR:${ZLIB_CONTRIB_PREFIX}iostream3_iostreamv3>${separator}")
+    string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}")
+    string(APPEND testEnv "$ENV{PATH}")
+
+    set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
+endfunction(iostreamv3_findTestEnv testName)
+
 configure_file(
     ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
     ${WORK_DIR}/iostream3_find_package_test/CMakeLists.txt @ONLY)
@@ -200,3 +217,57 @@ set_tests_properties(
         PROPERTIES
             FIXTURES_REQUIRED ${inst_setup}
             WILL_FAIL TRUE)
+
+if(ZLIB_IOSTREAM3_BUILD_SHARED)
+    add_executable(${ZLIB_CONTRIB_PREFIX}iostream3_test
+        ${iostreamV3_SOURCE_DIR}/test.cc
+        ${iostreamV3_SOURCE_DIR}/zfstream.h)
+
+    target_link_libraries(${ZLIB_CONTRIB_PREFIX}iostream3_test
+        PRIVATE IOSTREAMV3::IOSTREAMV3)
+
+    add_test(NAME ${ZLIB_CONTRIB_PREFIX}iostream3_test
+        COMMAND ${ZLIB_CONTRIB_PREFIX}iostream3_test)
+
+    set_tests_properties(${ZLIB_CONTRIB_PREFIX}iostream3_test
+        PROPERTIES
+            FIXTURES_SETUP iostream3_tests
+            RESOURCE_LOCK iostram_txt_gz)
+
+    if(MSVC
+       OR MSYS
+       OR MINGW
+       OR CYGWIN)
+        iostreamv3_findtestenv(${ZLIB_CONTRIB_PREFIX}iostream3_test)
+    endif(
+        MSVC
+        OR MSYS
+        OR MINGW
+        OR CYGWIN)
+endif(ZLIB_IOSTREAM3_BUILD_SHARED)
+
+if(ZLIB_IOSTREAM3_BUILD_STATIC)
+    add_executable(${ZLIB_CONTRIB_PREFIX}iostream3_testStatic
+        ${iostreamV3_SOURCE_DIR}/test.cc
+        ${iostreamV3_SOURCE_DIR}/zfstream.h)
+
+    target_link_libraries(${ZLIB_CONTRIB_PREFIX}iostream3_testStatic
+        PRIVATE IOSTREAMV3::IOSTREAMV3STATIC)
+
+    add_test(NAME ${ZLIB_CONTRIB_PREFIX}iostream3_testStatic
+             COMMAND ${ZLIB_CONTRIB_PREFIX}iostream3_testStatic)
+
+    set_tests_properties(${ZLIB_CONTRIB_PREFIX}iostream3_testStatic
+        PROPERTIES
+            FIXTURES_SETUP iostream3_tests
+            RESOURCE_LOCK iostram_txt_gz)
+endif(ZLIB_IOSTREAM3_BUILD_STATIC)
+
+add_test(NAME ${ZLIB_CONTRIB_PREFIX}iostream3_cleanup
+    COMMAND ${CMAKE_COMMAND} -E rm
+        ${CMAKE_CURRENT_BINARY_DIR}/test1.txt.gz
+        ${CMAKE_CURRENT_BINARY_DIR}/test2.txt.gz)
+
+set_tests_properties(${ZLIB_CONTRIB_PREFIX}iostream3_cleanup
+    PROPERTIES
+        FIXTURES_CLEANUP iostream3_tests)