+22
-3
@@ -25,13 +25,32 @@
|
||||
|
||||
|
||||
#include "Lv2Host.hpp"
|
||||
#include "MemDebug.hpp"
|
||||
|
||||
using namespace pipedal;
|
||||
|
||||
|
||||
TEST_CASE( "Lv2Host memory leak", "[lv2host_leak]" ) {
|
||||
TEST_CASE( "Lv2Host memory leak", "[lv2host_leak][Build][Dev]" ) {
|
||||
|
||||
Lv2Host host;
|
||||
MemStats initialMemory = GetMemStats();
|
||||
{
|
||||
Lv2Host host;
|
||||
|
||||
host.Load("/usr/lib/lv2:/usr/local/lib/lv2:/usr/modep/lv2");
|
||||
host.Load("/usr/lib/lv2:/usr/local/lib/lv2:/usr/modep/lv2");
|
||||
}
|
||||
MemStats finalMemory = GetMemStats();
|
||||
|
||||
// Something lilv leaks a Dublin Core url.
|
||||
// Acceptable.
|
||||
const int ACCEPTABLE_ALLOCATION_LEAKS = 4;
|
||||
const int ACCEPTABLE_MEMORY_LEAK = 400;
|
||||
|
||||
if (finalMemory.allocations > initialMemory.allocations + ACCEPTABLE_ALLOCATION_LEAKS
|
||||
|| finalMemory.allocated > initialMemory.allocated + ACCEPTABLE_MEMORY_LEAK)
|
||||
{
|
||||
std::cout << "Leaked Allocations: " << (finalMemory.allocations- initialMemory.allocations) << std::endl;
|
||||
std::cout << "Leaked Memory: " << (finalMemory.allocated - initialMemory.allocated) << " bytes" << std::endl;
|
||||
|
||||
REQUIRE(finalMemory.allocations == initialMemory.allocations);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user