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