-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add support for diagnostic logs server cluster and add the log provid… #29976
Add support for diagnostic logs server cluster and add the log provid… #29976
Conversation
bb90d85
to
d18f8bc
Compare
PR #29976: Size comparison from 3aac08f to d18f8bc Increases above 0.2%:
Increases (14 builds for bl602, bl702, bl702l, cc13x4_26x4, mbed)
Decreases (7 builds for bl702, bl702l)
Full report (16 builds for bl602, bl702, bl702l, cc13x4_26x4, mbed)
|
3a1ba37
to
6faf371
Compare
…er delegate to all-clusters-app - Add darwin code to download logs of differnt types and get the logs transferred via BDX
6faf371
to
aa2ade5
Compare
@nivi-apple - for summary |
Need to add the log files to darwin CI and add the timeout test case in MTRDevice. |
a102200
to
b9fbb0b
Compare
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include "diagnostic-logs-provider-delegate-impl.h" |
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.
need to fix this include.
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.
done.
examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp
Show resolved
Hide resolved
examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Boris Zbarsky <[email protected]>
c84d36c
to
1078039
Compare
PR #29976: Size comparison from c6b6fb3 to 1078039 Increases above 0.2%:
Increases (46 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, mbed, nrfconnect, psoc6, qpg, telink)
Decreases (4 builds for psoc6)
Full report (59 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, mbed, nrfconnect, psoc6, qpg, telink)
|
PR #29976: Size comparison from c6b6fb3 to 23b91a5 Increases above 0.2%:
Increases (73 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
Decreases (5 builds for linux, psoc6)
Full report (73 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
23b91a5
to
8cb17b6
Compare
8cb17b6
to
3151b6c
Compare
PR #29976: Size comparison from b5b5b27 to 3151b6c Increases above 0.2%:
Increases (52 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
Decreases (6 builds for linux, psoc6)
Full report (69 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
PR #29976: Size comparison from f6e2cfc to e5340b4 Increases above 0.2%:
Increases (54 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
Decreases (5 builds for linux, psoc6)
Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
chip::Optional<std::string> mEndUserSupportLogFilePath; | ||
chip::Optional<std::string> mNetworkDiagnosticsLogFilePath; | ||
chip::Optional<std::string> mCrashLogFilePath; |
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.
Why are these named "m" of they are global variables (and why are they application globals instead of file statics or class members or something)? My previous review said:
I would suggest just making these
std::string
members ofAppOptions
and given how you use them, static members should be the way to go... Probably named "sEndUser...." and whatnot.
And why the extra chip::
prefixes?
Also, I suggested using std::optional
. Did that not work for some reason?
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.
prefixed file path names with s, made them file statics. replaced chip::Optional with std::optional.
|
||
bool AppOptions::IsNullOrEmpty(const char * value) | ||
{ | ||
return (value == nullptr || strlen(value) == 0 || strncmp(value, "", strlen(value)) == 0); |
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.
I don't understand that third bit with strncmp
. When would that ever be true if the previous two checks are false?
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.
checking for an empty string. it might not be needed actually.
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.
removed.
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.
checking for an empty string
strlen == 0 checked that already.
} | ||
else | ||
{ | ||
mLogSessionHandle = kInvalidLogSessionHandle; |
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.
OK, so this will return kInvalidLogSessionHandle
but leave mIsInALogCollectionSession
set to true, right? Why is that OK?
Same for the places above that return kInvalidLogSessionHandle
on errors.
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.
not ok. this is a bug. fixed.
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.
i moved mIsInALogCollectionSession to the bottom of the function once the file has been successfully opened
if ((remainingBytesToBeRead >= kMaxLogContentSize && outBuffer.size() < kMaxLogContentSize) || | ||
(remainingBytesToBeRead < kMaxLogContentSize && static_cast<long long>(outBuffer.size()) < remainingBytesToBeRead)) |
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.
I don't get this. The caller is asking you for the next outBuffer.size()
bytes. Why would you fail if that's smaller than the "bytes to be read"? What is this check trying to accomplish?
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.
This is not required here. i fixed the code.
} | ||
|
||
mFileStream.seekg(static_cast<long long>(mTotalNumberOfBytesConsumed)); | ||
mFileStream.read(reinterpret_cast<char *>(outBuffer.data()), kMaxLogContentSize); |
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.
This should be reading the min of remainingBytesToBeRead and outBuffer.size(), no?
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.
fixed.
|
||
dispatch_queue_t queue = dispatch_get_main_queue(); | ||
|
||
dispatch_async(queue, ^{ |
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.
Why is this dispatch_async here?
if (timeout > 0) { | ||
XCTAssertNotNil(error); | ||
XCTAssertNil(logResult); |
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.
Is this because the timeout > 0 case is buggy? Needs comment if so.
Co-authored-by: Boris Zbarsky <[email protected]>
PR #29976: Size comparison from f6e2cfc to 5a37be1 Increases above 0.2%:
Increases (49 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, mbed, nrfconnect, psoc6, qpg, telink)
Decreases (7 builds for efr32, esp32, psoc6)
Full report (58 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, mbed, nrfconnect, psoc6, qpg, telink)
|
ce3351e
to
34766b0
Compare
34766b0
to
707a677
Compare
PR #29976: Size comparison from 6907eaa to 707a677 Increases above 0.2%:
Increases (46 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
Decreases (4 builds for psoc6)
Full report (60 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
Replaced by #31198 |
…er delegate to all-clusters-app
Fixes: #29829
This change adds support for the diagnostic logs server cluster and uses BDX to transfer the logs.
Also adds support to all-clusters-app that implements the log provider delegate which provides the logs to transfer to the requestor