Index: test/lldbtest.py =================================================================== --- test/lldbtest.py +++ test/lldbtest.py @@ -684,11 +684,20 @@ return skipUnlessPlatform(getDarwinOSTriples())(func) def getPlatform(): + """Returns the 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 platformIsLinux(): + """Returns true if the OS triple for the selected platform is any valid apple OS""" + return getPlatform() == "linux" + def skipIfPlatform(oslist): """Decorate the item to skip tests if running on one of the listed platforms.""" return unittest2.skipIf(getPlatform() in oslist, @@ -849,9 +858,9 @@ 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 platformIsLinux() or getPlatform() == 'freebsd': cls.platformContext = _PlatformContext('LD_LIBRARY_PATH', 'lib', 'so') else: cls.platformContext = None @@ -1383,13 +1392,11 @@ 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() + return platformIsDarwin() 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 platformIsLinux() def getPlatform(self): """Returns the platform the test suite is running on."""