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
|
2019-08-18 11:21:00 +00:00
|
|
|
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")
|
2019-08-18 11:21:00 +00:00
|
|
|
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()
|
2017-10-04 15:34:00 +00:00
|
|
|
else()
|
2019-08-18 11:21:00 +00:00
|
|
|
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()
|
2017-10-04 15:34:00 +00:00
|
|
|
endif()
|
2017-10-05 12:52:17 +00:00
|
|
|
|
2019-01-09 07:39:09 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "RetroCarbon")
|
|
|
|
set(TESTCASE_PREFIX "Carbon.")
|
|
|
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Retro68")
|
|
|
|
set(TESTCASE_PREFIX "M68K.")
|
|
|
|
elseif(CMAKE_SYSTEM_NAME MATCHES "RetroPPC")
|
|
|
|
set(TESTCASE_PREFIX "PPC.")
|
|
|
|
else()
|
|
|
|
set(TESTCASE_PREFIX)
|
|
|
|
endif()
|
|
|
|
|
2019-08-12 19:16:20 +00:00
|
|
|
set(RETRO68_TEST_CONFIG "--timeout=10" CACHE STRING "Options to pass to LaunchAPPL when running tests")
|
2017-10-04 15:34:00 +00:00
|
|
|
|
2019-01-09 07:39:09 +00:00
|
|
|
set(LAUNCH_METHOD_FLAG)
|
2017-10-04 15:34:00 +00:00
|
|
|
if(RETRO68_LAUNCH_METHOD MATCHES "NONE")
|
2019-01-09 07:39:09 +00:00
|
|
|
else()
|
2019-01-09 22:53:11 +00:00
|
|
|
set(LAUNCH_METHOD_FLAG "-e${RETRO68_LAUNCH_METHOD}")
|
2019-08-18 11:21:00 +00:00
|
|
|
endif() # RETRO68_LAUNCH_METHOD
|
2017-10-04 15:34:00 +00:00
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
|
2017-10-02 21:06:50 +00:00
|
|
|
|
2017-10-03 09:57:56 +00:00
|
|
|
function(test FILE)
|
2019-08-18 11:21:00 +00:00
|
|
|
get_filename_component(NAME ${FILE} NAME_WE)
|
2019-06-23 15:27:47 +00:00
|
|
|
add_application(${NAME} ${FILE} Test.h Test.c)
|
|
|
|
target_include_directories(${NAME} PRIVATE .)
|
2019-08-18 11:21:00 +00:00
|
|
|
add_test(NAME ${TESTCASE_PREFIX}${NAME} COMMAND ${LAUNCH_APPL}
|
2019-01-09 07:39:09 +00:00
|
|
|
${LAUNCH_METHOD_FLAG} ${RETRO68_TEST_CONFIG} ${NAME}.bin)
|
|
|
|
if(ARGN)
|
|
|
|
set_tests_properties(${TESTCASE_PREFIX}${NAME} ${ARGN})
|
|
|
|
endif()
|
2017-10-02 21:43:35 +00:00
|
|
|
endfunction()
|
|
|
|
|
2017-10-04 15:34:00 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "Retro68")
|
2019-08-18 11:21:00 +00:00
|
|
|
test(ReallyEmpty.c)
|
|
|
|
set_target_properties(ReallyEmpty PROPERTIES LINK_FLAGS "-Wl,-gc-sections -Wl,--mac-single")
|
2017-10-02 21:06:50 +00:00
|
|
|
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
|
|
|
|
2019-01-09 07:39:09 +00:00
|
|
|
test(File.c PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
2017-10-01 00:42:02 +00:00
|
|
|
|
2019-09-29 08:36:10 +00:00
|
|
|
#test(Timeout.c PROPERTIES PASS_REGULAR_EXPRESSION "One" DISABLED TRUE)
|
2017-10-03 09:57:56 +00:00
|
|
|
|
2019-01-09 07:39:09 +00:00
|
|
|
test(Log.c 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)
|
|
|
|
|
2019-01-09 07:39:09 +00:00
|
|
|
test(Init.cc PROPERTIES PASS_REGULAR_EXPRESSION "constructor\nmain\ndestructor")
|
2017-10-03 23:56:05 +00:00
|
|
|
|
2019-01-09 07:39:09 +00:00
|
|
|
test(StdIO.c PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
2017-10-08 17:28:10 +00:00
|
|
|
|
2017-10-07 00:03:37 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
|
2019-08-18 11:21:00 +00:00
|
|
|
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 ${TESTCASE_PREFIX}Segments COMMAND ${LAUNCH_APPL}
|
2019-01-09 07:39:09 +00:00
|
|
|
${LAUNCH_METHOD_FLAG} ${RETRO68_TEST_CONFIG} Segments.bin)
|
2020-12-28 18:35:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
test(PCRel32.c PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
|
|
|
target_compile_options(PCRel32 PRIVATE -march=68020)
|
2017-10-07 00:03:37 +00:00
|
|
|
endif()
|
|
|
|
|
2019-01-13 20:43:38 +00:00
|
|
|
test(Exceptions.cc PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
2019-06-23 15:27:47 +00:00
|
|
|
|
|
|
|
configure_file(PascalTrap.c PascalTrapCPP.cc)
|
|
|
|
test(PascalTrap.c PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
|
|
|
test(${CMAKE_CURRENT_BINARY_DIR}/PascalTrapCPP.cc PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|