@@ -85,4 +85,48 @@ if(SPARROW_IPC_BUILD_TESTS)
8585 GIT_REPOSITORY https://github.com/doctest/doctest.git
8686 TAG v2.4.12
8787 )
88+
89+ message (STATUS "📦 Fetching arrow-testing" )
90+ cmake_policy (PUSH)
91+ cmake_policy (SET CMP0174 NEW) # Suppress warning about FetchContent_Declare GIT_REPOSITORY
92+ # Fetch arrow-testing data (no CMake build needed)
93+ FetchContent_Declare(
94+ arrow-testing
95+ GIT_REPOSITORY https://github.com/apache/arrow-testing.git
96+ GIT_SHALLOW TRUE
97+ # CONFIGURE_COMMAND ""
98+ # BUILD_COMMAND ""
99+ # INSTALL_COMMAND ""
100+ )
101+ FetchContent_MakeAvailable(arrow-testing)
102+ cmake_policy (POP)
103+
104+ # Create interface library for easy access to test data
105+ add_library (arrow-testing-data INTERFACE )
106+ message (STATUS "Arrow testing data directory: ${arrow-testing_SOURCE_DIR}" )
107+ target_compile_definitions (arrow-testing-data INTERFACE
108+ ARROW_TESTING_DATA_DIR="${arrow-testing_SOURCE_DIR}"
109+ )
110+ message (STATUS "\t ✅ Fetched arrow-testing" )
111+
112+ # Iterate over all the files in the arrow-testing-data source directiory. When it's a gz, extract in place.
113+ file (GLOB_RECURSE arrow_testing_data_targz_files CONFIGURE_DEPENDS
114+ "${arrow-testing_SOURCE_DIR}/data/arrow-ipc-stream/integration/1.0.0-littleendian/*.json.gz"
115+ )
116+ foreach (file_path IN LISTS arrow_testing_data_targz_files)
117+ cmake_path(GET file_path PARENT_PATH parent_dir)
118+ cmake_path(GET file_path STEM filename)
119+ set (destination_file_path "${parent_dir} /${filename} .json" )
120+ if (EXISTS "${destination_file_path} " )
121+ message (VERBOSE "File already extracted: ${destination_file_path} " )
122+ else ()
123+ message (STATUS "Extracting ${file_path} " )
124+ if (WIN32 )
125+ execute_process (COMMAND powershell -Command "$i=\" ${file_path} \" ; $o=\" ${destination_file_path} \" ; [IO.Compression.GZipStream]::new([IO.File]::OpenRead($i),[IO.Compression.CompressionMode]::Decompress).CopyTo([IO.File]::Create($o))" )
126+ else ()
127+ execute_process (COMMAND gunzip -kf "${file_path} " )
128+ endif ()
129+ endif ()
130+ endforeach ()
131+
88132endif ()
0 commit comments