diff -r 805467de22fc Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py Sun Nov 06 13:19:38 2016 +0200 +++ b/Lib/test/support/__init__.py Sun Nov 06 16:08:40 2016 +0100 @@ -92,7 +92,8 @@ "anticipate_failure", "load_package_tests", "detect_api_mismatch", "check__all__", # sys - "is_jython", "is_android", "check_impl_detail", "unix_shell", + "is_jython", "android_api_level", "is_android", "check_impl_detail", + "unix_shell", # network "HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource", # processes @@ -735,7 +736,8 @@ is_jython = sys.platform.startswith('java') -is_android = bool(sysconfig.get_config_var('ANDROID_API_LEVEL')) +android_api_level = sysconfig.get_config_var('ANDROID_API_LEVEL') +is_android = (android_api_level > 0) if sys.platform != 'win32': unix_shell = '/system/bin/sh' if is_android else '/bin/sh' diff -r 805467de22fc Lib/test/test_faulthandler.py --- a/Lib/test/test_faulthandler.py Sun Nov 06 13:19:38 2016 +0200 +++ b/Lib/test/test_faulthandler.py Sun Nov 06 16:08:40 2016 +0100 @@ -7,7 +7,7 @@ import subprocess import sys from test import support -from test.support import script_helper +from test.support import script_helper, is_android, android_api_level import tempfile import unittest from textwrap import dedent @@ -141,6 +141,9 @@ 3, 'access violation') + @unittest.skipIf(is_android and android_api_level < 24, + "raise() is buggy at Android API level %d" % + android_api_level) def test_sigsegv(self): self.check_fatal_error(""" import faulthandler @@ -183,6 +186,9 @@ @unittest.skipIf(_testcapi is None, 'need _testcapi') @unittest.skipUnless(hasattr(signal, 'SIGBUS'), 'need signal.SIGBUS') + @unittest.skipIf(is_android and android_api_level < 24, + "raise() is buggy at Android API level %d" % + android_api_level) def test_sigbus(self): self.check_fatal_error(""" import _testcapi @@ -197,6 +203,9 @@ @unittest.skipIf(_testcapi is None, 'need _testcapi') @unittest.skipUnless(hasattr(signal, 'SIGILL'), 'need signal.SIGILL') + @unittest.skipIf(is_android and android_api_level < 24, + "raise() is buggy at Android API level %d" % + android_api_level) def test_sigill(self): self.check_fatal_error(""" import _testcapi @@ -240,6 +249,9 @@ '(?:Segmentation fault|Bus error)', other_regex='unable to raise a stack overflow') + @unittest.skipIf(is_android and android_api_level < 24, + "raise() is buggy at Android API level %d" % + android_api_level) def test_gil_released(self): self.check_fatal_error(""" import faulthandler @@ -255,10 +267,12 @@ import faulthandler output = open({filename}, 'wb') faulthandler.enable(output) - faulthandler._sigsegv() + faulthandler._read_null() """.format(filename=repr(filename)), 4, - 'Segmentation fault', + '(?:Segmentation fault' + '|Bus error' + '|Illegal instruction)', filename=filename) @unittest.skipIf(sys.platform == "win32", @@ -270,20 +284,24 @@ import faulthandler import sys faulthandler.enable(%s) - faulthandler._sigsegv() + faulthandler._read_null() """ % fd, 4, - 'Segmentation fault', + '(?:Segmentation fault' + '|Bus error' + '|Illegal instruction)', fd=fd) def test_enable_single_thread(self): self.check_fatal_error(""" import faulthandler faulthandler.enable(all_threads=False) - faulthandler._sigsegv() + faulthandler._read_null() """, 3, - 'Segmentation fault', + '(?:Segmentation fault' + '|Bus error' + '|Illegal instruction)', all_threads=False) def test_disable(self): @@ -291,7 +309,7 @@ import faulthandler faulthandler.enable() faulthandler.disable() - faulthandler._sigsegv() + faulthandler._read_null() """ not_expected = 'Fatal Python error' stderr, exitcode = self.get_output(code)