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