Fixed test suite errors due to new clang -v output.
authorGreg Clayton <gclayton@apple.com>
Wed, 6 Mar 2013 02:34:51 +0000 (02:34 +0000)
committerGreg Clayton <gclayton@apple.com>
Wed, 6 Mar 2013 02:34:51 +0000 (02:34 +0000)
llvm-svn: 176546

lldb/test/lang/cpp/unique-types/TestUniqueTypes.py
lldb/test/lldbtest.py

index a1716b9..9dd6fda 100644 (file)
@@ -34,14 +34,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:
+        compiler = self.getCompiler()
+        compiler_basename = os.path.basename(compiler)
+        if "clang" in compiler_basename 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)
 
         # 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
+        locs = 2 if "gcc" in compiler_basename 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)
index e62b2b7..f29d947 100644 (file)
@@ -1024,11 +1024,7 @@ class Base(unittest2.TestCase):
         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", "LLVM", "gcc"]:
-              if c in compiler:
-                  compiler_shortname = c
-            m = re.search('%s version ([0-9\.]+)' % compiler_shortname, line)
+            m = re.search('version ([0-9\.]+)', line)
             if m:
                 version = m.group(1)
         return version