diff mbox series

iotests/testrunner: fix recognition of python tests

Message ID 20210129090616.84145-1-vsementsov@virtuozzo.com
State New
Headers show
Series iotests/testrunner: fix recognition of python tests | expand

Commit Message

Vladimir Sementsov-Ogievskiy Jan. 29, 2021, 9:06 a.m. UTC
We should drop final '\n' before comparing with python3 shebang.

Fixes: d74c754c924ca34e90b7c96ce2f5609d82c0e628
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/testrunner.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Huth Jan. 29, 2021, 9:45 a.m. UTC | #1
On 29/01/2021 10.06, Vladimir Sementsov-Ogievskiy wrote:
> We should drop final '\n' before comparing with python3 shebang.
> 
> Fixes: d74c754c924ca34e90b7c96ce2f5609d82c0e628
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   tests/qemu-iotests/testrunner.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
> index a581be6a29..24b3fba115 100644
> --- a/tests/qemu-iotests/testrunner.py
> +++ b/tests/qemu-iotests/testrunner.py
> @@ -248,7 +248,7 @@ class TestRunner(ContextManager['TestRunner']):
>   
>           with f_test.open(encoding="utf-8") as f:
>               try:
> -                if f.readline() == '#!/usr/bin/env python3':
> +                if f.readline().rstrip() == '#!/usr/bin/env python3':
>                       args.insert(0, self.env.python)
>               except UnicodeDecodeError:  # binary test? for future.
>                   pass

Together with your other patch, this fixes "make vm-build-netbsd" for me, 
thanks!

Tested-by: Thomas Huth <thuth@redhat.com>
Kevin Wolf Jan. 29, 2021, 11:30 a.m. UTC | #2
Am 29.01.2021 um 10:06 hat Vladimir Sementsov-Ogievskiy geschrieben:
> We should drop final '\n' before comparing with python3 shebang.
> 
> Fixes: d74c754c924ca34e90b7c96ce2f5609d82c0e628
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Thanks, applied to the block branch.

Kevin
John Snow Jan. 29, 2021, 5:58 p.m. UTC | #3
On 1/29/21 4:06 AM, Vladimir Sementsov-Ogievskiy wrote:
> We should drop final '\n' before comparing with python3 shebang.
> 
> Fixes: d74c754c924ca34e90b7c96ce2f5609d82c0e628
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Reviewed-by: John Snow <jsnow@redhat.com>

> ---
>   tests/qemu-iotests/testrunner.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
> index a581be6a29..24b3fba115 100644
> --- a/tests/qemu-iotests/testrunner.py
> +++ b/tests/qemu-iotests/testrunner.py
> @@ -248,7 +248,7 @@ class TestRunner(ContextManager['TestRunner']):
>   
>           with f_test.open(encoding="utf-8") as f:
>               try:
> -                if f.readline() == '#!/usr/bin/env python3':
> +                if f.readline().rstrip() == '#!/usr/bin/env python3':
>                       args.insert(0, self.env.python)
>               except UnicodeDecodeError:  # binary test? for future.
>                   pass
>
diff mbox series

Patch

diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index a581be6a29..24b3fba115 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -248,7 +248,7 @@  class TestRunner(ContextManager['TestRunner']):
 
         with f_test.open(encoding="utf-8") as f:
             try:
-                if f.readline() == '#!/usr/bin/env python3':
+                if f.readline().rstrip() == '#!/usr/bin/env python3':
                     args.insert(0, self.env.python)
             except UnicodeDecodeError:  # binary test? for future.
                 pass