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: cpuisolation09.sh 18# 19# Description: check need_cpus node status about CPU isolation 20# 21# Authors: liudanning - liudanning@h-partners.com 22# 23# History: Mar 24 2022 - init scripts 24# 25################################################################################ 26 27source tst_oh.sh 28 29do_setup() 30{ 31 32} 33 34do_test() 35{ 36 local ret=0 37 dir_name=/sys/devices/system/cpu/cpu0/core_ctl 38 need_cpus=${dir_name}/need_cpus 39 40 cat $need_cpus 41 if [ $? -eq 0 ]; then 42 tst_res TPASS "Node need_cpus can be read." 43 else 44 tst_res TFAIL "Node need_cpus status error." 45 ret=$(( $ret + 1 )) 46 fi 47 48 echo 1 > $need_cpus 49 if [ $? -ne 0 ]; then 50 tst_res TPASS "Node need_cpus can be write." 51 else 52 tst_res TFAIL "Node need_cpus status error." 53 ret=$(( $ret + 1 )) 54 fi 55 echo ret=$ret 56 if [ $ret -eq 0 ]; then 57 tst_res TPASS "need_cpus node status is right." 58 else 59 tst_res TFAIL "need_cpus node status is wrong!" 60 fi 61} 62 63do_clean() 64{ 65 66} 67 68do_setup 69do_test 70do_clean 71tst_exit