• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2################################################################################
3#
4# Copyright (C) 2022 Huawei Device Co., Ltd.
5# SPDX-License-Identifier: GPL-2.0
6#
7# Legacy blkg rwstat helpers enabled by CONFIG_BLK_CGROUP_RWSTAT.
8# Do not use in new code.
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16################################################################################
17# File: mem_dubug09.sh
18#
19# Description: /sys/module/reclaim_acct/parameters/disable interface test
20#              0: valid disable
21#              nonzero: reserved
22#
23# Authors:     Wang Yuting - wangyuting36@huawei.com
24#
25# History:     May 26 2022 - init scripts
26#
27################################################################################
28
29source tst_oh.sh
30
31do_setup()
32{
33    zcat /proc/config.gz | grep CONFIG_RECLAIM_ACCT=y || tst_res TCONF "CONFIG_RECLAIM_ACCT=y not satisfied!"
34    reclaim_acct_disable="/sys/module/reclaim_acct/parameters/disable"
35    reclaim_acct_disable_def=$(cat /sys/module/reclaim_acct/parameters/disable)
36}
37
38do_test()
39{
40    set_check_disable 0 0
41    set_check_disable -1 -1
42}
43
44set_check_disable()
45{
46    local _set_disable=$1
47    local _expect_disable=$2
48
49    echo $_set_disable > $reclaim_acct_disable
50    if [ $? -eq 0 ]; then
51        tst_res TPASS "Interface disable set to $_set_disable expected."
52    else
53        tst_res TFAIL "Interface disable set to $_set_disable unexpected!"
54    fi
55
56    local _cur_disable=$(cat $reclaim_acct_disable)
57    if [ $_cur_disable -eq $_expect_disable ]; then
58        tst_res TPASS "Interface disable $_cur_disable equal to expected value."
59    else
60        tst_res TFAIL "Interface disable $_cur_disable unexpected value $_expect_disable!"
61    fi
62}
63
64do_clean()
65{
66    echo $reclaim_acct_disable_def > $reclaim_acct_disable
67}
68
69do_setup
70do_test
71do_clean
72tst_exit