Skip to content

Commit a4f3336

Browse files
[3.15] gh-148508: Add another common pattern for iOS SSL failures to test_ssl (GH-150442) (#150697)
gh-148508: Add another common pattern for iOS SSL failures to test_ssl (GH-150442) Match also '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'. (cherry picked from commit 540b3d0) Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
1 parent a4781e6 commit a4f3336

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

Lib/test/test_ssl.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5642,17 +5642,24 @@ def non_linux_skip_if_other_okay_error(self, err):
56425642
return # Expect the full test setup to always work on Linux.
56435643
if (isinstance(err, ConnectionResetError) or
56445644
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
5645-
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I) or
5646-
re.search('record.layer.failure', str(getattr(err, "reason", "")), re.I)
5645+
re.search(
5646+
# Matches the following error messages:
5647+
# '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'
5648+
# '[SSL: RECORD_LAYER_FAILURE] record layer failure (_ssl.c:1109)'
5649+
# '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'
5650+
r'wrong.version.number|record.layer.failure|http.request',
5651+
str(getattr(err, "reason", "")),
5652+
re.IGNORECASE,
5653+
)
56475654
):
56485655
# On Windows the TCP RST leads to a ConnectionResetError
56495656
# (ECONNRESET) which Linux doesn't appear to surface to userspace.
56505657
# If wrap_socket() winds up on the "if connected:" path and doing
56515658
# the actual wrapping... we get an SSLError from OpenSSL. This is
56525659
# typically WRONG_VERSION_NUMBER. The same happens on iOS, but
5653-
# RECORD_LAYER_FAILURE is the error.
5660+
# RECORD_LAYER_FAILURE or HTTP_REQUEST is the error.
56545661
#
5655-
# While appropriate, neither is the scenario we're specifically
5662+
# While appropriate, these scenarios aren't what we're specifically
56565663
# trying to test. The way this test is written is known to work on
56575664
# Linux. We'll skip it anywhere else that it does not present as
56585665
# doing so.

Platforms/Apple/testbed/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
LOG_PREFIX_REGEX = re.compile(
2222
r"^\d{4}-\d{2}-\d{2}" # YYYY-MM-DD
2323
r"\s+\d+:\d{2}:\d{2}\.\d+\+\d{4}" # HH:MM:SS.ssssss+ZZZZ
24-
r"\s+iOSTestbed\[\d+:\w+\]" # Process/thread ID
24+
r"\s+iOSTestbed\[\d+:\w+\] " # Process/thread ID
2525
)
2626

2727

0 commit comments

Comments
 (0)