#!/bin/sh # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2009 FUJITSU LIMITED # Copyright (c) 2016 Cyril Hrubis # Copyright (c) 2021 Joerg Vehlow # # Author: Li Zefan # Restructure for LTP: Shi Weihua # Added memcg enable/disable functionality: Rishikesh K Rajak MEMCG_TESTFUNC=test TST_CNT=6 # Test memory.force_empty test1() { start_memcg_process --mmap-anon -s $PAGESIZE echo $MEMCG_PROCESS_PID > tasks signal_memcg_process $PAGESIZE echo $MEMCG_PROCESS_PID > ../tasks # This expects that there is swap configured EXPECT_PASS echo 1 \> memory.force_empty stop_memcg_process $pid } test2() { EXPECT_PASS echo 0 \> memory.force_empty } test3() { EXPECT_PASS echo 1.0 \> memory.force_empty } test4() { EXPECT_PASS echo 1xx \> memory.force_empty } test5() { EXPECT_PASS echo xx \> memory.force_empty } test6() { # writing to non-empty top mem cgroup's force_empty # should return failure EXPECT_FAIL echo 1 \> "$mount_point/memory.force_empty" } . memcg_lib.sh tst_run