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: enhancedswap03.sh
15#
16# Description: enhanced swap /dev/memcg/memory.zram_wm_ratio interface test
17#
18# Authors:     Ma Feng - mafeng.ma@huawei.com
19#
20# History:     Mar 24 2022 - init scripts
21#
22################################################################################
23source tst_oh.sh
24
25do_setup()
26{
27
28}
29
30do_test()
31{
32    local ret=0
33    local res=0
34    local zram_wm_ratio=/dev/memcg/memory.zram_wm_ratio
35
36    tst_res TINFO "Start enhanced swap $zram_wm_ratio interface test"
37    echo -1 > $zram_wm_ratio
38    ret=$(($ret + $?))
39    echo 101 > $zram_wm_ratio
40    ret=$(($ret + $?))
41
42    if [ $ret -ne 2 ]; then
43        res=$(($res + 1))
44    fi
45
46    if [ $res -eq 0 ]; then
47        tst_res TPASS "enhanced swap $zram_wm_ratio interface test pass."
48    else
49        tst_res TFAIL "enhanced swap $zram_wm_ratio interface test failed!"
50    fi
51}
52
53do_clean()
54{
55
56}
57
58do_setup
59do_test
60do_clean
61tst_exit