This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add new commands and tests for getting file perms & exists
ClosedPublic

Authored by mgorny on Aug 10 2021, 3:14 AM.

Details

Summary

Add two new commands 'platform get-file-permissions' and 'platform
file-exists' for the respective bits of LLDB protocol. Add tests for
them. Fix error handling in GetFilePermissions().

Diff Detail

Event Timeline

mgorny requested review of this revision.Aug 10 2021, 3:14 AM
mgorny created this revision.
mgorny updated this revision to Diff 365416.Aug 10 2021, 3:59 AM

Fix colliding test name.

labath added a comment.Sep 7 2021, 3:58 AM

I was thinking this would be more useful in the SB form (and indeed we have SBPlatform::GetFilePermissions) already, though I suppose making it available through the command line does not hurt either..

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
664–668

Unless I'm mistaken, the test does not actually run this code (as it tests the client bits).

lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
103–111

Maybe it's time to create a separate test class which would perform this in the setUp/tearDown methods?

mgorny added inline comments.Sep 7 2021, 9:40 AM
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
664–668

Yes, this is the case. Adding tests for the server is a bit out of scope for what I'm working on.

labath added inline comments.Sep 8 2021, 1:05 AM
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
664–668

Why is that? You did have them in the other patches I looked at...

Batching these changes in this way is particularly unfortunate because a casual observer might conclude that you actualy _are_ including a test for the bug you've fixed.

mgorny added inline comments.Sep 8 2021, 1:42 AM
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
664–668

Just to be clear, are we talking of adding a generic server-side test for vFile:mode, or specifically one that triggers an error? Though thinking about it a bit more, using a file that does not exist should be good enough to trigger this.

mgorny updated this revision to Diff 371841.Sep 10 2021, 2:23 AM
mgorny marked an inline comment as done.

Remove now-redundant platform connect calls.

TODO: server tests.

mgorny updated this revision to Diff 371858.Sep 10 2021, 3:36 AM
mgorny marked 2 inline comments as done.

Add a server test for error condition. Rebase client tests.

labath accepted this revision.Sep 10 2021, 4:14 AM

cool

This revision is now accepted and ready to land.Sep 10 2021, 4:14 AM
This revision was landed with ongoing or failed builds.Sep 10 2021, 5:08 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 10 2021, 5:08 AM