Skip to contentSkip to conversation

iotests/testrunner: fix recognition of python tests

PATCH Applied Vladimir Sementsov-Ogievskiy 4 participants 4 messages Jan 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iotests/testrunner: fix recognition of python tests

We should drop final '\n' before comparing with python3 shebang.

Fixes d74c754c924ca34e90b7c96ce2f5609d82c0e628
---
 tests/qemu-iotests/testrunner.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/testrunner.py +1 -1
index a581be6a29..24b3fba115 100644
@@ -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
Signature · 1 line
2.29.2
Tested-by on v1 1/1
#1 lore raw
Quoted 13 lines · Vladimir Sementsov-Ogievskiy

We should drop final '\n' before comparing with python3 shebang.

Fixes d74c754c924ca34e90b7c96ce2f5609d82c0e628
---
  tests/qemu-iotests/testrunner.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/testrunner.py +0 -0
index a581be6a29..24b3fba115 100644

tests/qemu-iotests/testrunner.py class TestRunner(ContextManager['TestRunner']): · line 254

Quoted 8 lines
tests/qemu-iotests/testrunner.py +1 -1
@@ -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!

Reviewed-by on v1 1/1
#3 lore raw
In reply to Vladimir Sementsov-Ogievskiy
Quoted 4 lines · Vladimir Sementsov-Ogievskiy

We should drop final '\n' before comparing with python3 shebang.

Fixes d74c754c924ca34e90b7c96ce2f5609d82c0e628
Quoted 18 lines
---
  tests/qemu-iotests/testrunner.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/testrunner.py +1 -1
index a581be6a29..24b3fba115 100644
@@ -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