diff mbox series

tests: remotehost: disable pipe buffering

Message ID 20211024194749.521690-1-janusz.dziedzic@gmail.com
State Accepted
Headers show
Series tests: remotehost: disable pipe buffering | expand

Commit Message

Janusz Dziedzic Oct. 24, 2021, 7:47 p.m. UTC
Before, we could loose some events
because of pipe buffering. I saw this problem
when run "ubus listen" or "logread -f" waiting some
specific events.
After disable buffering works much better.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
---
 tests/hwsim/remotehost.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jouni Malinen Dec. 12, 2021, 9:33 p.m. UTC | #1
On Sun, Oct 24, 2021 at 09:47:49PM +0200, Janusz Dziedzic wrote:
> Before, we could loose some events
> because of pipe buffering. I saw this problem
> when run "ubus listen" or "logread -f" waiting some
> specific events.
> After disable buffering works much better.

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py
index 0799b951f..14c3559ff 100644
--- a/tests/hwsim/remotehost.py
+++ b/tests/hwsim/remotehost.py
@@ -24,7 +24,7 @@  def execute_thread(command, reply):
     err = tempfile.TemporaryFile()
     try:
         status = 0
-        buf = subprocess.check_output(command, stderr=err).decode()
+        buf = subprocess.check_output(command, stderr=err, bufsize=0).decode()
     except subprocess.CalledProcessError as e:
         status = e.returncode
         err.seek(0)
@@ -181,7 +181,7 @@  class Host():
         _cmd = self.name + " proc_run: " + ' '.join(cmd)
         logger.debug(_cmd)
         err = tempfile.TemporaryFile()
-        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=err)
+        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=err, bufsize=0)
         proc.reaper_file = filename
         return proc