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