diff mbox series

[v2,1/4] tests: Change handling of reading non blocked empty stream for python3

Message ID 20190208225110.9289-1-masashi.honma@gmail.com
State Accepted
Headers show
Series [v2,1/4] tests: Change handling of reading non blocked empty stream for python3 | expand

Commit Message

Masashi Honma Feb. 8, 2019, 10:51 p.m. UTC
The result of reading non blocked empty stream is different between
python2 and 3. The python2 sends "[Errno 11] Resource temporarily
unavailable" exception. The python3 could read "None" without
exception. So separate processing.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 tests/hwsim/vm/parallel-vm.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Jouni Malinen Feb. 11, 2019, 12:51 p.m. UTC | #1
Thanks, all four patches applied.
Masashi Honma Feb. 12, 2019, 12:37 a.m. UTC | #2
On 2019/02/11 21:51, Jouni Malinen wrote:
> Thanks, all four patches applied.

This is the last patch of my python3 compatibility modification.
Thank you again for Jouni and Johannes!

Masashi Honma.
Johannes Berg Feb. 12, 2019, 8:01 a.m. UTC | #3
On Tue, 2019-02-12 at 09:37 +0900, Masashi Honma wrote:
> On 2019/02/11 21:51, Jouni Malinen wrote:
> > Thanks, all four patches applied.
> 
> This is the last patch of my python3 compatibility modification.
> Thank you again for Jouni and Johannes!

No no, thank you!

Are you going to send a patch also to switch the default to python3?

johannes
Masashi Honma Feb. 12, 2019, 8:52 a.m. UTC | #4
On 2019/02/12 17:01, Johannes Berg wrote:
> No no, thank you!
> 
> Are you going to send a patch also to switch the default to python3?

I will send the patch as RFC.

Masashi Honma.
diff mbox series

Patch

diff --git a/tests/hwsim/vm/parallel-vm.py b/tests/hwsim/vm/parallel-vm.py
index cf7f8df65..e7b51d203 100755
--- a/tests/hwsim/vm/parallel-vm.py
+++ b/tests/hwsim/vm/parallel-vm.py
@@ -91,6 +91,8 @@  def vm_read_stdout(vm, i):
     ready = False
     try:
         out = vm['proc'].stdout.read()
+        if out == None:
+            return False
     except:
         return False
     logger.debug("VM[%d] stdout.read[%s]" % (i, out))
@@ -192,8 +194,9 @@  def show_progress(scr):
             first_running = True
             try:
                 err = vm[i]['proc'].stderr.read()
-                vm[i]['err'] += err
-                logger.debug("VM[%d] stderr.read[%s]" % (i, err))
+                if err != None:
+                    vm[i]['err'] += err
+                    logger.debug("VM[%d] stderr.read[%s]" % (i, err))
             except:
                 pass
 
@@ -246,8 +249,9 @@  def show_progress(scr):
             running = True
             try:
                 err = vm[i]['proc'].stderr.read()
-                vm[i]['err'] += err
-                logger.debug("VM[%d] stderr.read[%s]" % (i, err))
+                if err != None:
+                    vm[i]['err'] += err
+                    logger.debug("VM[%d] stderr.read[%s]" % (i, err))
             except:
                 pass