Skip to content

CP: Add Writability to Storage Abstraction (#5133) #5165

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

Merged
merged 1 commit into from
Jun 17, 2025

Conversation

anrossi
Copy link
Contributor

@anrossi anrossi commented Jun 13, 2025

* Add Writability to Storage Abstraction

* Add tests from #5132

---------

Co-authored-by: Guillaume Hetier <guhetier@microsoft.com>
@anrossi anrossi requested a review from a team as a code owner June 13, 2025 16:24
@anrossi anrossi enabled auto-merge (squash) June 13, 2025 16:24
@guhetier
Copy link
Contributor

Just to understand, why do we need to cherry-pick this to 2.5? (Could be nice to add in the PR description for posterity)

@anrossi
Copy link
Contributor Author

anrossi commented Jun 13, 2025

@guhetier This PR provides the foundation for tests that #5112 needs. #5112 will also be cherry-picked as it's the last feature needed for 2.5 release. I'll add this in the description in the future.

Copy link

codecov bot commented Jun 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.69%. Comparing base (8e2d8d5) to head (24e0c3a).
Report is 2 commits behind head on release/2.5.

Additional details and impacted files
@@               Coverage Diff               @@
##           release/2.5    #5165      +/-   ##
===============================================
- Coverage        87.31%   85.69%   -1.62%     
===============================================
  Files               59       59              
  Lines            18048    18048              
===============================================
- Hits             15758    15467     -291     
- Misses            2290     2581     +291     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@guhetier
Copy link
Contributor

Your "retry" PR made some extra changes to the "clear" function.

  • Will that other PR be cherry-picked too?
  • If not, do we need to bring that change in?

@guhetier
Copy link
Contributor

The change looks good to me, but can you check the test failure is unrelated?
It seems likely since storage should only affect Windows, but let's do our due diligences.

@anrossi anrossi merged commit 6e20c4a into release/2.5 Jun 17, 2025
283 of 286 checks passed
@anrossi anrossi deleted the storage-abstraction-on-release-2.5 branch June 17, 2025 00:45
@anrossi
Copy link
Contributor Author

anrossi commented Jun 17, 2025

Your "retry" PR made some extra changes to the "clear" function.

  • Will that other PR be cherry-picked too?
  • If not, do we need to bring that change in?

yes, that PR will also be cherry-picked once it is completed.

//
_IRQL_requires_max_(PASSIVE_LEVEL)
QUIC_STATUS
CxPlatStorageWriteValue(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont recall if we discussed this already.

These are quite risky functions from production perspective. We should surround these declarations with a #define and allow the functions to be used in the test code for now. If we need it in the msquic lib, we can discuss each usage specifically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SettingsTest.cpp uses QUIC_UNIT_TESTS macro for this.

StorageName,
nullptr,
nullptr,
CXPLAT_STORAGE_OPEN_FLAG_DELETE | CXPLAT_STORAGE_OPEN_FLAG_WRITE | CXPLAT_STORAGE_OPEN_FLAG_CREATE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Perhaps this line is too long?
A scope-local param "flags" could be set to these flags and used instead for better readability.

@@ -73,6 +79,34 @@ ZwNotifyChangeKey(
_In_ BOOLEAN Asynchronous
);

//
// Copied from wdm.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a couple of references to wdm.h here. Just curious if it is a public file.

@@ -5980,549 +5980,343 @@ QuicTestCredentialLoad(const QUIC_CREDENTIAL_CONFIG* Config)
TEST_QUIC_SUCCEEDED(Configuration.LoadCredential(Config));
}


class QuicStorageSettingScopeGuard {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a comment to mention this is duplicated in the settings test as well...

StorageName,
nullptr,
nullptr,
CXPLAT_STORAGE_OPEN_FLAG_DELETE | CXPLAT_STORAGE_OPEN_FLAG_WRITE | CXPLAT_STORAGE_OPEN_FLAG_CREATE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comment in the settings unit test code.

@@ -294,50 +334,84 @@ CxPlatStorageOpen(

CxPlatZeroMemory(Storage, sizeof(CXPLAT_STORAGE));
CxPlatLockInitialize(&Storage->Lock);
Storage->Callback = Callback;
Storage->CallbackContext = CallbackContext;
if (Callback != NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also validate or assert that CallbackContext is not NULL?

@@ -121,99 +126,136 @@ CxPlatStorageOpen(
}

CxPlatZeroMemory(Storage, sizeof(CXPLAT_STORAGE));
Storage->Callback = Callback;
Storage->CallbackContext = CallbackContext;
if (Callback != NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also check/assert if CallbackContext is not NULL as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants