summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_faulthandler.py
diff options
context:
space:
mode:
authorXavier de Gaye <xdegaye@users.sourceforge.net>2016-11-13 19:46:46 (GMT)
committerXavier de Gaye <xdegaye@users.sourceforge.net>2016-11-13 19:46:46 (GMT)
commit6c5f21945ad03e1e66328286965219b890eca848 (patch)
tree1b1ce0522804c12718c15d0188c5ab47ac0642cf /Lib/test/test_faulthandler.py
parentf056b04eea2363309990916e653704a4c6c10b81 (diff)
downloadcpython-6c5f21945ad03e1e66328286965219b890eca848.zip
cpython-6c5f21945ad03e1e66328286965219b890eca848.tar.gz
cpython-6c5f21945ad03e1e66328286965219b890eca848.tar.bz2
Fix test_faulthandler on Android where raise() exits with 0
Diffstat (limited to 'Lib/test/test_faulthandler.py')
-rw-r--r--Lib/test/test_faulthandler.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
index 22ccbc9..bdd8d1a 100644
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -7,7 +7,7 @@ import signal
import subprocess
import sys
from test import support
-from test.support import script_helper
+from test.support import script_helper, is_android, requires_android_level
import tempfile
import unittest
from textwrap import dedent
@@ -42,6 +42,10 @@ 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):
"""
@@ -141,6 +145,7 @@ class FaultHandlerTests(unittest.TestCase):
3,
'access violation')
+ @requires_raise
def test_sigsegv(self):
self.check_fatal_error("""
import faulthandler
@@ -183,6 +188,7 @@ class FaultHandlerTests(unittest.TestCase):
@unittest.skipIf(_testcapi is None, 'need _testcapi')
@unittest.skipUnless(hasattr(signal, 'SIGBUS'), 'need signal.SIGBUS')
+ @requires_raise
def test_sigbus(self):
self.check_fatal_error("""
import _testcapi
@@ -197,6 +203,7 @@ class FaultHandlerTests(unittest.TestCase):
@unittest.skipIf(_testcapi is None, 'need _testcapi')
@unittest.skipUnless(hasattr(signal, 'SIGILL'), 'need signal.SIGILL')
+ @requires_raise
def test_sigill(self):
self.check_fatal_error("""
import _testcapi
@@ -240,6 +247,7 @@ class FaultHandlerTests(unittest.TestCase):
'(?:Segmentation fault|Bus error)',
other_regex='unable to raise a stack overflow')
+ @requires_raise
def test_gil_released(self):
self.check_fatal_error("""
import faulthandler
@@ -249,6 +257,7 @@ class FaultHandlerTests(unittest.TestCase):
3,
'Segmentation fault')
+ @requires_raise
def test_enable_file(self):
with temporary_filename() as filename:
self.check_fatal_error("""
@@ -263,6 +272,7 @@ class FaultHandlerTests(unittest.TestCase):
@unittest.skipIf(sys.platform == "win32",
"subprocess doesn't support pass_fds on Windows")
+ @requires_raise
def test_enable_fd(self):
with tempfile.TemporaryFile('wb+') as fp:
fd = fp.fileno()
@@ -276,6 +286,7 @@ class FaultHandlerTests(unittest.TestCase):
'Segmentation fault',
fd=fd)
+ @requires_raise
def test_enable_single_thread(self):
self.check_fatal_error("""
import faulthandler
@@ -286,6 +297,7 @@ class FaultHandlerTests(unittest.TestCase):
'Segmentation fault',
all_threads=False)
+ @requires_raise
def test_disable(self):
code = """
import faulthandler