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