gh-114099 - Add iOS testbed, plus Makefile target to invoke it.#115930
Merged
ned-deily merged 12 commits intopython:mainfrom Mar 7, 2024
Merged
gh-114099 - Add iOS testbed, plus Makefile target to invoke it.#115930ned-deily merged 12 commits intopython:mainfrom
ned-deily merged 12 commits intopython:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the PEP 730 work to add iOS support.
This PR adds an iOS testbed project, plus the Makefile target to support running it from the command line. It is the last of the code that was originally submitted as #115063.
The bulk of the PR is an iOS Xcode project;
open iOS/testbed/iOSTestbed.xcodeprojfrom the command line will open the project in Xcode. The project itself is a bare stub app with no UI, and an XCTest test suite that contains 1 test - "run the CPython test suite"; the XCTest passes or fails depending on the overall success or failure of the CPython test suite.Most of the project files are as generated by the new project wizard; differences of note include:
iOS/testbed/iOSTestbed/main.mmarks some signals as ignored that the CPython test suite exercises, but iOS doesn't like to be unhandled.iOS/testbed/iOSTestbedTests/iOSTestbedTests.mis an Xcode test suite with a single test that initialises a CPython interpreter and runs thetestmodule. Command line options need to be passed in by modifying theargvarray at the start of the file, as there's no real analog for a test suite command line (at least, not that I've found)Enable Testabilityhas been set toYes; this prevents stripping of binaries in release configurations. This is required because an iOS app may not link against symbols, but it will use them.User Script Sandboxinghas been set toNo. This allows the post-processing scripts to modify and sign framework binaries.There are 2 other changes:
frameworkinstallmobileheaderstarget; I discovered that parallelmake installbuilds would fail because it would try to correct the header install before actually installing the headers.Running the test suite
As of this PR, it is possible to build CPython as a framework, and start the test suite.
The new Makefile target is
make testios. This target will run the test suite on an iPhone SE 3rd edition; this is a simulator that is reliably available, as it's a model that doesn't get updated all that often.Running the testbed requires that an iOS framework build for a simulator target has been compiled and installed into the stub Python.xcframework folder that the testbed project contains. The minimum invocation for running the test suite is:
(adjusting as necessary to point to a appropriate build-python). A cold start of the iOS simulator takes 2-3 minutes, and for most of that time, the simulator appears to be doing nothing. Don't be alarmed when the console output for the test run says
Testing startedand then appears to do nothing for a long time. If you're running the test suite from inside Xcode, it's a lot faster once the simulator is warm.However, if you invoke this target, the test suite will currently fail because it can't find binary modules at runtime. Correcting this will be the subject of the next PR.