Sometimes, the testcase fail like:
        hugeshmat04    0  TINFO  :  set nr_hugepages to 512
        hugeshmat04    1  TBROK  :  hugeshmat04.c:103: shmget: 
errno=EINVAL(22): Invalid argument
        hugeshmat04    2  TBROK  :  hugeshmat04.c:103: Remaining cases broken
        hugeshmat04    0  TINFO  :  set nr_hugepages to 0

The testbed info:
        # cat /proc/sys/kernel/shmmax
        536870912
        # uname -r
        3.10.0-295.el7.x86_64

The reason is that the 'shmmax' of a system is not enough for shmget() function 
to get 1G memory.
On RHEL7 system, we have a BUG to enlarge this value, but I can't guarantee 
this programe could
running well with other distribution. So, a proposed path as follow:

Signed-off-by: Li Wang <liw...@redhat.com>
---
 testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c 
b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
index 7f0fbca..aeac3f7 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
@@ -123,13 +123,15 @@ void shared_hugepage(void)
 
 void setup(void)
 {
-       long mem_total, hpage_size;
+       long mem_total, hpage_size, shmmax;
 
        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", &shmmax);
+       if (mem_total < 2L*1024*1024 || shmmax < SIZE) {
+               tst_resm(TCONF,
+                       "Test requires more than 2GB of RAM or need a lager 
'shmmax' value for testing");
                tst_exit();
        }
 
-- 
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

Reply via email to