From 245e15a522a22ada54e99e52a94837b36247c4de Mon Sep 17 00:00:00 2001 From: liudanning Date: Thu, 5 May 2022 16:58:20 +0800 Subject: [PATCH] kernel_linux_build: modify sched_rtg test suite Signed-off-by: liudanning --- .../testcases/bin/create_process.sh | 39 +++++++++++++++++++ .../sched_rtg_t/testcases/bin/sched_rtg04.sh | 12 +++--- .../sched_rtg_t/testcases/bin/sched_rtg06.sh | 22 +++-------- 3 files changed, 52 insertions(+), 21 deletions(-) create mode 100644 test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/create_process.sh diff --git a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/create_process.sh b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/create_process.sh new file mode 100644 index 0000000..205ffa6 --- /dev/null +++ b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/create_process.sh @@ -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 \ No newline at end of file diff --git a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh index 061a27e..6cce5ec 100644 --- a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh +++ b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh @@ -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 } diff --git a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg06.sh b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg06.sh index 055c537..264febc 100644 --- a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg06.sh +++ b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg06.sh @@ -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() { -- Gitee