----- Original Message -----
> From: "Li Wang" <liw...@redhat.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Wednesday, 22 July, 2015 12:02:07 PM
> Subject: [LTP] [Patch v2] mem/hugeshmat04: check if system 'shmmax' large     
> enough
> 
> V1 --> V2
>        Just try to setup 'SHMMAX' to a large size then do the test
>        before we waive it.

Hi,

I have split the condition to two and made it print mem_total, new_shmmax
in case it's lower. Also turned resm+exit to brkm(TCONF) and pushed.

Regards,
Jan

> 
> Signed-off-by: Li Wang <liw...@redhat.com>
> ---
>  testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> index 7f0fbca..d6092d9 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> @@ -59,6 +59,7 @@ static long huge_free;
>  static long huge_free2;
>  static long hugepages;
>  static long orig_hugepages;
> +static long orig_shmmax, new_shmmax;
>  
>  static void shared_hugepage(void);
>  
> @@ -128,8 +129,13 @@ void setup(void)
>       tst_require_root(NULL);
>  
>       mem_total = read_meminfo("MemTotal:");
> -     if (mem_total < 2L*1024*1024) {
> -             tst_resm(TCONF, "Test requires more than 2GB of RAM");
> +     SAFE_FILE_SCANF(NULL, PATH_SHMMAX, "%ld", &orig_shmmax);
> +     SAFE_FILE_PRINTF(NULL, PATH_SHMMAX, "%ld", (long)SIZE);
> +     SAFE_FILE_SCANF(NULL, PATH_SHMMAX, "%ld", &new_shmmax);
> +
> +     if (mem_total < 2L*1024*1024 || new_shmmax < SIZE) {
> +             tst_resm(TCONF,
> +                     "Test requires more than 2GB of RAM or need a lager 
> 'shmmax' value for
> testing");
>               tst_exit();
>       }
>  
> @@ -150,4 +156,6 @@ void setup(void)
>  void cleanup(void)
>  {
>       set_sys_tune("nr_hugepages", orig_hugepages, 0);
> +     SAFE_FILE_PRINTF(NULL, PATH_SHMMAX, "%ld", orig_shmmax);
> +
>  }
> --
> 1.8.3.1
> 
> 
> ------------------------------------------------------------------------------
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to