Skip to content
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 zmalloc PREFIX_SIZE to fix sds alloc size test #1314

Open
wants to merge 2 commits into
base: unstable
Choose a base branch
from

Conversation

enjoy-binbin
Copy link
Member

Currently sdsAllocSize does not calculate PREFIX_SIZE when no
malloc_size available, this casue test_typesAndAllocSize fail
in the new unittest.

Currently sdsAllocSize does not calculate PREFIX_SIZE when no
malloc_size available, this casue test_typesAndAllocSize fail
in the new unittest.

Signed-off-by: Binbin <[email protected]>
@enjoy-binbin
Copy link
Member Author

enjoy-binbin commented Nov 16, 2024

I guess we don't want to modify sdsAllocSize to include it? so i just modify the test.
Also see #502 and #694 for more details.

The failure test CI: https://github.com/valkey-io/valkey/actions/runs/11865335400/job/33070348096#step:7:254

Signed-off-by: Binbin <[email protected]>
Copy link

codecov bot commented Nov 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.70%. Comparing base (aa2dd3e) to head (d77e81e).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1314      +/-   ##
============================================
- Coverage     70.73%   70.70%   -0.03%     
============================================
  Files           115      115              
  Lines         63158    63158              
============================================
- Hits          44674    44657      -17     
- Misses        18484    18501      +17     
Files with missing lines Coverage Δ
src/zmalloc.c 84.66% <ø> (ø)

... and 12 files with indirect coverage changes

Copy link
Member

@madolson madolson left a comment

Choose a reason for hiding this comment

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

I'm okay with this to get the tests passing regardless, I feel like there is probably a better way to expose the API to the testing though.

Comment on lines +255 to +258
size_t sdsRealAllocSize(sds s) {
return sdsAllocSize(s) + PREFIX_SIZE;
}

Copy link
Member

Choose a reason for hiding this comment

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

From a modularization perspective, we could add this as a function in zmalloc.c and forward declare it here to access it for tests but not expose it in the header file. I don't know if I prefer that approach though.

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.

2 participants