kernel_linux_build: modify sched_rtg test suite

Signed-off-by: liudanning <liudanning@h-partners.com>
This commit is contained in:
liudanning
2022-05-06 15:28:14 +08:00
parent 6673d04251
commit e6d1e860ff
3 changed files with 52 additions and 21 deletions
@@ -0,0 +1,39 @@
#!/bin/sh
################################################################################
#
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
# File: create_process.sh
#
# Description: create process
#
# Authors: liudanning - liudanning@h-partners.com
#
# History: Mar 24 2022 - init scripts
#
################################################################################
rm -rf taskpid.txt
num=$1
for i in $(seq 1 $num); do
#echo "start $i proc ..."
while true; do
((cnt++))
sleep 0.1
done &
local pgid=$!
#echo "pid ${i} $pgid generated"
echo $pgid >> taskpid.txt
done
@@ -52,16 +52,18 @@ do_test()
bytrace -t 10 -b 32000 --overwrite sched ace app disk ohos graphic sync workq ability >/data/mynewtrace.ftrace &
tst_res TINFO "Checking sched RTG trace ..."
sleep 3
echo 0 > $sched_group_id
echo 2 > $sched_group_id
sleep 40
for i in $(seq 1 20);do
echo 0 > $sched_group_id
echo 2 > $sched_group_id
done
sleep 50
cat /data/mynewtrace.ftrace | grep "sched_rtg_task_each" &&
cat /data/mynewtrace.ftrace | grep "find_rtg_cpu" &&
cat /data/mynewtrace.ftrace | grep "sched_rtg_valid_normalized_util"
if [ $? -eq 0 ]; then
tst_res TPASS "trace info no error found."
tst_res TPASS "trace info found."
else
tst_res TFAIL "trace info had error found!"
tst_res TFAIL "trace info no found!"
fi
}
@@ -30,7 +30,7 @@ source tst_oh.sh
do_setup()
{
dmesg -c
PPID=`ps -ef | grep "sched_rtg06.sh" | grep -v grep | awk '{print $3}'`
PPID=$(ps -ef | grep "/sched_rtg06.sh" | grep -v grep | awk '{print $3}')
}
do_test()
@@ -44,7 +44,7 @@ do_test()
stability_test()
{
start_task 41
sh create_process.sh 40
if [ $1 == 'randmom' ]; then
tst_res TINFO "All 40 porcesss join random rtg from 2 to 20"
random_rtg
@@ -60,8 +60,10 @@ stability_test()
all_in_one_rtg
fi
sleep 60
tst_res TINFO "kill 40 processes...."
tst_res TINFO "kill 40 loop processes...."
ps -ef | grep "sched_rtg06.sh" | grep -v "grep" | grep -v ${PPID} | cut -c 9-18 | xargs kill -9
tst_res TINFO "kill 40 task processes...."
ps -ef | grep "create_process" | grep -v "grep" | grep -v ${PPID} | cut -c 9-18 | xargs kill -9
sleep 5
tst_res TINFO "kill process successed."
aa start -b ohos.samples.ecg -a ohos.samples.ecg.default &&
@@ -83,19 +85,7 @@ stability_test()
aa force-stop ohos.samples.ecg
}
start_task()
{
local _num=$1
rm -rf taskpid.txt
for i in $(seq 1 $_num); do
while true; do
((cnt++))
sleep 0.1
done &
local pgid=$!
echo $pgid >> taskpid.txt
done
}
random_rtg()
{