mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
make gdb skip expected
This commit is contained in:
parent
9f5db07dab
commit
65c66ab255
3 changed files with 19 additions and 11 deletions
|
|
@ -1449,6 +1449,9 @@ class _ExpectedSkips:
|
||||||
if sys.platform != 'sunos5':
|
if sys.platform != 'sunos5':
|
||||||
self.expected.add('test_nis')
|
self.expected.add('test_nis')
|
||||||
|
|
||||||
|
if support.python_is_optimized():
|
||||||
|
self.expected.add("test_gdb")
|
||||||
|
|
||||||
self.valid = True
|
self.valid = True
|
||||||
|
|
||||||
def isvalid(self):
|
def isvalid(self):
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import imp
|
import imp
|
||||||
import time
|
import time
|
||||||
|
import sysconfig
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import _thread
|
import _thread
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
@ -885,6 +888,16 @@ def gc_collect():
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
|
|
||||||
|
def python_is_optimized():
|
||||||
|
"""Find if Python was built with optimizations."""
|
||||||
|
cflags = sysconfig.get_config_vars()['PY_CFLAGS']
|
||||||
|
final_opt = ""
|
||||||
|
for opt in cflags.split():
|
||||||
|
if opt.startswith('-O'):
|
||||||
|
final_opt = opt
|
||||||
|
return final_opt and final_opt != '-O0'
|
||||||
|
|
||||||
|
|
||||||
#=======================================================================
|
#=======================================================================
|
||||||
# Decorator for running a function in a different locale, correctly resetting
|
# Decorator for running a function in a different locale, correctly resetting
|
||||||
# it afterwards.
|
# it afterwards.
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,8 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
import locale
|
import locale
|
||||||
import sysconfig
|
|
||||||
|
|
||||||
from test.support import run_unittest, findfile
|
from test.support import run_unittest, findfile, python_is_optimized
|
||||||
|
|
||||||
try:
|
try:
|
||||||
gdb_version, _ = subprocess.Popen(["gdb", "--version"],
|
gdb_version, _ = subprocess.Popen(["gdb", "--version"],
|
||||||
|
|
@ -665,15 +664,8 @@ class PyLocalsTests(DebuggerTests):
|
||||||
r".*\na = 1\nb = 2\nc = 3\n.*")
|
r".*\na = 1\nb = 2\nc = 3\n.*")
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
cflags = sysconfig.get_config_vars()['PY_CFLAGS']
|
if python_is_optimized():
|
||||||
final_opt = ""
|
raise unittest.SkipTest("Python was compiled with optimizations")
|
||||||
for opt in cflags.split():
|
|
||||||
if opt.startswith('-O'):
|
|
||||||
final_opt = opt
|
|
||||||
if final_opt and final_opt != '-O0':
|
|
||||||
raise unittest.SkipTest("Python was built with compiler optimizations, "
|
|
||||||
"tests can't reliably succeed")
|
|
||||||
|
|
||||||
run_unittest(PrettyPrintTests,
|
run_unittest(PrettyPrintTests,
|
||||||
PyListTests,
|
PyListTests,
|
||||||
StackNavigationTests,
|
StackNavigationTests,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue