-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[lldb] Unify CalculateMD5 return types #91029
Conversation
Unify CalculateMD5 return types
@JDevlieghere , do you know if there's a way to run buildbot on a merge of this PR and main branch - just to validate the build/tests work before this merge? The llvm contributing guide says this is normal workflow - but I worry since I am using a lot of the maintainers' time to merge / revert the changes for me since I don't have write access. |
Unify CalculateMD5 return types
You can test this locally with the following command:git-clang-format --diff d129ea8d2fa347e63deec0791faf389b84f20ce1 44223e9a62d116c50b52985ab944a5e2d48de95a -- lldb/include/lldb/Target/Platform.h lldb/include/lldb/Target/RemoteAwarePlatform.h lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/source/Target/Platform.cpp lldb/source/Target/RemoteAwarePlatform.cpp lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp View the diff from clang-format here.diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index 6dcf7ef3ea..24111396b0 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -595,9 +595,8 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteMemoryTags) {
TEST_F(GDBRemoteCommunicationClientTest, CalculateMD5) {
FileSpec file_spec("/foo/bar", FileSpec::Style::posix);
- std::future<ErrorOr<MD5::MD5Result>> async_result = std::async(std::launch::async, [&] {
- return client.CalculateMD5(file_spec);
- });
+ std::future<ErrorOr<MD5::MD5Result>> async_result = std::async(
+ std::launch::async, [&] { return client.CalculateMD5(file_spec); });
lldb_private::StreamString stream;
stream.PutCString("vFile:MD5:");
|
This formatter alert is outdated - by the time this arrived, my PR had the issue fixed already. |
Not that I know. When failures are macOS specific I'm happy to apply a PR locally and run the test suite and other folks with specific configurations might do the same, but that's about all I can think of.
No worries, it's totally normal and we're happy to help with that! |
Can I ask you merge this for me? Hopefully no reverts this time :) |
This is a retake of #90921 which got reverted because I forgot to modify the CalculateMD5 unit test I had added in #88812
The prior failing build is here: https://lab.llvm.org/buildbot/#/builders/68/builds/73622
To make sure this error doesn't happen, I ran
ninja ProcessGdbRemoteTests
and then executed the resulting test binary and observed theCalculateMD5
test passed.Overview
In my previous PR: #88812, @JDevlieghere suggested to match return types of the various calculate md5 functions.
This PR achieves that by changing the various calculate md5 functions to return
llvm::ErrorOr<llvm::MD5::MD5Result>
.The suggestion was to go for
std::optional<>
but I opted forllvm::ErrorOr<>
because local calculate md5 was already possibly returningErrorOr
.To make sure I didn't break the md5 calculation functionality, I ran some tests for the gdb remote client, and things seem to work.
Testing
Remote file doesn't exist
![image](https://private-user-images.githubusercontent.com/1326275/327619278-b26859e2-18c3-4685-be8f-c6b6a5a4bc77.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA4MTc4NzIsIm5iZiI6MTcyMDgxNzU3MiwicGF0aCI6Ii8xMzI2Mjc1LzMyNzYxOTI3OC1iMjY4NTllMi0xOGMzLTQ2ODUtYmU4Zi1jNmI2YTVhNGJjNzcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNB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0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.LFwr-5RbuJhqF82Dpwh54QtLOS8QkznmsjxffyZQZlM)
Remote file matches
![image](https://private-user-images.githubusercontent.com/1326275/327618808-07561572-22d1-4e0a-988f-bc91b5c2ffce.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA4MTc4NzIsIm5iZiI6MTcyMDgxNzU3MiwicGF0aCI6Ii8xMzI2Mjc1LzMyNzYxODgwOC0wNzU2MTU3Mi0yMmQxLTRlMGEtOTg4Zi1iYzkxYjVjMmZmY2UucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MTJUMjA1MjUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzVkNzRiMjFiNzcwOTAyMzg5YmNjMDg4MDE1ZDMxYWNkZGEwYThhNzM5NmFkNzEyNzMxNmY5ZTY1ODcyMTA2YSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.5ID5NmTTuiQihmmY_6NiL-heESLHwpaYKdCXFnO7gZw)
Test gaps
Unfortunately, I had to modify
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
and I can't test the changes there. Hopefully, the existing test suite / code review from whomever is reading this will catch any issues.