[Lldb-commits] [lldb] r235164 - Uses the target platform to determine the platform context.

Robert Flack flackr at gmail.com
Fri Apr 17 01:02:18 PDT 2015


Author: flackr
Date: Fri Apr 17 03:02:18 2015
New Revision: 235164

URL: http://llvm.org/viewvc/llvm-project?rev=235164&view=rev
Log:
Uses the target platform to determine the platform context.

Uses the target platform to determine the platform context to use. This fixes an
early failure in some tests when running on a different remote target.

Test Plan:
./dotest.py $DOTEST_OPTS -t -p TestGlobalVariables.py|TestSharedLib.py
Running on macosx -> linux, this fails at a later stage in the test - rather
than in registerSharedLibrariesWithTarget looking for a library without the
correct "lib" prefix and ".so" suffix.

Differential Revision: http://reviews.llvm.org/D9047

Modified:
    lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py?rev=235164&r1=235163&r2=235164&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py (original)
+++ lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py Fri Apr 17 03:02:18 2015
@@ -205,7 +205,7 @@ class CrashingRecursiveInferiorTestCase(
         self.check_stop_reason()
 
         expected_state = 'exited' # Provide the exit code.
-        if self.platformIsDarwin() or self.platformIsLinux():
+        if self.platformIsDarwin() or self.getPlatform() == "linux":
             expected_state = 'stopped' # TODO: Determine why 'next' and 'continue' have no effect after a crash.
 
         self.expect("next",

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=235164&r1=235163&r2=235164&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Apr 17 03:02:18 2015
@@ -626,7 +626,7 @@ def expectedFailureWindows(bugnumber=Non
 def expectedFailureLLGS(bugnumber=None, compilers=None):
     def fn(self):
         # llgs local is only an option on Linux targets
-        if not self.platformIsLinux():
+        if self.getPlatform() != 'linux':
             return False
         self.runCmd('settings show platform.plugin.linux.use-llgs-for-local')
         return 'true' in self.res.GetOutput() and self.expectedCompiler(compilers)
@@ -703,11 +703,16 @@ def skipUnlessDarwin(func):
     return skipUnlessPlatform(getDarwinOSTriples())(func)
 
 def getPlatform():
+    """Returns the target platform the test suite is running on."""
     platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
     if platform.startswith('freebsd'):
         platform = 'freebsd'
     return platform
 
+def platformIsDarwin():
+    """Returns true if the OS triple for the selected platform is any valid apple OS"""
+    return getPlatform() in getDarwinOSTriples()
+
 def skipIfPlatform(oslist):
     """Decorate the item to skip tests if running on one of the listed platforms."""
     return unittest2.skipIf(getPlatform() in oslist,
@@ -868,9 +873,9 @@ class Base(unittest2.TestCase):
             os.chdir(os.path.join(os.environ["LLDB_TEST"], cls.mydir))
 
         # Set platform context.
-        if sys.platform.startswith('darwin'):
+        if platformIsDarwin():
             cls.platformContext = _PlatformContext('DYLD_LIBRARY_PATH', 'lib', 'dylib')
-        elif sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
+        elif getPlatform() == "linux" or getPlatform() == "freebsd":
             cls.platformContext = _PlatformContext('LD_LIBRARY_PATH', 'lib', 'so')
         else:
             cls.platformContext = None
@@ -1402,16 +1407,10 @@ class Base(unittest2.TestCase):
 
     def platformIsDarwin(self):
         """Returns true if the OS triple for the selected platform is any valid apple OS"""
-        platform_name = self.getPlatform()
-        return platform_name in getDarwinOSTriples()
-
-    def platformIsLinux(self):
-        """Returns true if the OS triple for the selected platform is any valid apple OS"""
-        platform_name = self.getPlatform()
-        return platform_name == "linux"
+        return platformIsDarwin()
 
     def getPlatform(self):
-        """Returns the platform the test suite is running on."""
+        """Returns the target platform the test suite is running on."""
         return getPlatform()
 
     def isIntelCompiler(self):





More information about the lldb-commits mailing list