-
Notifications
You must be signed in to change notification settings - Fork 12
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
Guard changes #2
Conversation
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.
- Reviewed last three commits
Please make sure which name is best resolved vs invalid
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.
- Please add UT for all exceptions (wherever is possible).
- Please document the exception usage like what is the scope of that exception and conditions that need to meet to use that exception to throw.
- I have added comments for one exception it applicable to all exceptions.
- I would spit patches differently.
- Add a separate patch for all exceptions, good documentation with the condition, details in the commit message, and UT (if possible).
- Add a patch to throw each exception (more than one throw is possible for the same exception) from libguard and UT (if possible) - it help to reviewer to ask - is there anything to consider for that exception from existing code.
Please rebase your patch before pushing the next patch set for this pr |
ba21247
to
07b2b12
Compare
ef11c3a
to
4eafe6c
Compare
4eafe6c
to
0dd4d16
Compare
0dd4d16
to
17a5926
Compare
17a5926
to
07f0271
Compare
if (!isHeaderPrinted) | ||
{ | ||
std::cout << "No " | ||
<< (displayResolved == true ? "resolved" : "unresolved") |
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.
JS: displayResolved == true ?
-> displayResolved ?
07f0271
to
d508468
Compare
d508468
to
f26aa13
Compare
2083004
to
b0de547
Compare
Looks good to me |
b0de547
to
77eed46
Compare
e6a25b7
to
3c848c9
Compare
3c848c9
to
5f03deb
Compare
ea8fa52
to
a4edcb6
Compare
Changes: -Adding check in create API, which will calculate the available size in the file before writing the guard record. Signed-off-by: Chirag Sharma <[email protected]>
a4edcb6
to
60a3b31
Compare
60a3b31
to
4329db3
Compare
Changes: -Currently in libguard the guard records were wiped out from the file, but changing it now to maintain the record history. Hence instead of deleting, making the recordID as FFFFFFFF and not displaying it. -Change in create guard function, for marking correct recordId because of change in delete function as we are marking recordId as FF..FF it will take maxId is that and will not allocate correct recordId to newly created guard record. -Allowing to create guard of resolved guard record -Adding function invalidateAll to invalidate all the guard records i.e. mark recordId as FFFFFFFF for all the guard records present. -Changing clearAll function to erase the data in guard file. -Adding UT for invalidateAll function. -Changes in Guard tool to not display invalidated guard records. Test: -Created guard record deleted the same, the recordId was setting to FFFFFFFF and not getting displaying in guard tool output. -Clearall is marking all recordId as FF...FF -Created a guard record and deleted the same, tried to guard the same record. Signed-off-by: Chirag Sharma <[email protected]>
Change: -Adding check in create api to store the location/position of invalid/resolved record, incase there is no space left that resolved record position will be used to create a new record. -Adding UT for the above change where when no space is left in guard file the oldest guard records will be replaced with the new guard record. Test: -Created guard records and deleted few of them, for the deleted guard records record id got set to 0xFFFFFFFF. When no space is left in guard file the 1st resolved record location will be used to create the new record. Signed-off-by: Chirag Sharma <[email protected]>
4329db3
to
b3b15cc
Compare
Changes: -Adding user defined exceptions in libguard so that the caller can distinguish the type of error at his end. -Changes in respective UTs. Test: Created guard record, tried creating the same. Deleting a non guarded record. Ran UTs in docker env. Signed-off-by: Chirag Sharma <[email protected]>
Changes: -Making options of guardtool more meaningful as per the backend functionality. Like -d to -i, this will Invalidate a single Guard record Changing --clear-all to --reset, which will erase all the guard records. -Adding -I, will Invalidates all the Guard records -Adding -a option to list the resolved guard records -Updating README with new options -Setting GUARD_VERSION in meason.build to return correct value. Test: -creating and invalidating guard records, checking if its getting displayed with new option or not. -with changed options able to invalidate the guard records. [==========] Running 15 tests from 1 test suite. [----------] Global test environment set-up. [----------] 15 tests from TestGuardRecord [ RUN ] TestGuardRecord.CreateGuardRecord [ OK ] TestGuardRecord.CreateGuardRecord (0 ms) [ RUN ] TestGuardRecord.ClearGuardGoodPathTest [ OK ] TestGuardRecord.ClearGuardGoodPathTest (0 ms) [ RUN ] TestGuardRecord.DeleteGuardGoodPathTest [ OK ] TestGuardRecord.DeleteGuardGoodPathTest (0 ms) [ RUN ] TestGuardRecord.NegTestCaseEP [ OK ] TestGuardRecord.NegTestCaseEP (0 ms) [ RUN ] TestGuardRecord.NegTestCaseFullGuardFile Guard file size is 656 and space remaining in GUARD file is 0 [ OK ] TestGuardRecord.NegTestCaseFullGuardFile (0 ms) [ RUN ] TestGuardRecord.AlreadyGuardedTC Already guard record is available in the GUARD partition [ OK ] TestGuardRecord.AlreadyGuardedTC (0 ms) [ RUN ] TestGuardRecord.GetCreatedGuardRecordTC [ OK ] TestGuardRecord.GetCreatedGuardRecordTC (0 ms) [ RUN ] TestGuardRecord.DeleteByEntityPath [ OK ] TestGuardRecord.DeleteByEntityPath (0 ms) [ RUN ] TestGuardRecord.DeleteWithNotExistentEntity Guard record not found [ OK ] TestGuardRecord.DeleteWithNotExistentEntity (0 ms) [ RUN ] TestGuardRecord.DeleteByRecordId [ OK ] TestGuardRecord.DeleteByRecordId (0 ms) [ RUN ] TestGuardRecord.DeleteWithNotExistentRecordId Guard record not found [ OK ] TestGuardRecord.DeleteWithNotExistentRecordId (0 ms) [ RUN ] TestGuardRecord.GetGuardFilePathTC [ OK ] TestGuardRecord.GetGuardFilePathTC (0 ms) [ RUN ] TestGuardRecord.GetGuardFilePathWhenLibguradDidNotInitTC Guard file is not initialised. [ OK ] TestGuardRecord.GetGuardFilePathWhenLibguradDidNotInitTC (0 ms) [ RUN ] TestGuardRecord.ClearGuardInvalidatePathTest [ OK ] TestGuardRecord.ClearGuardInvalidatePathTest (0 ms) [ RUN ] TestGuardRecord.ClearResolvedGuardRecord [ OK ] TestGuardRecord.ClearResolvedGuardRecord (0 ms) [----------] 15 tests from TestGuardRecord (4 ms total) [----------] Global test environment tear-down [==========] 15 tests from 1 test suite ran. (5 ms total) [ PASSED ] 15 tests. ------------------------------------------------------------------------------ Ok: 1 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0 Signed-off-by: Chirag Sharma <[email protected]>
b3b15cc
to
ebb9771
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.
LGTM - Tested with HardwareIsolation manager to make sure actual libguard is working or not.
This commit contains the changes related in libguard