]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix trace parameter invocation
authorEduardo Abinader <eduardo.abinader@openbossa.org>
Tue, 25 Feb 2014 21:27:03 +0000 (17:27 -0400)
committerJouni Malinen <j@w1.fi>
Tue, 11 Mar 2014 17:09:40 +0000 (19:09 +0200)
If trace-cmd command does not exist, run-tests.py could end up hanging
in a loop waiting for input. Fix this simply by checking whether the
trace-cmd command can be executed sucessfully and exiting the script if
not.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
tests/hwsim/run-tests.py

index b036a08ae2965f5e36a4bda6a0edd83e82af6ec5..1bcf0823d7a092617edfefb77d90ea56fc5ac1bd 100755 (executable)
@@ -108,8 +108,12 @@ class DataCollector(object):
                                                stderr=open('/dev/null', 'w'),
                                                cwd=self._logdir)
             l = self._trace_cmd.stdout.read(7)
-            while not 'STARTED' in l:
+            while self._trace_cmd.poll() is None and not 'STARTED' in l:
                 l += self._trace_cmd.stdout.read(1)
+            res = self._trace_cmd.returncode
+            if res:
+                print "Failed calling trace-cmd: returned exit status %d" % res
+                sys.exit(1)
     def __exit__(self, type, value, traceback):
         if self._tracing:
             self._trace_cmd.stdin.write('DONE\n')