Skip to content

Commit

Permalink
Modify iOS output filters to allow for .dylib extensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Sep 5, 2023
1 parent fc4efc8 commit 8510bf9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/briefcase/platforms/iOS/xcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,8 @@ def run_app(
"--predicate",
f'senderImagePath ENDSWITH "/{app.formal_name}"'
f' OR (processImagePath ENDSWITH "/{app.formal_name}"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down
2 changes: 1 addition & 1 deletion src/briefcase/platforms/macOS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

MACOS_LOG_PREFIX_REGEX = re.compile(
r"\d{4}-\d{2}-\d{2} (?P<timestamp>\d{2}:\d{2}:\d{2}.\d{3}) Df (.*?)\[.*?:.*?\]"
r"(?P<subsystem>( \(libffi\.dylib\))|( \(_ctypes\.cpython-3\d{1,2}-.*?\.so\)))? (?P<content>.*)"
r"(?P<subsystem>( \(libffi\.dylib\))|( \(_ctypes\.cpython-3\d{1,2}-.*?\.(so|dylib)\)))? (?P<content>.*)"
)

ADHOC_IDENTITY_NAME = (
Expand Down
30 changes: 20 additions & 10 deletions tests/platforms/iOS/xcode/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ def test_run_app_simulator_booted(run_command, first_app_config, tmp_path):
"--predicate",
'senderImagePath ENDSWITH "/First App"'
' OR (processImagePath ENDSWITH "/First App"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -292,7 +293,8 @@ def test_run_app_simulator_booted_underscore(
"--predicate",
'senderImagePath ENDSWITH "/First App"'
' OR (processImagePath ENDSWITH "/First App"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -411,7 +413,8 @@ def test_run_app_with_passthrough(run_command, first_app_config, tmp_path):
"--predicate",
'senderImagePath ENDSWITH "/First App"'
' OR (processImagePath ENDSWITH "/First App"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -532,7 +535,8 @@ def test_run_app_simulator_shut_down(run_command, first_app_config, tmp_path):
"--predicate",
'senderImagePath ENDSWITH "/First App"'
' OR (processImagePath ENDSWITH "/First App"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -666,7 +670,8 @@ def test_run_app_simulator_shutting_down(run_command, first_app_config, tmp_path
"--predicate",
'senderImagePath ENDSWITH "/First App"'
' OR (processImagePath ENDSWITH "/First App"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -1027,7 +1032,8 @@ def test_run_app_simulator_launch_failure(run_command, first_app_config, tmp_pat
"--predicate",
'senderImagePath ENDSWITH "/First App"'
' OR (processImagePath ENDSWITH "/First App"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -1146,7 +1152,8 @@ def test_run_app_simulator_no_pid(run_command, first_app_config, tmp_path):
"--predicate",
'senderImagePath ENDSWITH "/First App"'
' OR (processImagePath ENDSWITH "/First App"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -1267,7 +1274,8 @@ def test_run_app_simulator_non_integer_pid(run_command, first_app_config, tmp_pa
"--predicate",
'senderImagePath ENDSWITH "/First App"'
' OR (processImagePath ENDSWITH "/First App"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -1362,7 +1370,8 @@ def test_run_app_test_mode(run_command, first_app_config, tmp_path):
"--predicate",
'senderImagePath ENDSWITH "/First App"'
' OR (processImagePath ENDSWITH "/First App"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -1471,7 +1480,8 @@ def test_run_app_test_mode_with_passthrough(run_command, first_app_config, tmp_p
"--predicate",
'senderImagePath ENDSWITH "/First App"'
' OR (processImagePath ENDSWITH "/First App"'
' AND senderImagePath ENDSWITH "-iphonesimulator.so")',
' AND (senderImagePath ENDSWITH "-iphonesimulator.so"'
' OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))',
],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down
31 changes: 28 additions & 3 deletions tests/platforms/macOS/test_macOS_log_clean_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
(
'Filtering the log data using "senderImagePath ENDSWITH "/Toga Test!" '
'OR (processImagePath ENDSWITH "/Toga Test!" '
'AND senderImagePath ENDSWITH "-iphonesimulator.so")"',
'AND (senderImagePath ENDSWITH "-iphonesimulator.so" '
'OR senderImagePath ENDSWITH "-iphonesimulator.dylib"))"',
None,
),
# Startup log
Expand All @@ -49,7 +50,7 @@
"2022-11-14 13:21:15.341 Df My App[59972:780a15] (libffi.dylib) ",
("", True),
),
# macOS App log
# iOS App log (old style .so libraries)
(
"2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.so) Hello World!",
("Hello World!", True),
Expand All @@ -58,7 +59,16 @@
"2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-38-iphonesimulator.so) Hello World!",
("Hello World!", True),
),
# Empty macOS App log
# iOS App log
(
"2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.dylib) Hello World!",
("Hello World!", True),
),
(
"2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-38-iphonesimulator.dylib) Hello World!",
("Hello World!", True),
),
# Empty iOS App log (old style .so binaries)
(
"2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.so) ",
("", True),
Expand All @@ -67,6 +77,15 @@
"2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-38-iphonesimulator.so) ",
("", True),
),
# Empty iOS App log
(
"2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.dylib) ",
("", True),
),
(
"2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-38-iphonesimulator.dylib) ",
("", True),
),
# Unknown content
(
"This doesn't match the regex",
Expand All @@ -83,6 +102,12 @@
"A problem (foo.so) try to avoid it",
("A problem (foo.so) try to avoid it", True),
),
# Log content that contains `.dylib`
(
"2022-11-14 13:21:15.341 Df My App[59972:780a15] (_ctypes.cpython-312-iphonesimulator.dylib) "
"A problem (foo.dylib) try to avoid it",
("A problem (foo.dylib) try to avoid it", True),
),
],
)
def test_filter(original, filtered):
Expand Down

0 comments on commit 8510bf9

Please sign in to comment.