10000 gh-114099 - Add iOS testbed, plus Makefile target to invoke it. by freakboy3742 · Pull Request #115930 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-114099 - Add iOS testbed, plus Makefile target to invoke it. #115930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplify testing executable.
  • Loading branch information
freakboy3742 committed Feb 28, 2024
commit 392c00674c79c751738e20026528bec7c3080022
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ iOS/testbed/Python.xcframework/ios-*/bin
iOS/testbed/Python.xcframework/ios-*/include
iOS/testbed/Python.xcframework/ios-*/lib
iOS/testbed/Python.xcframework/ios-*/Python.framework
iOS/testbed/iOSTestbed/iOSTestbed-Info.plist
iOS/testbed/iOSTestbed.xcodeproj/project.xcworkspace
iOS/testbed/iOSTestbed.xcodeproj/xcuserdata
iOS/testbed/iOSTestbed.xcodeproj/xcshareddata
Expand Down
3 changes: 0 additions & 3 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,6 @@ AC_ARG_ENABLE([framework],
RESSRCDIR=iOS/Resources

AC_CONFIG_FILES([iOS/Resources/Info.plist])
AC_CONFIG_FILES([iOS/testbed/iOSTestbed/iOSTestbed-Info.plist])
;;
*)
AC_MSG_ERROR([Unknown platform for framework build])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@VERSION@</string>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
20 changes: 2 additions & 18 deletions iOS/testbed/iOSTestbedTests/iOSTestbedTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ - (void)testPython {
// will be handled as if it were an argument to `python -m test`
const char *argv[] = {
"iOSTestbed", // argv[0] is the process that is running.
"-uall,-gui,-curses", // Enable most resources; GUI and curses tests won't work on iOS
"-uall", // Enable all resources
"-v", // run in verbose mode so we get test failure information
// To run a subset of tests, add the test names below; e.g.,
// "test_os",
Expand All @@ -27,16 +27,12 @@ - (void)testPython {
PyPreConfig preconfig;
PyConfig config;
NSString *python_home;
NSString *path;
wchar_t *wtmp_str;

NSString *resourcePath = [[NSBundle mainBundle] resourcePath];

// Extract Python version from bundle
NSString *py_version_string = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];

// Generate an isolated Python configuration.
NSLog(@"Configuring isolated Python %@...", py_version_string);
NSLog(@"Configuring isolated Python...");
PyPreConfig_InitIsolatedConfig(&preconfig);
PyConfig_InitIsolatedConfig(&config);

Expand Down Expand Up @@ -74,18 +70,6 @@ - (void)testPython {
}
PyMem_RawFree(wtmp_str);

// Set the stdlib location for the Python interpreter
path = [NSString stringWithFormat:@"%@/python/lib/python%@", resourcePath, py_version_string, nil];
NSLog(@"Stdlib dir: %@", path);
wtmp_str = Py_DecodeLocale([path UTF8String], NULL);
status = PyConfig_SetString(&config, &config.stdlib_dir, wtmp_str);
if (PyStatus_Exception(status)) {
XCTFail(@"Unable to set stdlib dir: %s", status.err_msg);
PyConfig_Clear(&config);
return;
}
PyMem_RawFree(wtmp_str);

// Read the site config
status = PyConfig_Read(&config);
if (PyStatus_Exception(status)) {
Expand Down
0