From ca9ac57dc631eb5647fc8954cb9c833d905dab2c Mon Sep 17 00:00:00 2001 From: Ben Huber Date: Wed, 22 May 2019 13:38:59 +0200 Subject: [PATCH] allow UnitTests to use the swap. not allowing this can cause bad_allocs on medium sized allocations due to soft limits set by the OS for non-priviledged executables --- src/xerus/test/test.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/xerus/test/test.cpp b/src/xerus/test/test.cpp index eaaee7e..8869599 100644 --- a/src/xerus/test/test.cpp +++ b/src/xerus/test/test.cpp @@ -84,7 +84,7 @@ namespace xerus { namespace misc { std::cerr << "| Test has thrown an uncaught xerus::generic_error():" << std::endl; std::cerr << e.what() << std::endl; ::xerus::misc::UnitTest::passed = false; - }/* catch (const std::exception &e) { + } catch (const std::exception &e) { std::cout << u8"\033[1;31m\u2717 \033[0m" << std::endl; std::cerr << "| Test has thrown an uncaught std::exception:" << std::endl; std::cerr << e.what() << std::endl; @@ -93,7 +93,7 @@ namespace xerus { namespace misc { std::cout << u8"\033[1;31m\u2717 \033[0m" << std::endl; std::cerr << "| Test has thrown an uncaught unknown exception..." << std::endl; ::xerus::misc::UnitTest::passed = false; - }*/ + } std::chrono::microseconds::rep time = std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - start).count(); if (::xerus::misc::UnitTest::passed) { @@ -141,9 +141,6 @@ int main(int argc, char* argv[]) { signal(SIGILL,xerus::misc::internal::catch_signals); signal(SIGSEGV,xerus::misc::internal::catch_signals); - // Prevent swap usage - mlockall(MCL_CURRENT | MCL_FUTURE); - //Calculate complete time std::chrono::high_resolution_clock::time_point startTime = std::chrono::high_resolution_clock::now(); @@ -153,8 +150,8 @@ int main(int argc, char* argv[]) { std::cout << "###############################################################################" << std::endl; // No unittests defined (ie. the map tests does not exist!) if (!xerus::misc::UnitTest::tests) { - std::cout << "no unittests defined.\n"; - std::cout << "use the macro UNIT_TEST(group, testname, ...) to define unittests inside the sourcecode." << std::endl; + std::cout << "No unittests defined.\n"; + std::cout << "Create xerus::misc::UnitTest objects to define unittests inside the sourcecode." << std::endl; return 0; } -- 2.22.0