Add initial NetBSD support in lldbsuite/test/lldbtest.py
authorKamil Rytarowski <n54@gmx.com>
Mon, 7 Dec 2015 21:25:57 +0000 (21:25 +0000)
committerKamil Rytarowski <n54@gmx.com>
Mon, 7 Dec 2015 21:25:57 +0000 (21:25 +0000)
Summary:
Add new functions:

  - expectedFailureNetBSD()
  - expectedFlakeyNetBSD()
  - skipIfNetBSD()

Add new NetBSD entry in:

  - getPlatform()
  - getHostPlatform()

Assume that libc++ is installed and use the GNU toolchain

Reviewers: joerg, emaste, tfiala, clayborg

Subscribers: lldb-commits

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

llvm-svn: 254948

lldb/packages/Python/lldbsuite/test/lldbtest.py

index 8e648eb..bd2dceb 100644 (file)
@@ -740,6 +740,9 @@ def expectedFailureFreeBSD(bugnumber=None, compilers=None, debug_info=None):
 def expectedFailureLinux(bugnumber=None, compilers=None, debug_info=None):
     return expectedFailureOS(['linux'], bugnumber, compilers, debug_info=debug_info)
 
+def expectedFailureNetBSD(bugnumber=None, compilers=None, debug_info=None):
+    return expectedFailureOS(['netbsd'], bugnumber, compilers, debug_info=debug_info)
+
 def expectedFailureWindows(bugnumber=None, compilers=None, debug_info=None):
     return expectedFailureOS(['windows'], bugnumber, compilers, debug_info=debug_info)
 
@@ -826,11 +829,14 @@ def expectedFlakeyDarwin(bugnumber=None, compilers=None):
     # For legacy reasons, we support both "darwin" and "macosx" as OS X triples.
     return expectedFlakeyOS(getDarwinOSTriples(), bugnumber, compilers)
 
+def expectedFlakeyFreeBSD(bugnumber=None, compilers=None):
+    return expectedFlakeyOS(['freebsd'], bugnumber, compilers)
+
 def expectedFlakeyLinux(bugnumber=None, compilers=None):
     return expectedFlakeyOS(['linux'], bugnumber, compilers)
 
-def expectedFlakeyFreeBSD(bugnumber=None, compilers=None):
-    return expectedFlakeyOS(['freebsd'], bugnumber, compilers)
+def expectedFlakeyNetBSD(bugnumber=None, compilers=None):
+    return expectedFlakeyOS(['netbsd'], bugnumber, compilers)
 
 def expectedFlakeyCompiler(compiler, compiler_version=None, bugnumber=None):
     if compiler_version is None:
@@ -927,6 +933,10 @@ def skipIfFreeBSD(func):
     """Decorate the item to skip tests that should be skipped on FreeBSD."""
     return skipIfPlatform(["freebsd"])(func)
 
+def skipIfNetBSD(func):
+    """Decorate the item to skip tests that should be skipped on NetBSD."""
+    return skipIfPlatform(["netbsd"])(func)
+
 def getDarwinOSTriples():
     return ['darwin', 'macosx', 'ios']
 
@@ -996,6 +1006,8 @@ def getPlatform():
     platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
     if platform.startswith('freebsd'):
         platform = 'freebsd'
+    elif platform.startswith('netbsd'):
+        platform = 'netbsd'
     return platform
 
 def getHostPlatform():
@@ -1009,6 +1021,8 @@ def getHostPlatform():
         return 'darwin'
     elif sys.platform.startswith('freebsd'):
         return 'freebsd'
+    elif sys.platform.startswith('netbsd'):
+        return 'netbsd'
     else:
         return sys.platform
 
@@ -1311,7 +1325,7 @@ class Base(unittest2.TestCase):
         # Set platform context.
         if platformIsDarwin():
             cls.platformContext = _PlatformContext('DYLD_LIBRARY_PATH', 'lib', 'dylib')
-        elif getPlatform() == "linux" or getPlatform() == "freebsd":
+        elif getPlatform() in ("freebsd", "linux", "netbsd"):
             cls.platformContext = _PlatformContext('LD_LIBRARY_PATH', 'lib', 'so')
         else:
             cls.platformContext = None
@@ -2063,7 +2077,7 @@ class Base(unittest2.TestCase):
         """ Returns the proper -stdlib flag, or empty if not required."""
         if self.platformIsDarwin() or self.getPlatform() == "freebsd":
             stdlibflag = "-stdlib=libc++"
-        else:
+        else: # this includes NetBSD
             stdlibflag = ""
         return stdlibflag
 
@@ -2238,6 +2252,8 @@ class Base(unittest2.TestCase):
                 cflags += "c++11"
         if self.platformIsDarwin() or self.getPlatform() == "freebsd":
             cflags += " -stdlib=libc++"
+        elif self.getPlatform() == "netbsd":
+            cflags += " -stdlib=libstdc++"
         elif "clang" in self.getCompiler():
             cflags += " -stdlib=libstdc++"
 
@@ -2269,7 +2285,7 @@ class Base(unittest2.TestCase):
             return lib_dir
 
     def getLibcPlusPlusLibs(self):
-        if self.getPlatform() == 'freebsd' or self.getPlatform() == 'linux':
+        if self.getPlatform() in ('freebsd', 'linux', 'netbsd'):
             return ['libc++.so.1']
         else:
             return ['libc++.1.dylib','libc++abi.dylib']