<div dir="ltr">Right, Jouni.  <br><br>Gonna do that.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 24, 2014 at 5:23 PM, Jouni Malinen <span dir="ltr">&lt;<a href="mailto:j@w1.fi" target="_blank">j@w1.fi</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Mon, Feb 24, 2014 at 04:25:03PM -0400, Eduardo Abinader wrote:<br>
&gt; This patch avoids run-tests to keep hanging in a loop,<br>
&gt; by simply checking inexistence of trace-cmd command<br>
&gt; and exiting the script.<br>
<br>
</div>&gt; diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py<br>
<div class="">&gt; @@ -102,6 +102,11 @@ class DataCollector(object):<br>
&gt;      def __enter__(self):<br>
&gt;          if self._tracing:<br>
&gt;              output = os.path.join(self._logdir, &#39;%s.dat&#39; % (self._testname, ))<br>
&gt; +            if subprocess.call([&quot;type trace-cmd&quot;], shell=True,<br>
&gt; +                               stdout=subprocess.PIPE,<br>
&gt; +                               stderr=subprocess.PIPE):<br>
&gt; +                print &quot;failed: trace-cmd not found&quot;<br>
&gt; +                sys.exit(1)<br>
&gt;              self._trace_cmd = subprocess.Popen([&#39;sudo&#39;, &#39;trace-cmd&#39;, &#39;record&#39;, &#39;-o&#39;, output, &#39;-e&#39;, &#39;mac80211&#39;, &#39;-e&#39;, &#39;cfg80211&#39;, &#39;sh&#39;, &#39;-c&#39;, &#39;echo STARTED ; read l&#39;],<br>

&gt;                                                 stdin=subprocess.PIPE,<br>
&gt;                                                 stdout=subprocess.PIPE,<br>
<br>
</div>That looks pretty ugly.. Isn&#39;t there any convenient way of making the<br>
following loop break out in case the popen call exits? That would sound<br>
quite a bit cleaner and also free of (admittedly theoretical) race<br>
condition on trace-cmd disappearing between the two calls.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Jouni Malinen                                            PGP id EFC895FA<br>
_______________________________________________<br>
HostAP mailing list<br>
<a href="mailto:HostAP@lists.shmoo.com">HostAP@lists.shmoo.com</a><br>
<a href="http://lists.shmoo.com/mailman/listinfo/hostap" target="_blank">http://lists.shmoo.com/mailman/listinfo/hostap</a><br>
</font></span></blockquote></div><br></div>