Hi clayborg, tfiala, vharron,

This will ease llgs development a bit by not requiring an lldb/lldb.py build to 
launch the tests. Also, we can now use LLDB_DEBUGSERVER_PATH to point to a 
debug server to use to run the tests. I used that to point to a ds2 build and 
run llgs tests against ds2.

http://reviews.llvm.org/D6554

Files:
  test/dotest.py
  test/tools/lldb-gdbserver/lldbgdbserverutils.py
Index: test/dotest.py
===================================================================
--- test/dotest.py
+++ test/dotest.py
@@ -941,13 +941,13 @@
 
     lldbExec = None
     lldbMiExec = None
+    lldbHere = None
     if lldbExecutablePath:
         if is_exe(lldbExecutablePath):
             lldbExec = lldbExecutablePath
             lldbHere = lldbExec
         else:
-            print lldbExecutablePath + " is not an executable"
-            sys.exit(-1)
+            print lldbExecutablePath + " is not an executable, lldb tests will fail."
     else:
         # First, you can define an environment variable LLDB_EXEC specifying the
         # full pathname of the lldb executable.
@@ -967,7 +967,6 @@
         baiExec2 = os.path.join(base, *(xcode4_build_dir + bai + executable))
     
         # The 'lldb' executable built here in the source tree.
-        lldbHere = None
         if is_exe(dbgExec):
             lldbHere = dbgExec
         elif is_exe(dbgExec2):
@@ -1094,24 +1093,24 @@
 
         if not lldbPath:
             print 'This script requires lldb.py to be in either ' + dbgPath + ',',
-            print relPath + ', or ' + baiPath
-            sys.exit(-1)
+            print relPath + ', or ' + baiPath + '. Some tests might fail.'
 
-    # Some of the code that uses this path assumes it hasn't resolved the Versions... link.  
-    # If the path we've constructed looks like that, then we'll strip out the Versions/A part.
-    (before, frameWithVersion, after) = lldbPath.rpartition("LLDB.framework/Versions/A")
-    if frameWithVersion != "" :
-        lldbPath = before + "LLDB.framework" + after
+    if lldbPath:
+        # Some of the code that uses this path assumes it hasn't resolved the Versions... link.  
+        # If the path we've constructed looks like that, then we'll strip out the Versions/A part.
+        (before, frameWithVersion, after) = lldbPath.rpartition("LLDB.framework/Versions/A")
+        if frameWithVersion != "" :
+            lldbPath = before + "LLDB.framework" + after
 
-    lldbPath = os.path.abspath(lldbPath)
+        lldbPath = os.path.abspath(lldbPath)
 
-    # If tests need to find LLDB_FRAMEWORK, now they can do it
-    os.environ["LLDB_FRAMEWORK"] = os.path.dirname(os.path.dirname(lldbPath))
+        # If tests need to find LLDB_FRAMEWORK, now they can do it
+        os.environ["LLDB_FRAMEWORK"] = os.path.dirname(os.path.dirname(lldbPath))
 
-    # This is to locate the lldb.py module.  Insert it right after sys.path[0].
-    sys.path[1:1] = [lldbPath]
-    if dumpSysPath:
-        print "sys.path:", sys.path
+        # This is to locate the lldb.py module.  Insert it right after sys.path[0].
+        sys.path[1:1] = [lldbPath]
+        if dumpSysPath:
+            print "sys.path:", sys.path
 
 def visit(prefix, dir, names):
     """Visitor function for os.path.walk(path, visit, arg)."""
Index: test/tools/lldb-gdbserver/lldbgdbserverutils.py
===================================================================
--- test/tools/lldb-gdbserver/lldbgdbserverutils.py
+++ test/tools/lldb-gdbserver/lldbgdbserverutils.py
@@ -56,24 +56,34 @@
         A path to the lldb-gdbserver exe if it is found to exist; otherwise,
         returns None.
     """
-    lldb_exe = os.environ["LLDB_EXEC"]
-    if not lldb_exe:
-        return None
+    if "LLDB_DEBUGSERVER_PATH" in os.environ:
+        return os.environ["LLDB_DEBUGSERVER_PATH"]
+    elif "LLDB_EXEC" in os.environ:
+        lldb_exe = os.environ["LLDB_EXEC"]
+        if not lldb_exe:
+            return None
+        else:
+            return _get_debug_monitor_from_lldb(lldb_exe, "lldb-gdbserver")
     else:
-        return _get_debug_monitor_from_lldb(lldb_exe, "lldb-gdbserver")
+        return None
 
 def get_debugserver_exe():
     """Return the debugserver exe path.
 
     Returns:
         A path to the debugserver exe if it is found to exist; otherwise,
         returns None.
     """
-    lldb_exe = os.environ["LLDB_EXEC"]
-    if not lldb_exe:
-        return None
+    if "LLDB_DEBUGSERVER_PATH" in os.environ:
+        return os.environ["LLDB_DEBUGSERVER_PATH"]
+    elif "LLDB_EXEC" in os.environ:
+        lldb_exe = os.environ["LLDB_EXEC"]
+        if not lldb_exe:
+            return None
+        else:
+            return _get_debug_monitor_from_lldb(lldb_exe, "debugserver")
     else:
-        return _get_debug_monitor_from_lldb(lldb_exe, "debugserver")
+        return None
 
 
 _LOG_LINE_REGEX = re.compile(r'^(lldb-gdbserver|debugserver)\s+<\s*(\d+)>' +
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to