[Lldb-commits] [lldb] r225549 - Modify dotest.py to be able to run without an lldb build.

Stephane Sezer sas at cd80.net
Fri Jan 9 13:54:28 PST 2015


Author: sas
Date: Fri Jan  9 15:54:27 2015
New Revision: 225549

URL: http://llvm.org/viewvc/llvm-project?rev=225549&view=rev
Log:
Modify dotest.py to be able to run without an lldb build.

Summary: 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.

Reviewers: clayborg, tfiala, vharron

Subscribers: lldb-commits

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

Modified:
    lldb/trunk/test/dotest.py
    lldb/trunk/test/tools/lldb-gdbserver/lldbgdbserverutils.py

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=225549&r1=225548&r2=225549&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Fri Jan  9 15:54:27 2015
@@ -949,13 +949,13 @@ def setupSysPath():
 
     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.
@@ -975,7 +975,6 @@ def setupSysPath():
         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):
@@ -1102,24 +1101,24 @@ def setupSysPath():
 
         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
-
-    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))
-
-    # 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
+    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)
+
+        # 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
 
 def visit(prefix, dir, names):
     """Visitor function for os.path.walk(path, visit, arg)."""

Modified: lldb/trunk/test/tools/lldb-gdbserver/lldbgdbserverutils.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-gdbserver/lldbgdbserverutils.py?rev=225549&r1=225548&r2=225549&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-gdbserver/lldbgdbserverutils.py (original)
+++ lldb/trunk/test/tools/lldb-gdbserver/lldbgdbserverutils.py Fri Jan  9 15:54:27 2015
@@ -56,11 +56,16 @@ def get_lldb_gdbserver_exe():
         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.
@@ -69,11 +74,16 @@ def get_debugserver_exe():
         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+)>' +





More information about the lldb-commits mailing list