• 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# 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: mem_debug08.sh
18#
19# Description:  Ashmem information display test
20#
21# Authors:     Wangyuting - wangyuting36@huawei.com
22#
23# History:     Mar 23 2022 - init scripts
24#
25################################################################################
26source tst_oh.sh
27
28do_setup()
29{
30
31}
32
33do_test()
34{
35    # find ashmem process
36    local pid=$(cat /proc/ashmem_process_info | awk 'NR>3 && $2!="" {print $2}' | sort -u)
37    local line=$(cat /proc/ashmem_process_info | awk 'NR>3 && $2!="" {print $2}' | sort -u | wc -l)
38    if [ $line -eq 0 ]; then
39        tst_res TFAIL "Cannot find program with ashmen!"
40    else
41        tst_res TPASS "The following $line ashmem processes have been found(PID): $pid."
42    fi
43
44    # Confirm that each process ashmem information is correct
45    for p in $pid
46    do
47        tst_res TINFO "now going to check $p ashmem information"
48        ash_info_check $p
49    done
50
51}
52
53ash_info_check()
54{
55    local pid=$1
56    tst_res TINFO "pid is $pid ."
57
58    local ashmem_info_lines=$(cat /proc/$pid/smaps | grep ashmem | wc -l)
59
60    if [ $ashmem_info_lines -le 0 ]; then
61        tst_res TFAIL "Cannot find ashmem information of $pid .Ashmem information display test failed!"
62    else
63        tst_res TPASS "$pid totally found $ashmem_info_lines ashmem messages.Ashmem information display test pass."
64    fi
65}
66
67do_clean()
68{
69
70}
71
72do_setup
73do_test
74do_clean
75tst_exit