-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Fix TestGdbRemoteForkNonStop.py test #131293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: Georgiy Samoylov (sga-sc) ChangesDuring lldb testing on remote targets TestGdbRemoteForkNonStop.py freezes because in this test we try to create file on remote machine using absolute file path from local machine. This patch fixes this error Full diff: https://github.com/llvm/llvm-project/pull/131293.diff 1 Files Affected:
diff --git a/lldb/test/API/tools/lldb-server/main.cpp b/lldb/test/API/tools/lldb-server/main.cpp
index c661f5b4e82c4..fc3776832d6b6 100644
--- a/lldb/test/API/tools/lldb-server/main.cpp
+++ b/lldb/test/API/tools/lldb-server/main.cpp
@@ -344,8 +344,10 @@ int main(int argc, char **argv) {
} else if (consume_front(arg, "process:sync:")) {
// this is only valid after fork
const char *filenames[] = {"parent", "child"};
- std::string my_file = arg + "." + filenames[is_child];
- std::string other_file = arg + "." + filenames[!is_child];
+ size_t pos = arg.find_last_of("/\\");
+ std::string file_name = arg.substr(pos + 1);
+ std::string my_file = file_name + "." + filenames[is_child];
+ std::string other_file = file_name + "." + filenames[!is_child];
// indicate that we're ready
FILE *f = fopen(my_file.c_str(), "w");
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should make the test (python code) pass the correct path instead. We have self.get_process_working_directory()
for that.
8c8e714
to
cb1c55b
Compare
@labath Addressed |
"""Get the working directory that should be used when launching processes for local or remote processes.""" | ||
if lldb.remote_platform: | ||
# Remote tests set the platform working directory up in | ||
# TestBase.setUp() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# TestBase.setUp() | |
# Base.setUp() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
def getWorkingDirArtifact(self, name="a.out"): | ||
"""Return absolute path to an artifact in the test's working directory.""" | ||
return os.path.join(self.get_process_working_directory(), name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this we have lldbutil.append_to_process_working_directory
.
I actually like your api more, so I wouldn't be opposed to using this instead. However I don't think we should have two methods for the same thing, so if you want to go down that path, you should also port the other usages of append_to_process_working_directory
to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
47f1555
to
77f2717
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
I don’t have merge rights, so could you merge it, please? |
During lldb testing on remote targets TestGdbRemoteForkNonStop.py freezes because in this test we try to create file on remote machine using absolute file path from local machine. This patch fixes this error