[Lldb-commits] [lldb] r187802 - Allow building test suite with non-default libc++

Daniel Malea daniel.malea at intel.com
Tue Aug 6 08:02:34 PDT 2013


Author: dmalea
Date: Tue Aug  6 10:02:32 2013
New Revision: 187802

URL: http://llvm.org/viewvc/llvm-project?rev=187802&view=rev
Log:
Allow building test suite with non-default libc++
- add new "--libcxx" parameter to dotest.py to specify path to custom libc++


Modified:
    lldb/trunk/test/dotest.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=187802&r1=187801&r2=187802&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Tue Aug  6 10:02:32 2013
@@ -454,6 +454,7 @@ def parseOptionsAndInitTestdirs():
     group.add_argument('-c', metavar='config-file', help='Read a config file specified after this option')  # FIXME: additional doc.
     group.add_argument('--framework', metavar='framework-path', help='The path to LLDB.framework')
     group.add_argument('--executable', metavar='executable-path', help='The path to the lldb executable')
+    group.add_argument('--libcxx', metavar='directory', help='The path to custom libc++ library')
     group.add_argument('-e', metavar='benchmark-exe', help='Specify the full path of an executable used for benchmark purposes (see also: -x)')
     group.add_argument('-k', metavar='command', action='append', help="Specify a runhook, which is an lldb command to be executed by the debugger; The option can occur multiple times. The commands are executed one after the other to bring the debugger to a desired state, so that, for example, further benchmarking can be done")
     group.add_argument('-R', metavar='dir', help='Specify a directory to relocate the tests and their intermediate files to. BE WARNED THAT the directory, if exists, will be deleted before running this test driver. No cleanup of intermediate test files is performed in this case')
@@ -605,6 +606,9 @@ def parseOptionsAndInitTestdirs():
     if args.executable:
         lldbExecutablePath = args.executable
 
+    if args.libcxx:
+        os.environ["LIBCXX_PATH"] = args.libcxx
+
     if args.n:
         noHeaders = True
 

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=187802&r1=187801&r2=187802&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Tue Aug  6 10:02:32 2013
@@ -821,6 +821,11 @@ class Base(unittest2.TestCase):
         #import traceback
         #traceback.print_stack()
 
+        if "LIBCXX_PATH" in os.environ:
+            self.libcxxPath = os.environ["LIBCXX_PATH"]
+        else:
+            self.libcxxPath = None
+
         if "LLDB_EXEC" in os.environ:
             self.lldbExec = os.environ["LLDB_EXEC"]
         else:
@@ -1360,11 +1365,24 @@ class Base(unittest2.TestCase):
         if not module.buildDwarf(self, architecture, compiler, dictionary, clean):
             raise Exception("Don't know how to build binary with dwarf")
 
-    def getBuildFlags(self, use_cpp11=True, use_pthreads=True):
+    def getBuildFlags(self, use_cpp11=True, use_libcxx=False, use_libstdcxx=False, use_pthreads=True):
         """ Returns a dictionary (which can be provided to build* functions above) which
             contains OS-specific build flags.
         """
         cflags = ""
+
+        # On Mac OS X, unless specifically requested to use libstdc++, use libc++
+        if not use_libstdcxx and sys.platform.startswith('darwin'):
+            use_libcxx = True
+
+        if use_libcxx and self.libcxxPath:
+            cflags += "-stdlib=libc++ "
+            if self.libcxxPath:
+                libcxxInclude = os.path.join(self.libcxxPath, "include")
+                libcxxLib = os.path.join(self.libcxxPath, "lib")
+                if os.path.isdir(libcxxInclude) and os.path.isdir(libcxxLib):
+                    cflags += "-nostdinc++ -I%s -L%s -Wl,-rpath,%s " % (libcxxInclude, libcxxLib, libcxxLib)
+
         if use_cpp11:
             cflags += "-std="
             if "gcc" in self.getCompiler() and "4.6" in self.getCompilerVersion():





More information about the lldb-commits mailing list