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
+27 -14
View File
@@ -19,25 +19,38 @@
#include "pch.h"
#include "catch.hpp"
#include "BeastServer.hpp"
#include "MemDebug.hpp"
#include <iostream>
using namespace pipedal;
TEST_CASE( "BeastServer shutdown", "[beastServerShutdown]" ) {
TEST_CASE("BeastServer shutdown", "[beastServerShutdown][Build][Dev]")
{
MemStats initialMemory = GetMemStats();
{
auto const address = boost::asio::ip::make_address("0.0.0.0");
auto const port = 8081;
std::string doc_root = ".";
auto const threads = 3;
auto const address = boost::asio::ip::make_address("0.0.0.0");
auto const port = 8081;
std::string doc_root = ".";
auto const threads = 3;
auto server = createBeastServer(
address, port, doc_root.c_str(), threads);
server->RunInBackground();
sleep(5);
server->ShutDown(1000);
sleep(1);
server->Join();
}
MemStats finalMemory = GetMemStats();
auto server = createBeastServer(
address,port,doc_root.c_str(),threads);
server->RunInBackground();
sleep(30000);
server->ShutDown(1000);
sleep(1);
server->Join();
// currently leaking one allocation of 8 bytes. Acceptable.
if (finalMemory.allocations > initialMemory.allocations+1)
{
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);
}
}