diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -146,6 +146,20 @@ elif lldb_repro_mode == 'replay': config.available_features.add('lldb-repro-replay') +lldb_use_simulator = lit_config.params.get('lldb-run-with-simulator', None) +if lldb_use_simulator: + if lldb_use_simulator == "ios": + lit_config.note("Running API tests on iOS simulator") + config.available_features.add('lldb-simulator-ios') + elif lldb_use_simulator == "watchos": + lit_config.note("Running API tests on watchOS simulator") + config.available_features.add('lldb-simulator-watchos') + elif lldb_use_simulator == "tvos": + lit_config.note("Running API tests on tvOS simulator") + config.available_features.add('lldb-simulator-tvos') + else: + lit_config.error("Unknown simulator id '{}'".format(lldb_use_simulator)) + # Set a default per-test timeout of 10 minutes. Setting a timeout per test # requires that killProcessAndChildren() is supported on the platform and # lit complains if the value is set but it is not supported. @@ -216,6 +230,16 @@ 'lldb-repro-replay' in config.available_features: dotest_cmd += ['--skip-category=lldb-vscode', '--skip-category=std-module'] +if 'lldb-simulator-ios' in config.available_features: + dotest_cmd += ['--apple-sdk', 'iphonesimulator', + '--platform-name', 'ios-simulator'] +elif 'lldb-simulator-watchos' in config.available_features: + dotest_cmd += ['--apple-sdk', 'watchsimulator', + '--platform-name', 'watchos-simulator'] +elif 'lldb-simulator-tvos' in config.available_features: + dotest_cmd += ['--apple-sdk', 'appletvsimulator', + '--platform-name', 'tvos-simulator'] + if is_configured('enabled_plugins'): for plugin in config.enabled_plugins: dotest_cmd += ['--enable-plugin', plugin] diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -214,6 +214,29 @@ DEPENDS lldb-test-deps) add_dependencies(check-lldb-reproducers check-lldb-reproducers-capture) +# Targets for running the test suite on the different Apple simulators. +add_lit_testsuite(check-lldb-simulator-ios + "Running lldb test suite on the iOS simulator" + ${CMAKE_CURRENT_BINARY_DIR}/API + PARAMS "lldb-run-with-simulator=ios" + EXCLUDE_FROM_CHECK_ALL + DEPENDS lldb-test-deps) + +add_lit_testsuite(check-lldb-simulator-watchos + "Running lldb test suite on the watchOS simulator" + ${CMAKE_CURRENT_BINARY_DIR}/API + PARAMS "lldb-run-with-simulator=watchos" + EXCLUDE_FROM_CHECK_ALL + DEPENDS lldb-test-deps) + +add_lit_testsuite(check-lldb-simulator-tvos + "Running lldb test suite on the tvOS simulator" + ${CMAKE_CURRENT_BINARY_DIR}/API + PARAMS "lldb-run-with-simulator=tvos" + EXCLUDE_FROM_CHECK_ALL + DEPENDS lldb-test-deps) + + if(LLDB_BUILT_STANDALONE) # This has to happen *AFTER* add_lit_testsuite. if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/llvm-lit)