Remove loop from radix unittest. We can detect memleaks with valgrind.

remotes/origin/master-1.0.x
Victor Julien 17 years ago
parent a5218664c9
commit 047238351a

@ -3031,10 +3031,9 @@ int SCRadixTestIPV6NetblockInsertion14(void)
} }
/** /**
* \test SCRadixTestIPV4NetblockInsertion15 insert a node and * \test SCRadixTestIPV4NetblockInsertion15 insert a node searching on it.
* loop multiple times searching on it. Should always return true * Should always return true but the purposse of the test is to monitor
* but the purposse of the test is to monitor the memory usage to * the memory usage to detect memleaks (there was one on searching)
* detect memleaks (there was one on searching)
*/ */
int SCRadixTestIPV4NetblockInsertion15(void) int SCRadixTestIPV4NetblockInsertion15(void)
{ {
@ -3049,16 +3048,12 @@ int SCRadixTestIPV4NetblockInsertion15(void)
return 0; return 0;
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16); SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
uint64_t i = 0;
uint64_t limit = 100000;
/* test for the existance of a key */ /* test for the existance of a key */
bzero(&servaddr, sizeof(servaddr)); bzero(&servaddr, sizeof(servaddr));
if (inet_pton(AF_INET, "192.168.128.53", &servaddr.sin_addr) <= 0) if (inet_pton(AF_INET, "192.168.128.53", &servaddr.sin_addr) <= 0)
return 0; return 0;
for (; i < limit; i++) {
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree) != NULL); result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree) != NULL);
}
SCRadixReleaseRadixTree(tree); SCRadixReleaseRadixTree(tree);

Loading…
Cancel
Save