]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
test/bufferlist: Avoid false-positive tests 7955/head
authorErwan Velu <erwan@redhat.com>
Wed, 24 Feb 2016 16:12:19 +0000 (17:12 +0100)
committerErwan Velu <erwan@redhat.com>
Mon, 7 Mar 2016 09:36:06 +0000 (10:36 +0100)
commita565d333dc0a2fe5eaa2159155a9c765838ea0cf
tree40291843c620cb6c845edd10f59f9e130c13ecc6
parent6d31e5dfa8089e8fd5bda2d845ca130321d804e2
test/bufferlist: Avoid false-positive tests

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>
src/test/bufferlist.cc