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: enhancedf2fs08.sh 15# 16# Description: Hierarchical SSR threshold 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 threshold configuration interface." 37 38 init_value1=$(cat $_ssr_path/hc_hot_data_lower_limit) 39 init_value2=$(cat $_ssr_path/hc_warm_data_lower_limit) 40 init_value3=$(cat $_ssr_path/hc_hot_node_lower_limit) 41 init_value4=$(cat $_ssr_path/hc_warm_node_lower_limit) 42 43 confirm_value hc_hot_data_lower_limit && 44 confirm_value hc_warm_data_lower_limit && 45 confirm_value hc_hot_node_lower_limit && 46 confirm_value hc_warm_node_lower_limit 47 48 [ $? -ne 0 ] && ((ret++)) 49 50 echo 6000000 > $_ssr_path/hc_hot_data_lower_limit 51 echo 6000000 > $_ssr_path/hc_warm_data_lower_limit 52 echo 6000000 > $_ssr_path/hc_hot_node_lower_limit 53 echo 6000000 > $_ssr_path/hc_warm_node_lower_limit 54 55 confirm_change_value hc_hot_data_lower_limit && 56 confirm_change_value hc_warm_data_lower_limit && 57 confirm_change_value hc_hot_node_lower_limit && 58 confirm_change_value hc_warm_node_lower_limit 59 60 [ $? -ne 0 ] && ((ret++)) 61 62 if [ $ret -eq 0 ];then 63 tst_res TPASS "hierarchical SSR threshold configuration interface pass." 64 else 65 tst_res TFAIL "Hierarchical SSR threshold configuration interface failed!" 66 fi 67} 68 69confirm_value() 70{ 71 local result_out1=$(cat /sys/fs/f2fs/${DISK_NAME}/$1) 72 if [ "$result_out1" == "5242880" ]; then 73 tst_res TPASS "$1 is 5242880 expected." 74 return 0 75 else 76 tst_res TFAIL "$1 is not 5242880 unexpected!" 77 return 1 78 fi 79} 80 81confirm_change_value() 82{ 83 local result_out2=$(cat /sys/fs/f2fs/${DISK_NAME}/$1) 84 if [ "$result_out2" == "6000000" ]; then 85 tst_res TPASS "$1 is 6000000 expected." 86 else 87 tst_res TFAIL "$1 is not 6000000 unexpected!" 88 return 0 89 fi 90} 91 92do_clean() 93{ 94 echo $init_value1 > $_ssr_path/hc_hot_data_lower_limit 95 echo $init_value2 > $_ssr_path/hc_warm_data_lower_limit 96 echo $init_value3 > $_ssr_path/hc_hot_node_lower_limit 97 echo $init_value4 > $_ssr_path/hc_warm_node_lower_limit 98} 99 100do_setup 101do_test 102do_clean 103tst_exit