Automated Build Tests

Fixes #34
This commit is contained in:
Robin Davies
2022-03-16 00:18:17 -04:00
parent 8b222cbf0b
commit 2b2e82730c
13 changed files with 307 additions and 70 deletions
+22 -3
View File
@@ -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);
}
}