Skip to contentSkip to conversation

controllers/cpuacct.sh: Fix timeout for cpuacct.sh

PATCH New Xiao Yang 2 participants 3 messages Dec 6, 2018 – Dec 20, 2018

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 controllers/cpuacct.sh: Fix timeout for cpuacct.sh

With commit fbea02a, cpuacct.sh always gets timeout because wait command tries to wait all background processes including the timeout process. We should just wait the processes created for test.

e.g. running cpuacct_1_1 gets the following timeout:
-----------------------------------------------------------
cpuacct 1 TINFO: timeout per run is 0h 5m 0s cpuacct 1 TINFO: cpuacct:
cpuacct 1 TINFO: Creating 1 subgroups each with 1 processes cpuacct 1 TBROK: test killed, timeout!
-----------------------------------------------------------

Fixes fbea02a("lib/tst_test.sh: setup timeout per test run for the shell tests")
---
 testcases/kernel/controllers/cpuacct/cpuacct.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
testcases/kernel/controllers/cpuacct/cpuacct.sh +4 -1
index edd4a98..5e90b05 100755
@@ -41,6 +41,7 @@ TST_TESTFUNC=do_test
 TST_POS_ARGS=2
 TST_USAGE=usage
 TST_NEEDS_ROOT=1
+TST_NEEDS_TMPDIR=1
 
 . tst_test.sh
 
@@ -114,10 +115,12 @@ do_test()
 	for i in `seq 1 $max`; do
 		for j in `seq 1 $nbprocess`; do
 			cpuacct_task $testpath/subgroup_$i/tasks &
+			echo $! >> task_pids
 		done
 	done
 
-	wait
+	for pid in $(cat task_pids); do wait $pid; done
+	rm -f task_pids
 
 	acc=0
 	fails=0
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/1 controllers/cpuacct.sh: Fix timeout for cpuacct.sh

Hi,

Ping :-)

Best Regards,
Xiao Yang

Quoted 44 lines · Xiao Yang

With commit fbea02a, cpuacct.sh always gets timeout because wait command tries to wait all background processes including the timeout process. We should just wait the processes created for test.

e.g. running cpuacct_1_1 gets the following timeout:
-----------------------------------------------------------
cpuacct 1 TINFO: timeout per run is 0h 5m 0s cpuacct 1 TINFO: cpuacct:
cpuacct 1 TINFO: Creating 1 subgroups each with 1 processes cpuacct 1 TBROK: test killed, timeout!
-----------------------------------------------------------

Fixes fbea02a("lib/tst_test.sh: setup timeout per test run for the shell tests")
---
 testcases/kernel/controllers/cpuacct/cpuacct.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
testcases/kernel/controllers/cpuacct/cpuacct.sh +4 -1
index edd4a98..5e90b05 100755
@@ -41,6 +41,7 @@ TST_TESTFUNC=do_test
 TST_POS_ARGS=2
 TST_USAGE=usage
 TST_NEEDS_ROOT=1
+TST_NEEDS_TMPDIR=1
 
 . tst_test.sh
 
@@ -114,10 +115,12 @@ do_test()
 	for i in `seq 1 $max`; do
 		for j in `seq 1 $nbprocess`; do
 			cpuacct_task $testpath/subgroup_$i/tasks &
+			echo $! >> task_pids
 		done
 	done
 
-	wait
+	for pid in $(cat task_pids); do wait $pid; done
+	rm -f task_pids
 
 	acc=0
 	fails=0
#2 lore raw

PATCH 1/1 controllers/cpuacct.sh: Fix timeout for cpuacct.sh

In reply to Xiao Yang

Hi Xiao,

Quoted 12 lines

With commit fbea02a, cpuacct.sh always gets timeout because wait command tries to wait all background processes including the timeout process. We should just wait the processes created for test.

e.g. running cpuacct_1_1 gets the following timeout:
-----------------------------------------------------------
cpuacct 1 TINFO: timeout per run is 0h 5m 0s cpuacct 1 TINFO: cpuacct:
cpuacct 1 TINFO: Creating 1 subgroups each with 1 processes cpuacct 1 TBROK: test killed, timeout!
-----------------------------------------------------------

Quoted 2 lines
Fixes fbea02a("lib/tst_test.sh: setup timeout per test run for the shell tests")

Thanks for your fix, merged.

I look for other plain wait usage, this was the only one using new shell API.

Kind regards,
Petr