1#! /bin/sh
2
3################################################################################
4##                                                                            ##
5## Copyright (c) 2012 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               ##
19## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
20##                                                                            ##
21################################################################################
22#
23# File :        memcg_move_charge_at_immigrate_test.sh
24# Description:  Tests memory.move_charge_at_immigrate.
25# Author:       Peng Haitao <penght@cn.fujitsu.com>
26# History:      2012/01/16 - Created.
27#
28
29TCID="memcg_move_charge_at_immigrate_test"
30TST_TOTAL=4
31
32. memcg_lib.sh
33
34# Test disable moving charges
35testcase_1()
36{
37	test_move_charge "--mmap-anon" $PAGESIZES $PAGESIZES 0 0 0 $PAGESIZES 0
38}
39
40# Test move anon
41testcase_2()
42{
43	test_move_charge "--mmap-anon --shm --mmap-file" $PAGESIZES \
44		$((PAGESIZES*3)) 1 $PAGESIZES 0 0 $((PAGESIZES*2))
45}
46
47# Test move file
48testcase_3()
49{
50	test_move_charge "--mmap-anon --shm --mmap-file" $PAGESIZES \
51		$((PAGESIZES*3)) 2 0 $((PAGESIZES*2)) $PAGESIZES 0
52}
53
54# Test move anon and file
55testcase_4()
56{
57	test_move_charge "--mmap-anon --shm" $PAGESIZES \
58		$((PAGESIZES*2)) 3 $PAGESIZES $PAGESIZES 0 0
59}
60
61run_tests
62
63tst_exit
64