-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
bpo-32138: Skip on Android test_faulthandler tests that raise SIGSEGV #4604
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| import subprocess | ||
| import sys | ||
| from test import support | ||
| from test.support import script_helper, is_android, requires_android_level | ||
| from test.support import script_helper, is_android | ||
| import tempfile | ||
| import threading | ||
| import unittest | ||
|
|
@@ -29,6 +29,11 @@ def expected_traceback(lineno1, lineno2, header, min_count=1): | |
| else: | ||
| return '^' + regex + '$' | ||
|
|
||
| def skip_segfault_on_android(test): | ||
| # Issue #32138: Raising SIGSEGV on Android may not cause a crash. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfect, thank you :-) |
||
| return unittest.skipIf(is_android, | ||
| 'raising SIGSEGV on Android is unreliable')(test) | ||
|
|
||
| @contextmanager | ||
| def temporary_filename(): | ||
| filename = tempfile.mktemp() | ||
|
|
@@ -37,10 +42,6 @@ def temporary_filename(): | |
| finally: | ||
| support.unlink(filename) | ||
|
|
||
| def requires_raise(test): | ||
| return (test if not is_android else | ||
| requires_android_level(24, 'raise() is buggy')(test)) | ||
|
|
||
| class FaultHandlerTests(unittest.TestCase): | ||
| def get_output(self, code, filename=None, fd=None): | ||
| """ | ||
|
|
@@ -140,7 +141,7 @@ def test_read_null(self): | |
| 3, | ||
| 'access violation') | ||
|
|
||
| @requires_raise | ||
| @skip_segfault_on_android | ||
| def test_sigsegv(self): | ||
| self.check_fatal_error(""" | ||
| import faulthandler | ||
|
|
@@ -182,7 +183,7 @@ def test_sigfpe(self): | |
|
|
||
| @unittest.skipIf(_testcapi is None, 'need _testcapi') | ||
| @unittest.skipUnless(hasattr(signal, 'SIGBUS'), 'need signal.SIGBUS') | ||
| @requires_raise | ||
| @skip_segfault_on_android | ||
| def test_sigbus(self): | ||
| self.check_fatal_error(""" | ||
| import _testcapi | ||
|
|
@@ -197,7 +198,7 @@ def test_sigbus(self): | |
|
|
||
| @unittest.skipIf(_testcapi is None, 'need _testcapi') | ||
| @unittest.skipUnless(hasattr(signal, 'SIGILL'), 'need signal.SIGILL') | ||
| @requires_raise | ||
| @skip_segfault_on_android | ||
| def test_sigill(self): | ||
| self.check_fatal_error(""" | ||
| import _testcapi | ||
|
|
@@ -241,7 +242,7 @@ def test_stack_overflow(self): | |
| '(?:Segmentation fault|Bus error)', | ||
| other_regex='unable to raise a stack overflow') | ||
|
|
||
| @requires_raise | ||
| @skip_segfault_on_android | ||
| def test_gil_released(self): | ||
| self.check_fatal_error(""" | ||
| import faulthandler | ||
|
|
@@ -251,7 +252,7 @@ def test_gil_released(self): | |
| 3, | ||
| 'Segmentation fault') | ||
|
|
||
| @requires_raise | ||
| @skip_segfault_on_android | ||
| def test_enable_file(self): | ||
| with temporary_filename() as filename: | ||
| self.check_fatal_error(""" | ||
|
|
@@ -266,7 +267,7 @@ def test_enable_file(self): | |
|
|
||
| @unittest.skipIf(sys.platform == "win32", | ||
| "subprocess doesn't support pass_fds on Windows") | ||
| @requires_raise | ||
| @skip_segfault_on_android | ||
| def test_enable_fd(self): | ||
| with tempfile.TemporaryFile('wb+') as fp: | ||
| fd = fp.fileno() | ||
|
|
@@ -280,7 +281,7 @@ def test_enable_fd(self): | |
| 'Segmentation fault', | ||
| fd=fd) | ||
|
|
||
| @requires_raise | ||
| @skip_segfault_on_android | ||
| def test_enable_single_thread(self): | ||
| self.check_fatal_error(""" | ||
| import faulthandler | ||
|
|
@@ -291,7 +292,7 @@ def test_enable_single_thread(self): | |
| 'Segmentation fault', | ||
| all_threads=False) | ||
|
|
||
| @requires_raise | ||
| @skip_segfault_on_android | ||
| def test_disable(self): | ||
| code = """ | ||
| import faulthandler | ||
|
|
||
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Tests/2017-11-27-16-18-58.bpo-32138.QsTvf-.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Skip on Android test_faulthandler tests that raise SIGSEGV and remove the | ||
| test.support.requires_android_level decorator. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to keep it. I'm in touch with a developer who wants to support older Android versions, and in the future, we may have to use it again for features only working on newer Android versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not to clutter
test.supportwith dead code and it is easy to restorerequires_android_levelwithgit show <sha1> | git apply -R.