Skip to content

Commit 4adfdff

Browse files
CopilotJohnAmadis
andcommitted
Improve cross-platform file existence test
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
1 parent 58428b1 commit 4adfdff

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

tests/CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,19 @@ add_test(NAME dmdevfs_dmf_directory
2323
)
2424

2525
# Test 3: Verify module files exist (cross-platform)
26+
# We check if the file exists by trying to copy it to itself
2627
add_test(NAME dmdevfs_dmf_file
27-
COMMAND ${CMAKE_COMMAND} -E cat ${CMAKE_BINARY_DIR}/dmf/dmdevfs.dmf
28+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
29+
${CMAKE_BINARY_DIR}/dmf/dmdevfs.dmf
30+
${CMAKE_BINARY_DIR}/dmf/dmdevfs.dmf.test
2831
)
29-
set_tests_properties(dmdevfs_dmf_file PROPERTIES
30-
PASS_REGULAR_EXPRESSION "."
32+
33+
# Cleanup test file
34+
add_test(NAME dmdevfs_dmf_file_cleanup
35+
COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/dmf/dmdevfs.dmf.test
36+
)
37+
set_tests_properties(dmdevfs_dmf_file_cleanup PROPERTIES
38+
DEPENDS dmdevfs_dmf_file
3139
)
3240

3341
# Test 4: Check source file compilation

0 commit comments

Comments
 (0)