In situations when memory is occupied to a certain higher limit by system processes, the amount of memory available may be in negative/low values not suitable for testing. Hence its better to have a memory check prior to the test beginning.
Signed-off-by: Madhura P S <[email protected]> --- ltp-full-20130109/testcases/kernel/mem/tunable/max_map_count.c.org 2013-01-17 17:15:38.957032558 +0530 +++ ltp-full-20130109/testcases/kernel/mem/tunable/max_map_count.c 2013-01-17 17:16:58.092909326 +0530 @@ -152,7 +152,7 @@ static void max_map_count_test(void) pid_t pid; long max_maps; long map_count; - long max_iters; + long max_iters = 0; long memfree; /* @@ -174,7 +174,8 @@ static void max_map_count_test(void) */ memfree = read_meminfo("CommitLimit:") - read_meminfo("Committed_AS:"); /* 64 used as a bias to make sure no overflow happen */ - max_iters = memfree / sysconf(_SC_PAGESIZE) * 1024 - 64; + if (memfree > 0) + max_iters = memfree / sysconf(_SC_PAGESIZE) * 1024 - 64; if (max_iters > MAX_MAP_COUNT) max_iters = MAX_MAP_COUNT; -- With Regards, Madhura P S ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712 _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
