Skip to content

Commit a86aa41

Browse files
committed
Run CTest in parallel
1 parent c990f34 commit a86aa41

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ if(UNICORN_BUILD_TESTS)
15081508
)
15091509
endforeach()
15101510

1511-
foreach(TEST_FILE ${UNICORN_TEST_FILE})
1511+
foreach(TEST_FILE ${UNICORN_TEST_FILE})
15121512
add_executable(${TEST_FILE}
15131513
${CMAKE_CURRENT_SOURCE_DIR}/tests/unit/${TEST_FILE}.c
15141514
)
@@ -1538,6 +1538,20 @@ if(UNICORN_BUILD_TESTS)
15381538
target_compile_definitions(${TEST_FILE} PRIVATE TARGET_READ_INLINED)
15391539
endif()
15401540
endforeach()
1541+
if(NOT ANDROID_ABI)
1542+
include(ProcessorCount)
1543+
ProcessorCount(UNICORN_CTEST_PARALLEL_LEVEL)
1544+
if(UNICORN_CTEST_PARALLEL_LEVEL EQUAL 0)
1545+
set(UNICORN_CTEST_PARALLEL_LEVEL 1)
1546+
endif()
1547+
add_custom_target(test_parallel
1548+
COMMAND ${CMAKE_CTEST_COMMAND}
1549+
--parallel ${UNICORN_CTEST_PARALLEL_LEVEL}
1550+
--output-on-failure
1551+
USES_TERMINAL
1552+
)
1553+
add_dependencies(test_parallel ${UNICORN_TEST_FILE})
1554+
endif()
15411555
endif()
15421556

15431557

0 commit comments

Comments
 (0)