When there are running tasks in the child group of cgroup, the child
group can't be removed. So fix the order of cleanup and task_kill in
run_cpuacct_test.sh.

Signed-off-by: Xing Gu <gux.f...@cn.fujitsu.com>
---
 .../kernel/controllers/cpuacct/run_cpuacct_test.sh    | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/testcases/kernel/controllers/cpuacct/run_cpuacct_test.sh 
b/testcases/kernel/controllers/cpuacct/run_cpuacct_test.sh
index 88425f8..b31aa45 100755
--- a/testcases/kernel/controllers/cpuacct/run_cpuacct_test.sh
+++ b/testcases/kernel/controllers/cpuacct/run_cpuacct_test.sh
@@ -236,16 +236,16 @@ case ${TEST_NUM} in
        mkdir $cg_path/group_1/group_11/ 2> /dev/null
        if [ $? -ne 0 ]; then
                echo "TFAIL Cannot create cpuacct cgroups Exiting Test"
-               cleanup
                task_kill 2> /dev/null
+               cleanup
                exit 1
        fi
        echo $pid > $cg_path/group_1/group_11/tasks 2> /dev/null
        if [ $? -ne 0 ]; then
                echo "TFAIL Not able to move a task to the cgroup"
                echo "Exiting Test"
-               cleanup 2> /dev/null
                task_kill 2> /dev/null
+               cleanup
                exit 1
        fi
        sleep 5
@@ -262,13 +262,14 @@ case ${TEST_NUM} in
        if [ $status -eq 0 ]; then
                echo
                tst_resm TPASS "$mes test executed successfully"
-               cleanup 2> /dev/null
                task_kill 2> /dev/null
+               cleanup
                exit 0
        else
                echo
                tst_resm TFAIL "$mes test execution Failed"
-               cleanup 2> /dev/null
+               task_kill 2> /dev/null
+               cleanup
                exit 1
        fi
        ;;
@@ -279,8 +280,8 @@ case ${TEST_NUM} in
        mkdir $cg_path/group_1/group_12 2> /dev/null
        if [ $? -ne 0 ]; then
                echo "TFAIL Cannot create cpuacct cgroups Exiting Test"
-               cleanup 2> /dev/null
                task_kill 2> /dev/null
+               cleanup
                exit 1
        fi
 
@@ -292,8 +293,8 @@ case ${TEST_NUM} in
                if [ $? -ne 0 ]; then
                        echo "TFAIL Not able to move task to cgroup"
                        echo "Exiting Test"
-                       cleanup 2> /dev/null
                        task_kill 2> /dev/null
+                       cleanup
                        exit 1
                fi
                nr_tasks
@@ -301,8 +302,8 @@ case ${TEST_NUM} in
                if [ $? -ne 0 ]; then
                        echo "TFAIL Not able to move task to cgroup"
                        echo "Exiting Test"
-                       cleanup 2> /dev/null
                        task_kill 2> /dev/null
+                       cleanup
                        exit 1
                fi
                sleep 2
@@ -321,14 +322,14 @@ case ${TEST_NUM} in
        if [ $status -eq 0 ]; then
                echo
                tst_resm TPASS "$mes test executed successfully"
-               cleanup 2> /dev/null
                task_kill 2> /dev/null
+               cleanup
                exit 0
        else
                echo
                tst_resm TFAIL "$mes test execution Failed"
-               cleanup 2> /dev/null
                task_kill 2> /dev/null
+               cleanup
                exit 1
        fi
        ;;
-- 
1.9.3


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to