]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
make gdb skip expected
authorBenjamin Peterson <benjamin@python.org>
Fri, 29 Oct 2010 21:31:35 +0000 (21:31 +0000)
committerBenjamin Peterson <benjamin@python.org>
Fri, 29 Oct 2010 21:31:35 +0000 (21:31 +0000)
Lib/test/regrtest.py
Lib/test/support.py
Lib/test/test_gdb.py

index 300cf3932e64b26e6e9c92d37a8749a8952352d2..c487d29ccd5e52a5a7ac303d97630dbeec5a6924 100755 (executable)
@@ -1449,6 +1449,9 @@ class _ExpectedSkips:
             if sys.platform != 'sunos5':
                 self.expected.add('test_nis')
 
+            if support.python_is_optimized():
+                self.expected.add("test_gdb")
+
             self.valid = True
 
     def isvalid(self):
index 31528a9492ec5ec1e378a3b1de17387939f72ee3..132bc562f6eecde82318f03f0f407c65229cc9b3 100644 (file)
@@ -20,6 +20,9 @@ import re
 import subprocess
 import imp
 import time
+import sysconfig
+
+
 try:
     import _thread
 except ImportError:
@@ -885,6 +888,16 @@ def 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
 # it afterwards.
index bac8d36c18ee6a89f1afcbab111681d00f3285d5..55597cead66a3854c619b1683e4108a37119085b 100644 (file)
@@ -9,9 +9,8 @@ import subprocess
 import sys
 import unittest
 import locale
-import sysconfig
 
-from test.support import run_unittest, findfile
+from test.support import run_unittest, findfile, python_is_optimized
 
 try:
     gdb_version, _ = subprocess.Popen(["gdb", "--version"],
@@ -665,15 +664,8 @@ class PyLocalsTests(DebuggerTests):
                                     r".*\na = 1\nb = 2\nc = 3\n.*")
 
 def test_main():
-    cflags = sysconfig.get_config_vars()['PY_CFLAGS']
-    final_opt = ""
-    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")
-
+    if python_is_optimized():
+        raise unittest.SkipTest("Python was compiled with optimizations")
     run_unittest(PrettyPrintTests,
                  PyListTests,
                  StackNavigationTests,