AutomatedTests: set defaults for RETRO68_LAUNCH_METHOD on old Mac OS X platforms, where "classic" and "carbon" are the obvious choices

This commit is contained in:
Wolfgang Thaller 2017-10-04 17:34:00 +02:00
parent d8ad527e0f
commit d4f3670056
4 changed files with 63 additions and 13 deletions

View File

@ -1,10 +1,32 @@
enable_testing()
cmake_minimum_required(VERSION 3.3)
set(RETRO68_LAUNCH_METHOD classic CACHE String "How to launch Mac applications (for automated testing)")
set(RETRO68_TEST_CONFIG "--timeout=4")
find_program(LAUNCH_APPL LaunchAPPL PATH "${CMAKE_INSTALL_PREFIX}/../bin/")
execute_process(COMMAND ${LAUNCH_APPL} --list-emulators
OUTPUT_VARIABLE EMULATOR_LIST)
separate_arguments(EMULATOR_LIST)
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()
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()
function(test FILE)
get_filename_component(NAME ${FILE} NAME_WE)
@ -13,7 +35,7 @@ function(test FILE)
-e ${RETRO68_LAUNCH_METHOD} ${RETRO68_TEST_CONFIG} ${ARGN} ${NAME}.bin)
endfunction()
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
if(CMAKE_SYSTEM_NAME MATCHES "Retro68")
test(ReallyEmpty.c)
set_target_properties(ReallyEmpty PROPERTIES LINK_FLAGS "-Wl,-gc-sections -Wl,--mac-single")
endif()
@ -36,3 +58,4 @@ set_tests_properties(Log PROPERTIES PASS_REGULAR_EXPRESSION "One\nTwo\nThree")
test(Init.cc)
set_tests_properties(Init PROPERTIES PASS_REGULAR_EXPRESSION "constructor\nmain\ndestructor")
endif() # RETRO68_LAUNCH_METHOD

View File

@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with Retro68. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.3)
project(Retro)
set(CMAKE_CXX_STANDARD 11)

View File

@ -102,6 +102,7 @@ int main(int argc, char *argv[])
desc.add_options()
("help,h", "show this help message")
("list-emulators,l", "get the list of available, fully configured emulators/environments")
("make-executable,x", po::value<std::string>(), "make a MacBinary file executable")
;
po::options_description configdesc;
@ -159,18 +160,43 @@ int main(int argc, char *argv[])
po::notify(options);
if(options.count("help") || (!options.count("application") && !options.count("make-executable")))
vector<string> commandModes = {"application", "help", "make-executable", "list-emulators"};
int nModes = 0;
string mode;
for(string aMode : commandModes)
{
if(options.count(aMode))
{
nModes++;
mode = aMode;
}
}
if(nModes > 1)
{
std::cerr << "Need to specify either an application file or exactly one of ";
for(int i = 1, n = commandModes.size(); i < n-1; i++)
std::cerr << "--" << commandModes[i] << ", ";
std::cerr << "or " << commandModes.back() << "." << std::endl << std::endl;
usage();
return 1;
}
if(mode == "" || mode == "help")
{
usage();
return 0;
}
if(options.count("make-executable"))
else if(mode == "make-executable")
{
string fn = options["make-executable"].as<std::string>();
MakeExecutable(fn);
if(!options.count("application"))
return 0;
}
else if(mode == "list-emulators")
{
for(LaunchMethod *method : launchMethods)
if(method->CheckOptions(options))
std::cout << method->GetName() << std::endl;
return 0;
}

View File

@ -113,7 +113,8 @@ Sample programs are built in several formats:
Look under `Retro68-build/build-target/` (68K),
`Retro68-build/build-target-ppc/` (PowerPC Classic) and
`Retro68-build/build-target-carbon/` (PowerPC Carbon) for the compiled examples.
`Retro68-build/build-target-carbon/` (PowerPC Carbon) for the compiled examples,
especially under the `Samples` subdirectory.
Components
----------