[Lldb-commits] [lldb] r176190 - Cleanup TestUniqueTypes.py and add getCompilerVersion() to test harness
Daniel Malea
daniel.malea at intel.com
Wed Feb 27 09:29:46 PST 2013
Author: dmalea
Date: Wed Feb 27 11:29:46 2013
New Revision: 176190
URL: http://llvm.org/viewvc/llvm-project?rev=176190&view=rev
Log:
Cleanup TestUniqueTypes.py and add getCompilerVersion() to test harness
- pull up logic to get compiler version from TestUniqueTypes.py into lldbtest.py
- work around an GCC 4.6.3 issue
Modified:
lldb/trunk/test/lang/cpp/unique-types/TestUniqueTypes.py
lldb/trunk/test/lldbtest.py
Modified: lldb/trunk/test/lang/cpp/unique-types/TestUniqueTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/unique-types/TestUniqueTypes.py?rev=176190&r1=176189&r2=176190&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/unique-types/TestUniqueTypes.py (original)
+++ lldb/trunk/test/lang/cpp/unique-types/TestUniqueTypes.py Wed Feb 27 11:29:46 2013
@@ -33,10 +33,16 @@ class UniqueTypesTestCase(TestBase):
def unique_types(self):
"""Test for unique types of std::vector<long> and std::vector<short>."""
+
+ if "clang" in self.getCompiler() and int(self.getCompilerVersion().split('.')[0]) < 3:
+ self.skipTest("rdar://problem/9173060 lldb hangs while running unique-types for clang version < 3")
+
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ # GCC 4.6.3 (but not 4.4, 4.6.5 or 4.7) encodes two locations for the 'return 0' statement in main.cpp
+ locs = 2 if "gcc" in self.getCompiler() and "4.6.3" in self.getCompilerVersion() else 1
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=locs, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -45,19 +51,6 @@ class UniqueTypesTestCase(TestBase):
substrs = ['stopped',
'stop reason = breakpoint'])
- if self.getCompiler().endswith('clang'):
- import re
- clang_version_output = system([lldbutil.which(self.getCompiler()), "-v"])[1]
- #print "my output:", clang_version_output
- for line in clang_version_output.split(os.linesep):
- m = re.search('clang version ([0-9]+)\.', line)
- #print "line:", line
- if m:
- clang_version = int(m.group(1))
- #print "clang version:", clang_version
- if clang_version < 3:
- self.skipTest("rdar://problem/9173060 lldb hangs while running unique-types for clang version < 3")
-
# Do a "frame variable --show-types longs" and verify "long" is in each line of output.
self.runCmd("frame variable --show-types longs")
output = self.res.GetOutput()
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=176190&r1=176189&r2=176190&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Wed Feb 27 11:29:46 2013
@@ -531,7 +531,7 @@ def skipOnLinux(func):
def skipIfGcc(func):
"""Decorate the item to skip tests that should be skipped if building with gcc ."""
if isinstance(func, type) and issubclass(func, unittest2.TestCase):
- raise Exception("@skipOnLinux can only be used to decorate a test method")
+ raise Exception("@skipIfGcc can only be used to decorate a test method")
@wraps(func)
def wrapper(*args, **kwargs):
from unittest2 import case
@@ -543,7 +543,6 @@ def skipIfGcc(func):
func(*args, **kwargs)
return wrapper
-
class Base(unittest2.TestCase):
"""
Abstract base for performing lldb (see TestBase) or other generic tests (see
@@ -1015,6 +1014,25 @@ class Base(unittest2.TestCase):
module = builder_module()
return module.getCompiler()
+ def getCompilerVersion(self):
+ """ Returns a string that represents the compiler version.
+ Supports: llvm, clang.
+ """
+ from lldbutil import which
+ version = 'unknown'
+
+ compiler = self.getCompiler()
+ version_output = system([which(compiler), "-v"])[1]
+ for line in version_output.split(os.linesep):
+ compiler_shortname = 'invalid'
+ for c in ["clang", "gcc"]:
+ if c in compiler:
+ compiler_shortname = c
+ m = re.search('%s version ([0-9\.]+)' % compiler_shortname, line)
+ if m:
+ version = m.group(1)
+ return version
+
def getRunOptions(self):
"""Command line option for -A and -C to run this test again, called from
self.dumpSessionInfo()."""
More information about the lldb-commits
mailing list