2017-10-04 15:34:00 +00:00
|
|
|
cmake_minimum_required(VERSION 3.3)
|
2017-10-03 09:57:56 +00:00
|
|
|
|
2017-10-02 21:06:50 +00:00
|
|
|
|
2017-10-02 21:43:35 +00:00
|
|
|
find_program(LAUNCH_APPL LaunchAPPL PATH "${CMAKE_INSTALL_PREFIX}/../bin/")
|
2017-10-04 15:34:00 +00:00
|
|
|
execute_process(COMMAND ${LAUNCH_APPL} --list-emulators
|
|
|
|
OUTPUT_VARIABLE EMULATOR_LIST)
|
2017-10-07 14:04:16 +00:00
|
|
|
string(REPLACE "\n" ";" EMULATOR_LIST "${EMULATOR_LIST}")
|
2017-10-04 15:34:00 +00:00
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "RetroCarbon")
|
|
|
|
if("carbon" IN_LIST EMULATOR_LIST)
|
|
|
|
set(RETRO68_LAUNCH_METHOD carbon CACHE String "How to launch Mac applications (for automated testing)")
|
|
|
|
else()
|
|
|
|
set(RETRO68_LAUNCH_METHOD NONE CACHE String "How to launch Mac applications (for automated testing)")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
if("classic" IN_LIST EMULATOR_LIST)
|
|
|
|
set(RETRO68_LAUNCH_METHOD classic CACHE String "How to launch Mac applications (for automated testing)")
|
|
|
|
else()
|
|
|
|
set(RETRO68_LAUNCH_METHOD NONE CACHE String "How to launch Mac applications (for automated testing)")
|
|
|
|
endif()
|
|
|
|
endif()
|
2017-10-05 12:52:17 +00:00
|
|
|
|
2017-10-04 15:34:00 +00:00
|
|
|
set(RETRO68_TEST_CONFIG "--timeout=10" CACHE String "Options to pass to LaunchAPPL when running tests")
|
|
|
|
|
|
|
|
if(RETRO68_LAUNCH_METHOD MATCHES "NONE")
|
|
|
|
else() # extends to end of file
|
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
|
2017-10-02 21:06:50 +00:00
|
|
|
|
2017-10-03 09:57:56 +00:00
|
|
|
function(test FILE)
|
|
|
|
get_filename_component(NAME ${FILE} NAME_WE)
|
|
|
|
add_application(${NAME} ${FILE} Test.h Test.c)
|
|
|
|
add_test(NAME ${NAME} COMMAND ${LAUNCH_APPL}
|
|
|
|
-e ${RETRO68_LAUNCH_METHOD} ${RETRO68_TEST_CONFIG} ${ARGN} ${NAME}.bin)
|
2017-10-02 21:43:35 +00:00
|
|
|
endfunction()
|
|
|
|
|
2017-10-04 15:34:00 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Retro68")
|
2017-10-03 09:57:56 +00:00
|
|
|
test(ReallyEmpty.c)
|
2017-10-02 21:06:50 +00:00
|
|
|
set_target_properties(ReallyEmpty PROPERTIES LINK_FLAGS "-Wl,-gc-sections -Wl,--mac-single")
|
|
|
|
endif()
|
2017-10-01 00:42:02 +00:00
|
|
|
|
2017-10-03 09:57:56 +00:00
|
|
|
test(Empty.c)
|
2017-10-01 00:42:02 +00:00
|
|
|
|
2017-10-03 09:57:56 +00:00
|
|
|
test(File.c)
|
2017-10-01 00:42:02 +00:00
|
|
|
set_tests_properties(File PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
|
|
|
|
2017-10-03 09:57:56 +00:00
|
|
|
test(Timeout.c)
|
2017-10-03 23:56:05 +00:00
|
|
|
set_tests_properties(Timeout PROPERTIES PASS_REGULAR_EXPRESSION "One")
|
2017-10-03 09:57:56 +00:00
|
|
|
|
|
|
|
test(Log.c)
|
2017-10-02 21:43:35 +00:00
|
|
|
set_tests_properties(Log PROPERTIES PASS_REGULAR_EXPRESSION "One\nTwo\nThree")
|
2017-10-03 09:57:56 +00:00
|
|
|
|
2017-10-03 23:56:05 +00:00
|
|
|
test(ZeroInitialized.c)
|
|
|
|
set_tests_properties(Log PROPERTIES PASS_REGULAR_EXPRESSION "One\nTwo\nThree")
|
|
|
|
|
|
|
|
|
2017-10-03 09:57:56 +00:00
|
|
|
test(Init.cc)
|
|
|
|
set_tests_properties(Init PROPERTIES PASS_REGULAR_EXPRESSION "constructor\nmain\ndestructor")
|
|
|
|
|
2017-10-08 17:28:10 +00:00
|
|
|
test(StdIO.c)
|
|
|
|
set_tests_properties(StdIO PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
|
|
|
|
2017-10-07 00:03:37 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
|
|
|
|
add_application(Segments Segment1.c Segment2.c Segments.segmap Test.h Test.c)
|
|
|
|
set_target_properties(Segments PROPERTIES
|
|
|
|
LINK_FLAGS "-Wl,-gc-sections -Wl,--mac-segments -Wl,${CMAKE_CURRENT_SOURCE_DIR}/Segments.segmap")
|
|
|
|
add_test(NAME Segments COMMAND ${LAUNCH_APPL}
|
|
|
|
-e ${RETRO68_LAUNCH_METHOD} ${RETRO68_TEST_CONFIG} Segments.bin)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2017-10-04 15:34:00 +00:00
|
|
|
endif() # RETRO68_LAUNCH_METHOD
|