more valgrind instrumentation

This commit is contained in:
Arvid Norberg 2013-10-16 08:11:19 +00:00
parent 7c47f18866
commit 73323e2c3d
1 changed files with 14 additions and 0 deletions

View File

@ -46,6 +46,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "setup_transfer.hpp"
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
using namespace libtorrent;
using namespace libtorrent::dht;
@ -150,6 +154,10 @@ void send_dht_msg(node_impl& node, char const* msg, udp::endpoint const& ep
// std::cerr << "sending: " << e << "\n";
#endif
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(msg_buf, size);
#endif
lazy_entry decoded;
error_code ec;
lazy_bdecode(msg_buf, msg_buf + size, decoded, ec);
@ -676,6 +684,9 @@ int test_main()
char* ptr = buffer + pos;
pos += bencode(ptr, items[0].ent);
ed25519_sign(signature, (unsigned char*)buffer, pos, private_key, public_key);
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(signature, 64);
#endif
send_dht_msg(node, "put", source, &response, "10", 0
, 0, token, 0, 0, &items[0].ent, false, false
@ -747,6 +758,9 @@ int test_main()
// put item 1
pos += bencode(ptr, items[1].ent);
ed25519_sign(signature, (unsigned char*)buffer, pos, private_key, public_key);
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(signature, 64);
#endif
send_dht_msg(node, "put", source, &response, "10", 0
, 0, token, 0, 0, &items[1].ent, false, false