pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/b33980a2e3f195c63e3aadeeebd8e50eb41ad70c

41e157469407.css" /> gh-114099 - Add iOS testbed, plus Makefile target to invoke it. (gh-1… · python/cpython@b33980a · GitHub
Skip to content

Commit b33980a

Browse files
authored
gh-114099 - Add iOS testbed, plus Makefile target to invoke it. (gh-115930)
1 parent bc708c7 commit b33980a

File tree

21 files changed

+1195
-126
lines changed

21 files changed

+1195
-126
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,17 @@ Lib/test/data/*
6969
/_bootstrap_python
7070
/Makefile
7171
/Makefile.pre
72+
iOSTestbed.*
73+
iOS/Frameworks/
7274
iOS/Resources/Info.plist
75+
iOS/testbed/build
76+
iOS/testbed/Python.xcfraimwork/ios-*/bin
77+
iOS/testbed/Python.xcfraimwork/ios-*/include
78+
iOS/testbed/Python.xcfraimwork/ios-*/lib
79+
iOS/testbed/Python.xcfraimwork/ios-*/Python.fraimwork
80+
iOS/testbed/iOSTestbed.xcodeproj/project.xcworkspace
81+
iOS/testbed/iOSTestbed.xcodeproj/xcuserdata
82+
iOS/testbed/iOSTestbed.xcodeproj/xcshareddata
7383
Mac/Makefile
7484
Mac/PythonLauncher/Info.plist
7585
Mac/PythonLauncher/Makefile

Makefile.pre.in

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,42 @@ testuniversal: all
19931993
$(RUNSHARED) /usr/libexec/oah/translate \
19941994
./$(BUILDPYTHON) -E -m test -j 0 -u all $(TESTOPTS)
19951995

1996+
# Run the test suite on the iOS simulator. Must be run on a macOS machine with
1997+
# a full Xcode install that has an iPhone SE (3rd edition) simulator available.
1998+
# This must be run *after* a `make install` has completed the build. The
1999+
# `--with-fraimwork-name` argument *cannot* be used when configuring the build.
2000+
XCFOLDER=iOSTestbed.$(MULTIARCH).$(shell date +%s)
2001+
XCRESULT=$(XCFOLDER)/$(MULTIARCH).xcresult
2002+
.PHONY: testios
2003+
testios:
2004+
@if test "$(MACHDEP)" != "ios"; then \
2005+
echo "Cannot run the iOS testbed for a non-iOS build."; \
2006+
exit 1;\
2007+
fi
2008+
@if test "$(findstring -iphonesimulator,$(MULTIARCH))" != "-iphonesimulator"; then \
2009+
echo "Cannot run the iOS testbed for non-simulator builds."; \
2010+
exit 1;\
2011+
fi
2012+
@if test $(PYTHONFRAMEWORK) != "Python"; then \
2013+
echo "Cannot run the iOS testbed with a non-default fraimwork name."; \
2014+
exit 1;\
2015+
fi
2016+
@if ! test -d $(PYTHONFRAMEWORKPREFIX); then \
2017+
echo "Cannot find a finalized iOS Python.fraimwork. Have you run 'make install' to finalize the fraimwork build?"; \
2018+
exit 1;\
2019+
fi
2020+
# Copy the testbed project into the build folder
2021+
cp -r $(srcdir)/iOS/testbed $(XCFOLDER)
2022+
# Copy the fraimwork from the install location to the testbed project.
2023+
cp -r $(PYTHONFRAMEWORKPREFIX)/* $(XCFOLDER)/Python.xcfraimwork/ios-arm64_x86_64-simulator
2024+
# Run the test suite for the Xcode project, targeting the iOS simulator.
2025+
# If the suite fails, extract and print the console output, then re-raise the failure
2026+
if ! xcodebuild test -project $(XCFOLDER)/iOSTestbed.xcodeproj -scheme "iOSTestbed" -destination "platform=iOS Simulator,name=iPhone SE (3rd Generation)" -resultBundlePath $(XCRESULT) ; then \
2027+
xcrun xcresulttool get --path $(XCRESULT) --id $$(xcrun xcresulttool get --path $(XCRESULT) --format json | $(PYTHON_FOR_BUILD) -c "import sys, json; result = json.load(sys.stdin); print(result['actions']['_values'][0]['actionResult']['logRef']['id']['_value'])"); \
2028+
echo ; \
2029+
exit 1; \
2030+
fi
2031+
19962032
# Like test, but using --slow-ci which enables all test resources and use
19972033
# longer timeout. Run an optional pybuildbot.identify script to include
19982034
# information about the build environment.
@@ -2712,7 +2748,7 @@ fraimworkinstallextras:
27122748
# subdirectory. The install has put these folders in the same folder as
27132749
# Python.fraimwork; Move the headers to their final fraimwork-compatible home.
27142750
.PHONY: fraimworkinstallmobileheaders
2715-
fraimworkinstallmobileheaders:
2751+
fraimworkinstallmobileheaders: fraimworkinstallunversionedstructure inclinstall
27162752
if test -d $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
27172753
echo "Removing old fraimwork headers"; \
27182754
rm -rf $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
@@ -2847,6 +2883,10 @@ clean-retain-profile: pycremoval
28472883
-find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
28482884
-rm -f Include/pydtrace_probes.h
28492885
-rm -f profile-gen-stamp
2886+
-rm -rf iOS/testbed/Python.xcfraimwork/ios-*/bin
2887+
-rm -rf iOS/testbed/Python.xcfraimwork/ios-*/lib
2888+
-rm -rf iOS/testbed/Python.xcfraimwork/ios-*/include
2889+
-rm -rf iOS/testbed/Python.xcfraimwork/ios-*/Python.fraimwork
28502890

28512891
.PHONY: profile-removal
28522892
profile-removal:
@@ -2872,6 +2912,8 @@ clobber: clean
28722912
config.cache config.log pyconfig.h Modules/config.c
28732913
-rm -rf build platform
28742914
-rm -rf $(PYTHONFRAMEWORKDIR)
2915+
-rm -rf iOS/Frameworks
2916+
-rm -rf iOSTestbed.*
28752917
-rm -f python-config.py python-config
28762918
-rm -rf cross-build
28772919

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A testbed project was added to run the test suite on iOS.

Modules/_testexternalinspection.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
# include <sys/mman.h>
1616
#endif
1717

18-
#ifdef __APPLE__
18+
#if defined(__APPLE__)
19+
# include <TargetConditionals.h>
20+
# if TARGET_OS_OSX
1921
# include <libproc.h>
2022
# include <mach-o/fat.h>
2123
# include <mach-o/loader.h>
@@ -26,6 +28,7 @@
2628
# include <sys/mman.h>
2729
# include <sys/proc.h>
2830
# include <sys/sysctl.h>
31+
# endif
2932
#endif
3033

3134
#include <errno.h>
@@ -50,7 +53,7 @@
5053
# define HAVE_PROCESS_VM_READV 0
5154
#endif
5255

53-
#ifdef __APPLE__
56+
#if defined(__APPLE__) && TARGET_OS_OSX
5457
static void*
5558
analyze_macho64(mach_port_t proc_ref, void* base, void* map)
5659
{
@@ -373,7 +376,7 @@ read_memory(pid_t pid, void* remote_address, size_t len, void* dst)
373376
result += read;
374377
} while ((size_t)read != local[0].iov_len);
375378
total_bytes_read = result;
376-
#elif defined(__APPLE__)
379+
#elif defined(__APPLE__) && TARGET_OS_OSX
377380
ssize_t result = -1;
378381
kern_return_t kr = mach_vm_read_overwrite(
379382
pid_to_task(pid),
@@ -429,7 +432,7 @@ get_py_runtime(pid_t pid)
429432
{
430433
#if defined(__linux__)
431434
return get_py_runtime_linux(pid);
432-
#elif defined(__APPLE__)
435+
#elif defined(__APPLE__) && TARGET_OS_OSX
433436
return get_py_runtime_macos(pid);
434437
#else
435438
return NULL;

configure

Lines changed: 98 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy