Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,26 @@ if(BUILD_TESTING)
endif()
endif()
endforeach()
set(unwrap_self_test_source "${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_unwrap_self.py")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${unwrap_self_test_source}")
file(STRINGS "${unwrap_self_test_source}" unwrap_self_cases REGEX "^class |^ def test_")
set(unwrap_self_first TRUE)
foreach(test_case IN LISTS unwrap_self_cases)
if(test_case MATCHES "^class ([A-Za-z0-9_]+)")
set(unwrap_self_class "${CMAKE_MATCH_1}")
else()
string(REGEX REPLACE "^ def (test_[A-Za-z0-9_]+).*" "\\1" test_case "${test_case}")
if(unwrap_self_first)
set_tests_properties(unwrap_self PROPERTIES
ENVIRONMENT "UNWRAP_SELF_TEST=${unwrap_self_class}.${test_case}" TIMEOUT 30)
set(unwrap_self_first FALSE)
else()
add_test(NAME unwrap_self_${unwrap_self_class}_${test_case} COMMAND ${Python3_EXECUTABLE}
"${unwrap_self_test_source}" "${unwrap_self_class}.${test_case}")
set_tests_properties(unwrap_self_${unwrap_self_class}_${test_case} PROPERTIES TIMEOUT 30)
endif()
endif()
endforeach()
add_test(NAME tools_headers_manifest COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/tests/test_public_headers_manifest.py)
set_tests_properties(tools_headers_manifest PROPERTIES TIMEOUT 20)
add_test(NAME conventions_pr_template COMMAND ${Python3_EXECUTABLE}
Expand Down
3 changes: 2 additions & 1 deletion tools/tests/test_unwrap_self.py
Original file line number Diff line number Diff line change
Expand Up @@ -1658,4 +1658,5 @@ def test_missing_reference_helper_keeps_existing_error_handling(self):


if __name__ == "__main__":
unittest.main()
selected_test = os.environ.get("UNWRAP_SELF_TEST")
unittest.main(argv=[sys.argv[0], selected_test] if selected_test else None)
Loading