memcg_failcnt.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. ################################################################################
  3. ## ##
  4. ## Copyright (c) 2009 FUJITSU LIMITED ##
  5. ## ##
  6. ## This program is free software; you can redistribute it and#or modify ##
  7. ## it under the terms of the GNU General Public License as published by ##
  8. ## the Free Software Foundation; either version 2 of the License, or ##
  9. ## (at your option) any later version. ##
  10. ## ##
  11. ## This program is distributed in the hope that it will be useful, but ##
  12. ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
  13. ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
  14. ## for more details. ##
  15. ## ##
  16. ## You should have received a copy of the GNU General Public License ##
  17. ## along with this program; if not, write to the Free Software Foundation, ##
  18. ## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
  19. ## ##
  20. ## Author: Li Zefan <lizf@cn.fujitsu.com> ##
  21. ## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com> ##
  22. ## Added memcg enable/disable functinality: Rishikesh K Rajak ##
  23. ## <risrajak@linux.vnet.ibm.com ##
  24. ## ##
  25. ################################################################################
  26. TCID="memcg_failcnt"
  27. TST_TOTAL=3
  28. . memcg_lib.sh
  29. # Test memory.failcnt
  30. testcase_1()
  31. {
  32. echo $PAGESIZE > memory.limit_in_bytes
  33. malloc_free_memory "--mmap-anon" $(($PAGESIZE*2))
  34. test_failcnt "memory.failcnt"
  35. }
  36. testcase_2()
  37. {
  38. echo $PAGESIZE > memory.limit_in_bytes
  39. malloc_free_memory "--mmap-file" $(($PAGESIZE*2))
  40. test_failcnt "memory.failcnt"
  41. }
  42. testcase_3()
  43. {
  44. echo $PAGESIZE > memory.limit_in_bytes
  45. malloc_free_memory "--shm" $(($PAGESIZE*2))
  46. test_failcnt "memory.failcnt"
  47. }
  48. shmmax_setup
  49. LOCAL_CLEANUP=shmmax_cleanup
  50. run_tests
  51. tst_exit