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: purgeable_mem01.sh 18# 19# Description: Static memory reservation query test 20# 21# Authors: Ke Liu - liuke94@huawei.com 22# 23# History: Nov 2 2022 - init scripts 24# 25################################################################################ 26source tst_oh.sh 27 28do_setup() 29{ 30 zcat /proc/config.gz | grep CONFIG_MEM_PURGEABLE=y || tst_res TCONF "CONFIG_MEM_PURGEABLE=y not satisfied!" 31} 32 33do_test() 34{ 35 local testpath=$(find / -name purgeable_cpp_test | grep -v find) 36 if [ ! $testpath ];then 37 tst_res TFAIL "can not find purgeable_cpp_test!" 38 fi 39 (cd $(echo ${testpath%purgeable_cpp_test});chmod 777 purgeable_cpp_test;./purgeable_cpp_test >mylog.log) 40 if [ $(grep -c -i "ok\|success\|true" ${testpath%purgeable_cpp_test}/mylog.log) -ne '0' ];then 41 tst_res TINFO "purgeable_cpp_test executed success." 42 else 43 tst_res TFAIL "purgeable_cpp_test executed fail!" 44 fi 45 if [ $(grep -c -i "error\|fail\|false" ${testpath%purgeable_cpp_test}/mylog.log) -ne '0' ];then 46 tst_res TFAIL "purgeable_cpp_test test error!" 47 else 48 tst_res TPASS "purgeable_cpp_test test pass." 49 fi 50 rm ${testpath%purgeable_cpp_test}/mylog.log 51 ls ${testpath%purgeable_cpp_test} >log2.log 52 local lastxml=$(tac log2.log | grep purgeable_cpp_test | grep xml| head -n 1) 53 rm ${testpath%purgeable_cpp_test}${lastxml} 54} 55 56do_clean() 57{ 58 rm log2.log 59} 60 61 62do_setup 63do_test 64do_clean 65tst_exit 66