I tried "hugemmap", "hugeshmat", "hugeshmctl", "hugeshmdt" and
"hugeshmget" tests.
And I found several fails in them:
------------<at "${LTPROOT}/testcases/kernel/mem/hugetlb/" directory>
 - ./hugemmap/
   1) hugemmap04   : return code = 2

 - ./hugeshmat/
   2) hugeshmat01  : return code = 6
   3) hugeshmat02  : return code = 6
   4) hugeshmat03  : return code = 2

 - ./hugeshmctl/
   5) hugeshmctl01 : return code = 6
   6) hugeshmctl02 : return code = 6
   7) hugeshmctl03 : return code = 2

 - ./hugeshmdt/
   8) hugeshmdt01  : return code = 6

 - ./hugeshmget/
   9) hugeshmget01 : return code = 2
  10) hugeshmget02 : return code = 6
  11) hugeshmget03 : return code = 6
  12) hugeshmget05 : return code = 2
------------

These tests output following messages:
------------
 a) All tests:
"TBROK  :  Test cannot be continued owning to sufficient availability of
Hugepages on the system"

 b) 2), 3), 5), 6), 8), 10), 11) tests:
"TWARN  :  tst_rmdir(): TESTDIR was NULL; no removal attempted"
------------

Both case a) and case b) are caused by the same reason.

All of case a) failures occured at the following points (for example
hugemmap04):
------------<hugemmap04.c - main()>
        /* Check number of hugepages */
        if (get_no_of_hugepages() <= 0 || hugepages_size() <= 0)
                tst_brkm(TBROK, cleanup, "Test cannot be continued owning to
\
                                sufficient availability of Hugepages on the
system");
------------

I found out that "HugePages_Total" parameter of "/proc/meminfo" file
is set to "0". This caused above TBROK failure. It is environment problem.

But, in this case, tests must not return with TBROK, but with TCONF,
I think.

And, in case b), these tests try to delete "TESTDIR" directory by
calling "tst_rmdir()" function in "cleanup()" function.
But, "TESTDIR" never set if "tst_tmpdir()" function isn't called.
I think that case b)'s tests must not call cleanup() function.

I want to suggest following patch.

Signed-off-by: Tomonori Mitani <mitani@ryobi.co.jp>
Signed-off-by: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
12 files changed