[Lldb-commits] [lldb] r232019 - Add lldb-mi/lldb-server test folders to PATH before in dotest.py

Ilia K ki.stfu at gmail.com
Thu Mar 12 00:32:33 PDT 2015


Author: ki.stfu
Date: Thu Mar 12 02:32:32 2015
New Revision: 232019

URL: http://llvm.org/viewvc/llvm-project?rev=232019&view=rev
Log:
Add lldb-mi/lldb-server test folders to PATH before in dotest.py

Summary:
This patch allows not specify search path in each lldb-mi test. It makes tests easier.

This fix was requested by vharron.

All test pass on OS X.

Reviewers: vharron, clayborg

Subscribers: lldb-commits, vharron

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

Modified:
    lldb/trunk/test/dotest.py
    lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py
    lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
    lldb/trunk/test/tools/lldb-mi/data/TestMiData.py
    lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py
    lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py
    lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
    lldb/trunk/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
    lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py
    lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py
    lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
    lldb/trunk/test/tools/lldb-server/commandline/TestStubReverseConnect.py
    lldb/trunk/test/tools/lldb-server/commandline/TestStubSetSID.py
    lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
    lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py
    lldb/trunk/test/tools/lldb-server/test/test_lldbgdbserverutils.py

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Thu Mar 12 02:32:32 2015
@@ -932,14 +932,20 @@ def setupSysPath():
 
     pluginPath = os.path.join(scriptPath, 'plugins')
     pexpectPath = os.path.join(scriptPath, 'pexpect-2.4')
+    toolsLLDBMIPath = os.path.join(scriptPath, 'tools', 'lldb-mi')
+    toolsLLDBServerPath = os.path.join(scriptPath, 'tools', 'lldb-server')
 
     # Put embedded pexpect at front of the load path so we ensure we
     # use that version.
     sys.path.insert(0, pexpectPath)
 
-    # Append script dir and plugin dir to the sys.path.
+    # Append script dir, plugin dir, lldb-mi dir and lldb-server dir to the sys.path.
     sys.path.append(scriptPath)
     sys.path.append(pluginPath)
+    sys.path.append(toolsLLDBMIPath)     # Adding test/tools/lldb-mi to the path makes it easy
+                                         # to "import lldbmi_testcase" from the MI tests
+    sys.path.append(toolsLLDBServerPath) # Adding test/tools/lldb-server to the path makes it easy
+                                         # to "import lldbgdbserverutils" from the lldb-server tests
 
     # This is our base name component.
     base = os.path.abspath(os.path.join(scriptPath, os.pardir))

Modified: lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py (original)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py Thu Mar 12 02:32:32 2015
@@ -2,10 +2,6 @@
 Test lldb-mi -break-xxx commands.
 """
 
-# adjust path for lldbmi_testcase.py
-import sys, os.path
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
 import lldbmi_testcase
 from lldbtest import *
 import unittest2

Modified: lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py Thu Mar 12 02:32:32 2015
@@ -2,10 +2,6 @@
 Test lldb-mi -exec-xxx commands.
 """
 
-# adjust path for lldbmi_testcase.py
-import sys, os.path
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
 import lldbmi_testcase
 from lldbtest import *
 import unittest2

Modified: lldb/trunk/test/tools/lldb-mi/data/TestMiData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/data/TestMiData.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/data/TestMiData.py (original)
+++ lldb/trunk/test/tools/lldb-mi/data/TestMiData.py Thu Mar 12 02:32:32 2015
@@ -2,10 +2,6 @@
 Test lldb-mi -data-xxx commands.
 """
 
-# adjust path for lldbmi_testcase.py
-import sys, os.path
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
 import lldbmi_testcase
 from lldbtest import *
 import unittest2

Modified: lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py Thu Mar 12 02:32:32 2015
@@ -2,10 +2,6 @@
 Test lldb-mi -interpreter-exec command.
 """
 
-# adjust path for lldbmi_testcase.py
-import sys, os.path
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
 import lldbmi_testcase
 from lldbtest import *
 import unittest2

Modified: lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py (original)
+++ lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py Thu Mar 12 02:32:32 2015
@@ -2,10 +2,6 @@
 Test that the lldb-mi handles signals properly.
 """
 
-# adjust path for lldbmi_testcase.py
-import sys, os.path
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
 import lldbmi_testcase
 from lldbtest import *
 import unittest2
@@ -90,7 +86,6 @@ class MiSignalTestCase(lldbmi_testcase.M
         """Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (remote)."""
 
         # Prepare debugserver
-        sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "lldb-server")))
         import lldbgdbserverutils
         debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
         if not debugserver_exe:
@@ -167,7 +162,6 @@ class MiSignalTestCase(lldbmi_testcase.M
         """Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (remote)."""
 
         # Prepare debugserver
-        sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "lldb-server")))
         import lldbgdbserverutils
         debugserver_exe = lldbgdbserverutils.get_debugserver_exe()
         if not debugserver_exe:

Modified: lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py (original)
+++ lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py Thu Mar 12 02:32:32 2015
@@ -2,10 +2,6 @@
 Test lldb-mi -stack-xxx commands.
 """
 
-# adjust path for lldbmi_testcase.py
-import sys, os.path
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
 import lldbmi_testcase
 from lldbtest import *
 import unittest2

Modified: lldb/trunk/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py (original)
+++ lldb/trunk/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py Thu Mar 12 02:32:32 2015
@@ -2,10 +2,6 @@
 Test lldb-mi startup options.
 """
 
-# adjust path for lldbmi_testcase.py
-import sys, os.path
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
 import lldbmi_testcase
 from lldbtest import *
 import unittest2

Modified: lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py (original)
+++ lldb/trunk/test/tools/lldb-mi/symbol/TestMiSymbol.py Thu Mar 12 02:32:32 2015
@@ -2,10 +2,6 @@
 Test lldb-mi -symbol-xxx commands.
 """
 
-# adjust path for lldbmi_testcase.py
-import sys, os.path
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
 import lldbmi_testcase
 from lldbtest import *
 import unittest2

Modified: lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py (original)
+++ lldb/trunk/test/tools/lldb-mi/syntax/TestMiSyntax.py Thu Mar 12 02:32:32 2015
@@ -2,10 +2,6 @@
 Test that the lldb-mi driver understands MI command syntax.
 """
 
-# adjust path for lldbmi_testcase.py
-import sys, os.path
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
 import lldbmi_testcase
 from lldbtest import *
 import unittest2

Modified: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py (original)
+++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py Thu Mar 12 02:32:32 2015
@@ -2,10 +2,6 @@
 Test lldb-mi -var-xxx commands.
 """
 
-# adjust path for lldbmi_testcase.py
-import sys, os.path
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
 import lldbmi_testcase
 from lldbtest import *
 import unittest2

Modified: lldb/trunk/test/tools/lldb-server/commandline/TestStubReverseConnect.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/commandline/TestStubReverseConnect.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/commandline/TestStubReverseConnect.py (original)
+++ lldb/trunk/test/tools/lldb-server/commandline/TestStubReverseConnect.py Thu Mar 12 02:32:32 2015
@@ -1,9 +1,3 @@
-# Add the directory above ours to the python library path since we
-# will import from there.
-import os.path
-import sys
-sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
-
 import gdbremote_testcase
 import lldbgdbserverutils
 import re

Modified: lldb/trunk/test/tools/lldb-server/commandline/TestStubSetSID.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/commandline/TestStubSetSID.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/commandline/TestStubSetSID.py (original)
+++ lldb/trunk/test/tools/lldb-server/commandline/TestStubSetSID.py Thu Mar 12 02:32:32 2015
@@ -1,11 +1,5 @@
 import unittest2
 
-# Add the directory above ours to the python library path since we
-# will import from there.
-import os.path
-import sys
-sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
-
 import gdbremote_testcase
 import lldbgdbserverutils
 import os

Modified: lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py (original)
+++ lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py Thu Mar 12 02:32:32 2015
@@ -1,11 +1,5 @@
 import unittest2
 
-# Add the directory above ours to the python library path since we
-# will import from there.
-import os.path
-import sys
-sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
-
 import gdbremote_testcase
 import signal
 from lldbtest import *

Modified: lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py (original)
+++ lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py Thu Mar 12 02:32:32 2015
@@ -1,11 +1,5 @@
 import unittest2
 
-# Add the directory above ours to the python library path since we
-# will import from there.
-import os.path
-import sys
-sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
-
 import gdbremote_testcase
 import signal
 from lldbtest import *

Modified: lldb/trunk/test/tools/lldb-server/test/test_lldbgdbserverutils.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/test/test_lldbgdbserverutils.py?rev=232019&r1=232018&r2=232019&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/test/test_lldbgdbserverutils.py (original)
+++ lldb/trunk/test/tools/lldb-server/test/test_lldbgdbserverutils.py Thu Mar 12 02:32:32 2015
@@ -2,12 +2,8 @@ import os.path
 import re
 import sys
 
-# adjust path for embedded unittest2
-sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..'))
 import unittest2
 
-# adjust path for lldbgdbserverutils.py
-sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
 from lldbgdbserverutils import *
 
 





More information about the lldb-commits mailing list