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: enhancedf2fs09.sh 15# 16# Description: Hierarchical SSR waterline configuration interface 17# 18# Authors: Li Zhanming - lizhanming3@h-partners.com 19# 20# History: April 8 2022 - init scripts 21# 22################################################################################ 23 24source tst_oh.sh 25 26do_setup() 27{ 28 29} 30 31do_test() 32{ 33 ret=0 34 _ssr_path=/sys/fs/f2fs/${DISK_NAME} 35 36 tst_res TINFO "Start test hierarchical SSR waterline configuration interface." 37 38 init_value1=$(cat $_ssr_path/hc_hot_data_waterline) 39 init_value2=$(cat $_ssr_path/hc_warm_data_waterline) 40 init_value3=$(cat $_ssr_path/hc_hot_node_waterline) 41 init_value4=$(cat $_ssr_path/hc_warm_node_waterline) 42 43 confirm_value hc_hot_data_waterline && 44 confirm_value hc_warm_data_waterline && 45 confirm_value hc_hot_node_waterline && 46 confirm_value hc_warm_node_waterline 47 48 [ $? -ne 0 ] && ret=$(( $ret + 1 )) 49 50 echo 85 > $_ssr_path/hc_hot_data_waterline 51 echo 85 > $_ssr_path/hc_warm_data_waterline 52 echo 85 > $_ssr_path/hc_hot_node_waterline 53 echo 85 > $_ssr_path/hc_warm_node_waterline 54 55 confirm_change_value hc_hot_data_waterline && 56 confirm_change_value hc_warm_data_waterline && 57 confirm_change_value hc_hot_data_waterline && 58 confirm_change_value hc_warm_node_waterline 59 60 [ $? -ne 0 ] && ret=$(( $ret + 1 )) 61 62 if [ $ret -eq 0 ];then 63 tst_res TPASS "Hierarchical SSR waterline configuration interface pass." 64 else 65 tst_res TFAIL "Hierarchical SSR waterline configuration interface failed." 66 fi 67} 68 69confirm_value() 70{ 71 if [ $(cat $_ssr_path/$1) == '80' ];then 72 tst_res TPASS "$1 Value is 80 successfully." 73 return 0 74 else 75 tst_res TFAIL "$1 Value not is 80 failed." 76 return 1 77 fi 78} 79 80confirm_change_value() 81{ 82 if [ $(cat $_ssr_path/$1) == '85' ];then 83 tst_res TPASS "$1 Value is 85 successfully." 84 return 0 85 else 86 tst_res TFAIL "$1 Value not is 85 failed." 87 return 1 88 fi 89} 90 91do_clean() 92{ 93 echo $init_value1 > $_ssr_path/hc_hot_data_waterline 94 echo $init_value2 > $_ssr_path/hc_warm_data_waterline 95 echo $init_value3 > $_ssr_path/hc_hot_node_waterline 96 echo $init_value4 > $_ssr_path/hc_warm_node_waterline 97 98} 99 100do_setup 101do_test 102do_clean 103tst_exit