From e7bf1e3a5b89487e00d8fd59ebf0a37e70688c85 Mon Sep 17 00:00:00 2001 From: Veronique Legrand <vlegrand@pasteur.fr> Date: Thu, 26 May 2016 16:28:33 +0200 Subject: [PATCH] added check of available RAM on machine before running unit test for CMS. --- src/unit_test_cms.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/unit_test_cms.cpp b/src/unit_test_cms.cpp index 47349ce..50093df 100644 --- a/src/unit_test_cms.cpp +++ b/src/unit_test_cms.cpp @@ -12,6 +12,7 @@ using namespace std; #include "CountMinSketch.hpp" +#include "main_utils.h" void test_CMS(int lambda,int kappa,int kappa_prime) { @@ -78,6 +79,16 @@ int main(int argc, char **argv) { cout<<"sizeof(int)="<<sizeof(int)<<endl; cout<<"sizeof(long)="<<sizeof(long)<<endl; + cout<<"checking that your machine has enough RAM to run test"<<endl; + unsigned long ram=getNodePhysMemory(); + + if (ram<5) { + cout<<"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl; + cout<<" WARNING: skipping this test, it requires at least 4 gigabytes of RAM to run."<<endl; + cout<<"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl; + return 0; + } + cout<<"testing CMS with lambda="<<lambda<<endl; test_CMS(lambda,kappa,kappa_prime); // Finally using C arrays (maps implied storing hash keys : 4 Bytes per k_mer overhead) but each array is of size INT_MAX... -- GitLab