[Lldb-commits] [lldb] r239203 - Fix TestAttachDenied and TestChangeProcessGroup for remote Windows to Android.

Chaoren Lin chaorenl at google.com
Fri Jun 5 17:25:50 PDT 2015


Author: chaoren
Date: Fri Jun  5 19:25:50 2015
New Revision: 239203

URL: http://llvm.org/viewvc/llvm-project?rev=239203&view=rev
Log:
Fix TestAttachDenied and TestChangeProcessGroup for remote Windows to Android.

Summary: Updated `append_to_remote_wd` to work for both remote and local.

Reviewers: clayborg, ovyalov

Reviewed By: ovyalov

Subscribers: tberghammer, lldb-commits

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

Modified:
    lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
    lldb/trunk/test/functionalities/process_group/TestChangeProcessGroup.py
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/lldbutil.py
    lldb/trunk/test/python_api/target/TestTargetAPI.py
    lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py
    lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py
    lldb/trunk/test/types/AbstractBase.py

Modified: lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py?rev=239203&r1=239202&r2=239203&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py (original)
+++ lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py Fri Jun  5 19:25:50 2015
@@ -28,8 +28,8 @@ class AttachDeniedTestCase(TestBase):
         exe = os.path.join(os.getcwd(), exe_name)
 
         # Use a file as a synchronization point between test and inferior.
-        pid_file_path = os.path.join(self.get_process_working_directory(),
-                                     "pid_file_%d" % (int(time.time())))
+        pid_file_path = lldbutil.append_to_process_working_directory(
+                "pid_file_%d" % (int(time.time())))
         self.addTearDownHook(lambda: self.run_platform_command("rm %s" % (pid_file_path)))
 
         # Spawn a new process

Modified: lldb/trunk/test/functionalities/process_group/TestChangeProcessGroup.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_group/TestChangeProcessGroup.py?rev=239203&r1=239202&r2=239203&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/process_group/TestChangeProcessGroup.py (original)
+++ lldb/trunk/test/functionalities/process_group/TestChangeProcessGroup.py Fri Jun  5 19:25:50 2015
@@ -42,8 +42,8 @@ class ChangeProcessGroupTestCase(TestBas
         exe = os.path.join(os.getcwd(), 'a.out')
 
         # Use a file as a synchronization point between test and inferior.
-        pid_file_path = os.path.join(self.get_process_working_directory(),
-                                     "pid_file_%d" % (int(time.time())))
+        pid_file_path = lldbutil.append_to_process_working_directory(
+                "pid_file_%d" % (int(time.time())))
         self.addTearDownHook(lambda: self.run_platform_command("rm %s" % (pid_file_path)))
 
         popen = self.spawnSubprocess(exe, [pid_file_path])

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=239203&r1=239202&r2=239203&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Jun  5 19:25:50 2015
@@ -329,7 +329,7 @@ class _RemoteProcess(_BaseProcess):
     def launch(self, executable, args):
         if self._install_remote:
             src_path = executable
-            dst_path = lldbutil.append_to_remote_wd(os.path.basename(executable))
+            dst_path = lldbutil.append_to_process_working_directory(os.path.basename(executable))
 
             dst_file_spec = lldb.SBFileSpec(dst_path, False)
             err = lldb.remote_platform.Install(lldb.SBFileSpec(src_path, True), dst_file_spec)
@@ -2196,7 +2196,7 @@ class TestBase(Base):
             if lldb.remote_platform:
                 # We must set the remote install location if we want the shared library
                 # to get uploaded to the remote target
-                remote_shlib_path = lldbutil.append_to_remote_wd(os.path.basename(local_shlib_path))
+                remote_shlib_path = lldbutil.append_to_process_working_directory(os.path.basename(local_shlib_path))
                 shlib_module.SetRemoteInstallFileSpec(lldb.SBFileSpec(remote_shlib_path, False))
 
         return environment

Modified: lldb/trunk/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=239203&r1=239202&r2=239203&view=diff
==============================================================================
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py Fri Jun  5 19:25:50 2015
@@ -920,8 +920,11 @@ def join_remote_paths(*paths):
         return os.path.join(*paths).replace(os.path.sep, '\\')
     return os.path.join(*paths).replace(os.path.sep, '/')
 
-def append_to_remote_wd(*paths):
-    return join_remote_paths(lldb.remote_platform.GetWorkingDirectory(), *paths)
+def append_to_process_working_directory(*paths):
+    remote = lldb.remote_platform
+    if remote:
+        return join_remote_paths(remote.GetWorkingDirectory(), *paths)
+    return os.path.join(os.getcwd(), *paths)
 
 # ==================================================
 # Utility functions to get the correct signal number

Modified: lldb/trunk/test/python_api/target/TestTargetAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/target/TestTargetAPI.py?rev=239203&r1=239202&r2=239203&view=diff
==============================================================================
--- lldb/trunk/test/python_api/target/TestTargetAPI.py (original)
+++ lldb/trunk/test/python_api/target/TestTargetAPI.py Fri Jun  5 19:25:50 2015
@@ -375,7 +375,7 @@ class TargetAPITestCase(TestBase):
         # The inferior should run to completion after "process.Continue()" call.
         local_path = "stdout.txt";
         if lldb.remote_platform:
-            stdout_path = lldbutil.append_to_remote_wd("lldb-stdout-redirect.txt")
+            stdout_path = lldbutil.append_to_process_working_directory("lldb-stdout-redirect.txt")
         else:
             stdout_path = local_path
         error = lldb.SBError()

Modified: lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py?rev=239203&r1=239202&r2=239203&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py (original)
+++ lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py Fri Jun  5 19:25:50 2015
@@ -95,7 +95,7 @@ class LldbGdbServerTestCase(gdbremote_te
         exe_path = os.path.abspath('a.out')
         if not lldb.remote_platform:
             return [exe_path]
-        remote_path = lldbutil.append_to_remote_wd(os.path.basename(exe_path))
+        remote_path = lldbutil.append_to_process_working_directory(os.path.basename(exe_path))
         remote_file_spec = lldb.SBFileSpec(remote_path, False)
         err = lldb.remote_platform.Install(lldb.SBFileSpec(exe_path, True), remote_file_spec)
         if err.Fail():

Modified: lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py?rev=239203&r1=239202&r2=239203&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py (original)
+++ lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py Fri Jun  5 19:25:50 2015
@@ -395,7 +395,7 @@ class GdbRemoteTestCaseBase(TestBase):
                 inferior_exe_path = os.path.abspath("a.out")
 
             if lldb.remote_platform:
-                remote_path = lldbutil.append_to_remote_wd(os.path.basename(inferior_exe_path))
+                remote_path = lldbutil.append_to_process_working_directory(os.path.basename(inferior_exe_path))
                 remote_file_spec = lldb.SBFileSpec(remote_path, False)
                 err = lldb.remote_platform.Install(lldb.SBFileSpec(inferior_exe_path, True), remote_file_spec)
                 if err.Fail():

Modified: lldb/trunk/test/types/AbstractBase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/AbstractBase.py?rev=239203&r1=239202&r2=239203&view=diff
==============================================================================
--- lldb/trunk/test/types/AbstractBase.py (original)
+++ lldb/trunk/test/types/AbstractBase.py Fri Jun  5 19:25:50 2015
@@ -86,7 +86,7 @@ class GenericTester(TestBase):
         if lldb.remote_platform:
             # process launch -o requires a path that is valid on the target
             self.assertIsNotNone(lldb.remote_platform.GetWorkingDirectory())
-            remote_path = lldbutil.append_to_remote_wd("lldb-stdout-redirect.txt")
+            remote_path = lldbutil.append_to_process_working_directory("lldb-stdout-redirect.txt")
             self.runCmd('process launch -o {remote}'.format(remote=remote_path))
             # copy remote_path to local host
             self.runCmd('platform get-file {remote} "{local}"'.format(





More information about the lldb-commits mailing list