]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix sigma_dut_cmd() processing for the return value
authorJouni Malinen <j@w1.fi>
Sat, 12 Mar 2022 17:00:36 +0000 (19:00 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 12 Mar 2022 17:00:36 +0000 (19:00 +0200)
The first sock.recv() may return both the status,RUNNING and the
following status line if the sigma_dut process ends up being faster in
writing the result than the test script is in reading the result. This
resulted in unexpected behavior and odd error messages when parsing the
result in the test cases. Fix this by dropping the status,RUNNING line
from the result in case the buffer includes multiple lines.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_sigma_dut.py

index 0202fc8e8d13397fea64f8ec49f9dd9660a27574..59751e581e7901e970855c1a1a7b80cdb743494b 100644 (file)
@@ -73,12 +73,12 @@ def sigma_dut_cmd(cmd, port=9000, timeout=2):
         for line in res.splitlines():
             if line.startswith("status,RUNNING"):
                 running = True
-            elif line.startswith("status,INVALID"):
-                done = True
-            elif line.startswith("status,ERROR"):
-                done = True
-            elif line.startswith("status,COMPLETE"):
+            elif line.startswith("status,INVALID") or \
+                 line.startswith("status,ERROR") or \
+                 line.startswith("status,COMPLETE"):
                 done = True
+                res = line
+                break
         if running and not done:
             # Read the actual response
             res = sock.recv(1000).decode()