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_force_empty" 29TST_TOTAL=6 30 31. memcg_lib.sh 32 33# Test memory.force_empty 34testcase_1() 35{ 36 memcg_process --mmap-anon -s $PAGESIZE & 37 pid=$! 38 TST_CHECKPOINT_WAIT 0 39 echo $pid > tasks 40 signal_memcg_process $pid $PAGESIZE 41 echo $pid > ../tasks 42 43 # This expects that there is swap configured 44 EXPECT_PASS echo 1 \> memory.force_empty 45 46 stop_memcg_process $pid 47} 48 49testcase_2() 50{ 51 EXPECT_PASS echo 0 \> memory.force_empty 52} 53 54testcase_3() 55{ 56 EXPECT_PASS echo 1.0 \> memory.force_empty 57} 58 59testcase_4() 60{ 61 EXPECT_PASS echo 1xx \> memory.force_empty 62} 63 64testcase_5() 65{ 66 EXPECT_PASS echo xx \> memory.force_empty 67} 68 69testcase_6() 70{ 71 # writing to non-empty top mem cgroup's force_empty 72 # should return failure 73 EXPECT_FAIL echo 1 \> /dev/memcg/memory.force_empty 74} 75 76run_tests 77tst_exit 78