Return-Path: Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZKQlK-0007VJ-Ug for ltp-list@lists.sourceforge.net; Wed, 29 Jul 2015 12:47:10 +0000 Received: from mx3-phx2.redhat.com ([209.132.183.24]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1ZKQlJ-000876-GT for ltp-list@lists.sourceforge.net; Wed, 29 Jul 2015 12:47:10 +0000 Date: Wed, 29 Jul 2015 08:47:03 -0400 (EDT) From: Jan Stancek Message-ID: <394151457.400639.1438174023219.JavaMail.zimbra@redhat.com> In-Reply-To: <1437559327-22256-1-git-send-email-liwang@redhat.com> References: <1437559327-22256-1-git-send-email-liwang@redhat.com> MIME-Version: 1.0 Subject: Re: [LTP] [Patch v2] mem/hugeshmat04: check if system 'shmmax' large enough List-Id: Linux Test Project General Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-list-bounces@lists.sourceforge.net To: Li Wang Cc: ltp-list@lists.sourceforge.net ----- Original Message ----- > From: "Li Wang" > 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 > --- > 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