diff mbox series

tests: fix trace-cmd recording with python3

Message ID 20190412112019.18518-1-johannes@sipsolutions.net
State Accepted
Headers show
Series tests: fix trace-cmd recording with python3 | expand

Commit Message

Johannes Berg April 12, 2019, 11:20 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

The change to python3 broke trace-cmd recording, two
strings need to be bytes instead. Fix that.

Also add a flush() that seems to be needed now.

Change-Id: I982ce588a20e5f54690c2d13ab1cfcd45c7a1bc9
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 tests/hwsim/run-tests.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Jouni Malinen April 12, 2019, 6:57 p.m. UTC | #1
On Fri, Apr 12, 2019 at 01:20:19PM +0200, Johannes Berg wrote:
> The change to python3 broke trace-cmd recording, two
> strings need to be bytes instead. Fix that.
> 
> Also add a flush() that seems to be needed now.

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 717d0dfa63e1..940448180a38 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -139,7 +139,7 @@  class DataCollector(object):
                                                stderr=open('/dev/null', 'w'),
                                                cwd=self._logdir)
             l = self._trace_cmd.stdout.read(7)
-            while self._trace_cmd.poll() is None and 'STARTED' not in l:
+            while self._trace_cmd.poll() is None and b'STARTED' not in l:
                 l += self._trace_cmd.stdout.read(1)
             res = self._trace_cmd.returncode
             if res:
@@ -157,7 +157,8 @@  class DataCollector(object):
                 sys.exit(1)
     def __exit__(self, type, value, traceback):
         if self._tracing:
-            self._trace_cmd.stdin.write('DONE\n')
+            self._trace_cmd.stdin.write(b'DONE\n')
+            self._trace_cmd.stdin.flush()
             self._trace_cmd.wait()
         if self._dmesg:
             output = os.path.join(self._logdir, '%s.dmesg' % (self._testname, ))