[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 31 02:46:09 PDT 2024


================
@@ -206,3 +207,70 @@ def test_environment_with_special_char(self):
         self.assertEqual(value, evil_var)
         process.Continue()
         self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+
+    def test_target_launch_working_dir_prop(self):
+        """Test that the setting `target.launch-working-dir` is correctly used when launching a process."""
+        d = {"CXX_SOURCES": "print_cwd.cpp"}
+        self.build(dictionary=d)
+        self.setTearDownCleanup(d)
+        exe = self.getBuildArtifact("a.out")
+        self.runCmd("file " + exe)
+
+        mywd = "my_working_dir"
+        out_file_name = "my_working_dir_test.out"
+
+        my_working_dir_path = self.getBuildArtifact(mywd)
+        lldbutil.mkdir_p(my_working_dir_path)
+        out_file_path = os.path.join(my_working_dir_path, out_file_name)
+        another_working_dir_path = Path(
+            os.path.join(my_working_dir_path, "..")
+        ).resolve()
+
+        # Check that we correctly override the working dir
----------------
DavidSpickett wrote:

Please rewrite this so it's obvious what "correct" means. Like:
```
# If -w is passed to process launch, that value will be used instead of the setting.
```

https://github.com/llvm/llvm-project/pull/113521


More information about the lldb-commits mailing list