All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] controllers/cpuacct.sh: Fix timeout for cpuacct.sh
@ 2018-12-06  9:05 Xiao Yang
  2018-12-20  6:05 ` Xiao Yang
  2018-12-20 14:22 ` Petr Vorel
  0 siblings, 2 replies; 3+ messages in thread
From: Xiao Yang @ 2018-12-06  9:05 UTC (permalink / raw)
  To: ltp

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")
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 testcases/kernel/controllers/cpuacct/cpuacct.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cpuacct/cpuacct.sh b/testcases/kernel/controllers/cpuacct/cpuacct.sh
index edd4a98..5e90b05 100755
--- a/testcases/kernel/controllers/cpuacct/cpuacct.sh
+++ b/testcases/kernel/controllers/cpuacct/cpuacct.sh
@@ -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
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH] controllers/cpuacct.sh: Fix timeout for cpuacct.sh
  2018-12-06  9:05 [LTP] [PATCH] controllers/cpuacct.sh: Fix timeout for cpuacct.sh Xiao Yang
@ 2018-12-20  6:05 ` Xiao Yang
  2018-12-20 14:22 ` Petr Vorel
  1 sibling, 0 replies; 3+ messages in thread
From: Xiao Yang @ 2018-12-20  6:05 UTC (permalink / raw)
  To: ltp

Hi,

Ping :-)

Best Regards,
Xiao Yang
On 2018/12/06 17:05, Xiao Yang wrote:
> 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")
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  testcases/kernel/controllers/cpuacct/cpuacct.sh | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/controllers/cpuacct/cpuacct.sh b/testcases/kernel/controllers/cpuacct/cpuacct.sh
> index edd4a98..5e90b05 100755
> --- a/testcases/kernel/controllers/cpuacct/cpuacct.sh
> +++ b/testcases/kernel/controllers/cpuacct/cpuacct.sh
> @@ -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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] [PATCH] controllers/cpuacct.sh: Fix timeout for cpuacct.sh
  2018-12-06  9:05 [LTP] [PATCH] controllers/cpuacct.sh: Fix timeout for cpuacct.sh Xiao Yang
  2018-12-20  6:05 ` Xiao Yang
@ 2018-12-20 14:22 ` Petr Vorel
  1 sibling, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2018-12-20 14:22 UTC (permalink / raw)
  To: ltp

Hi Xiao,

> 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")
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Thanks for your fix, merged.

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

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-20 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06  9:05 [LTP] [PATCH] controllers/cpuacct.sh: Fix timeout for cpuacct.sh Xiao Yang
2018-12-20  6:05 ` Xiao Yang
2018-12-20 14:22 ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.