@@ -205,3 +205,67 @@ else()
205205 -O3
206206 )
207207endif ()
208+
209+ # ============================================================
210+ # Interactive Device Hot-plug Test
211+ # Tests crash prevention when enumerating unplugged devices
212+ # with buggy drivers (Windows DirectShow)
213+ # This test requires manual interaction and is NOT part of
214+ # the automated test suite
215+ # ============================================================
216+
217+ add_executable (
218+ ccap_device_hotplug_test
219+ test_device_hotplug.cpp
220+ )
221+
222+ target_link_libraries (
223+ ccap_device_hotplug_test
224+ ccap
225+ )
226+
227+ set_target_properties (ccap_device_hotplug_test PROPERTIES
228+ CXX_STANDARD 17
229+ CXX_STANDARD_REQUIRED ON
230+ )
231+
232+ # Platform-specific compile options
233+ if (MSVC )
234+ target_compile_options (ccap_device_hotplug_test PRIVATE
235+ /MP
236+ /std:c++17
237+ /Zc:__cplusplus
238+ /Zc:preprocessor
239+ /source-charset:utf-8
240+ /bigobj
241+ /wd4996
242+ /D_CRT_SECURE_NO_WARNINGS
243+ )
244+ else ()
245+ target_compile_options (ccap_device_hotplug_test PRIVATE
246+ -std=c++17
247+ )
248+ endif ()
249+
250+ # Add a custom target to run this interactive test manually
251+ # Usage: cmake --build . --target run_device_hotplug_test
252+ if (WIN32 )
253+ add_custom_target (run_device_hotplug_testg_test
254+ COMMAND ${CMAKE_COMMAND } -E echo "=========================================="
255+ COMMAND ${CMAKE_COMMAND } -E echo "Running Device Hot-plug Interactive Test"
256+ COMMAND ${CMAKE_COMMAND } -E echo "=========================================="
257+ COMMAND $<TARGET_FILE :ccap_device_hotplug_test >
258+ DEPENDS ccap_device_hotplug_test
259+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR }
260+ COMMENT "Running interactive device hot-plug test (buggy driver crash prevention)"
261+ )
262+ endif ()
263+
264+ message (STATUS "Device hot-plug interactive test configured: ccap_device_hotplug_test" )
265+ if (WIN32 )
266+ message (STATUS " Run manually with: cmake --build . --target run_device_hotplug_test" )
267+ message (STATUS " Or execute: ${CMAKE_BINARY_DIR } /tests/Debug/ccap_device_hotplug_test.exe" )
268+ else ()
269+ message (STATUS " Run manually with: ./ccap_device_hotplug_test" )
270+ endif ()
271+
0 commit comments