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

test/bufferlist: Avoid false-positive tests #7955

Merged
merged 1 commit into from Mar 11, 2016

Conversation

ErwanAliasr1
Copy link
Contributor

The current code is using the length of ptr to determine if the string is
correct.

As 'ptr' is a copy of the original 'str', it sounds safer to compare against the
original string size of the consider the actual size of the string : if 'ptr' is
shorter than 'str', the actual code will PASS while 'ptr' is broken.

This patch offer to use the same testing logic as per "ptr(const ptr& p,
unsigned o, unsigned l)" test by using a memcmp against the original string
length.

Signed-off-by: Erwan Velu erwan@redhat.com

The current code is using the length of ptr to determine if the string is
correct.

As 'ptr' is a copy of the original 'str', it sounds safer to compare against the
original string size of the consider the actual size of the string : if 'ptr' is
shorter than 'str', the actual code will PASS while 'ptr' is broken.

This patch offer to use the same testing logic as per "ptr(const ptr& p,
unsigned o, unsigned l)" test by using a memcmp against the original string
length.

Signed-off-by: Erwan Velu <erwan@redhat.com>
@liewegas
Copy link
Member

liewegas commented Mar 7, 2016

oh i see! sounds good.

@liewegas liewegas added this to the jewel milestone Mar 7, 2016
@ErwanAliasr1
Copy link
Contributor Author

Thx @liewegas

liewegas added a commit that referenced this pull request Mar 11, 2016
test/bufferlist: Avoid false-positive tests

Reviewed-by: Sage Weil <sage@redhat.com>
@liewegas liewegas merged commit 07c41fc into ceph:master Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants