Re: [PATCH 4/4] tests: Change handling of reading non blocked empty stream for python3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 08, 2019 at 07:09:22PM +0900, Masashi Honma wrote:
> 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.

That looks excessive pretty ugly. Wouldn't it be simpler to just add
support for None return without separating processing based on version?

I.e., something like this (and well, I'd merge in the applicable
.decode() changes from patch 1/4 to this patch taking into account they
alone do not really fix these same read() lines):

 
diff --git a/tests/hwsim/vm/parallel-vm.py b/tests/hwsim/vm/parallel-vm.py
index df6c19b..d2b0def 100755
--- a/tests/hwsim/vm/parallel-vm.py
+++ b/tests/hwsim/vm/parallel-vm.py
@@ -90,7 +90,10 @@ def vm_read_stdout(vm, i):
 
     ready = False
     try:
-        out = vm['proc'].stdout.read().decode()
+        out = vm['proc'].stdout.read()
+        if out == None:
+            return False
+        out = out.decode()
     except:
         return False
     logger.debug("VM[%d] stdout.read[%s]" % (i, out))
@@ -191,9 +194,11 @@ def show_progress(scr):
             running = True
             first_running = True
             try:
-                err = vm[i]['proc'].stderr.read().decode()
-                vm[i]['err'] += err
-                logger.debug("VM[%d] stderr.read[%s]" % (i, err))
+                err = vm[i]['proc'].stderr.read()
+                if err != None:
+                    err = err.decode()
+                    vm[i]['err'] += err
+                    logger.debug("VM[%d] stderr.read[%s]" % (i, err))
             except:
                 pass
 
@@ -247,8 +252,10 @@ 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:
+                    err = err.decode()
+                    vm[i]['err'] += err
+                    logger.debug("VM[%d] stderr.read[%s]" % (i, err))
             except:
                 pass
 
-- 
Jouni Malinen                                            PGP id EFC895FA

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux