[Lldb-commits] [lldb] [lldb][test] Remove restriction for remote working directory (PR #89768)

via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 24 08:57:14 PDT 2024


https://github.com/ita-sc updated https://github.com/llvm/llvm-project/pull/89768

>From 817cc08f60ba2ed74e6185c8e04ebf460631141f Mon Sep 17 00:00:00 2001
From: Ivan Tetyushkin <ivan.tetyushkin at syntacore.com>
Date: Thu, 11 Apr 2024 11:52:48 +0300
Subject: [PATCH] [lldb][test] Make remote directory optional for remote
 targets in dotest

This patch fixes the following issue: if a user does not set a remote directory, the remote platform is dropped.
This is incorrect, as some remote targets might have no remote working directory,
for example, baremetal targets.
---
 lldb/packages/Python/lldbsuite/test/dotest.py | 42 ++++++++++---------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 2ec4a840b91675..e2ccc6aa27bfd7 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -987,30 +987,34 @@ def run_suite():
         else:
             configuration.lldb_platform_url = None
 
-    if configuration.lldb_platform_working_dir:
-        print(
-            "Setting remote platform working directory to '%s'..."
-            % (configuration.lldb_platform_working_dir)
-        )
-        error = lldb.remote_platform.MakeDirectory(
-            configuration.lldb_platform_working_dir, 448
-        )  # 448 = 0o700
-        if error.Fail():
-            raise Exception(
-                "making remote directory '%s': %s"
-                % (configuration.lldb_platform_working_dir, error)
+        if configuration.lldb_platform_working_dir:
+            print(
+                "Setting remote platform working directory to '%s'..."
+                % (configuration.lldb_platform_working_dir)
             )
+            error = lldb.remote_platform.MakeDirectory(
+                configuration.lldb_platform_working_dir, 448
+            )  # 448 = 0o700
+            if error.Fail():
+                raise Exception(
+                    "making remote directory '%s': %s"
+                    % (configuration.lldb_platform_working_dir, error)
+                )
+
+            if not lldb.remote_platform.SetWorkingDirectory(
+                configuration.lldb_platform_working_dir
+            ):
+                raise Exception(
+                    "failed to set working directory '%s'"
+                    % configuration.lldb_platform_working_dir
+                )
+        else:
+            configuration.lldb_platform_working_dir = None
 
-        if not lldb.remote_platform.SetWorkingDirectory(
-            configuration.lldb_platform_working_dir
-        ):
-            raise Exception(
-                "failed to set working directory '%s'"
-                % configuration.lldb_platform_working_dir
-            )
         lldb.selected_platform = lldb.remote_platform
     else:
         lldb.remote_platform = None
+        configuration.lldb_platform_name = None
         configuration.lldb_platform_working_dir = None
         configuration.lldb_platform_url = None
 



More information about the lldb-commits mailing list