diff mbox series

[1/2,E] UBUNTU: SAUCE: kselftest/runner: avoid using timeout if timeout is disabled

Message ID 20200410105518.521722-2-andrea.righi@canonical.com
State New
Headers show
Series kselftest: properly use timeout | expand

Commit Message

Andrea Righi April 10, 2020, 10:55 a.m. UTC
Avoid using /usr/bin/timeout unnecessarily if timeout is set to 0 in the
"settings" file for a specific test.

NOTE: this change prevents a syscall_restart failure in the seccomp
kselftest.

BugLink: https://bugs.launchpad.net/bugs/1870543

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
---
 tools/testing/selftests/kselftest/runner.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kleber Sacilotto de Souza April 14, 2020, 10:16 a.m. UTC | #1
On 10.04.20 12:55, Andrea Righi wrote:
> Avoid using /usr/bin/timeout unnecessarily if timeout is set to 0 in the
> "settings" file for a specific test.
> 
> NOTE: this change prevents a syscall_restart failure in the seccomp
> kselftest.
> 
> BugLink: https://bugs.launchpad.net/bugs/1870543
> 
> Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
> ---
>  tools/testing/selftests/kselftest/runner.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
> index e84d901f8567..2cd3c8def0f6 100644
> --- a/tools/testing/selftests/kselftest/runner.sh
> +++ b/tools/testing/selftests/kselftest/runner.sh
> @@ -32,7 +32,7 @@ tap_prefix()
>  tap_timeout()
>  {
>  	# Make sure tests will time out if utility is available.
> -	if [ -x /usr/bin/timeout ] ; then
> +	if [ -x /usr/bin/timeout ] && [ $kselftest_timeout -gt 0 ] ; then
>  		/usr/bin/timeout "$kselftest_timeout" "$1"
>  	else
>  		"$1"
> 

Hi Andrea,

Has this patch been sent upstream?

Also, can you please set the nomination on the bug report?


thanks,
Kleber
Andrea Righi April 14, 2020, 11:21 a.m. UTC | #2
On Tue, Apr 14, 2020 at 12:16:10PM +0200, Kleber Souza wrote:
> On 10.04.20 12:55, Andrea Righi wrote:
> > Avoid using /usr/bin/timeout unnecessarily if timeout is set to 0 in the
> > "settings" file for a specific test.
> > 
> > NOTE: this change prevents a syscall_restart failure in the seccomp
> > kselftest.
> > 
> > BugLink: https://bugs.launchpad.net/bugs/1870543
> > 
> > Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
> > ---
> >  tools/testing/selftests/kselftest/runner.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
> > index e84d901f8567..2cd3c8def0f6 100644
> > --- a/tools/testing/selftests/kselftest/runner.sh
> > +++ b/tools/testing/selftests/kselftest/runner.sh
> > @@ -32,7 +32,7 @@ tap_prefix()
> >  tap_timeout()
> >  {
> >  	# Make sure tests will time out if utility is available.
> > -	if [ -x /usr/bin/timeout ] ; then
> > +	if [ -x /usr/bin/timeout ] && [ $kselftest_timeout -gt 0 ] ; then
> >  		/usr/bin/timeout "$kselftest_timeout" "$1"
> >  	else
> >  		"$1"
> > 
> 
> Hi Andrea,
> 
> Has this patch been sent upstream?

Yes:
https://lkml.org/lkml/2020/3/27/205

Kees Cook mentioned it would be nice to have, but it didn't receive an
official ack.

A follow-up on this, this patch was required to workaround a bug that
has been fixed by Cascardo:

https://lkml.org/lkml/2020/4/8/968

So, we don't strictly need this patch, but it's still nice to have,
since it avoids using /usr/bin/timeout when it's not needed.

> 
> Also, can you please set the nomination on the bug report?

I used a pre-existent generic selftest-related bug report for this.
Should I create a separate bug report for this particular issue?

Thanks,
-Andrea
diff mbox series

Patch

diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
index e84d901f8567..2cd3c8def0f6 100644
--- a/tools/testing/selftests/kselftest/runner.sh
+++ b/tools/testing/selftests/kselftest/runner.sh
@@ -32,7 +32,7 @@  tap_prefix()
 tap_timeout()
 {
 	# Make sure tests will time out if utility is available.
-	if [ -x /usr/bin/timeout ] ; then
+	if [ -x /usr/bin/timeout ] && [ $kselftest_timeout -gt 0 ] ; then
 		/usr/bin/timeout "$kselftest_timeout" "$1"
 	else
 		"$1"