]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Make dbus_p2p_discovery more robust
authorJouni Malinen <j@w1.fi>
Sat, 17 Feb 2018 15:21:05 +0000 (17:21 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 17 Feb 2018 15:21:05 +0000 (17:21 +0200)
Ignore any unexpected deviceLost event before the peer devices has been
discovered. This works around issues where the previous test case
terminates before the D-Bus events have been fully delivered. This could
happen, e.g., when running dbus_p2p_discovery twice in a row.

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

index 03249cf030e8fd36df4a0bb75183db2e5e651be0..280148c332624e95d41b82e088f25f73e60462bf 100644 (file)
@@ -3060,6 +3060,12 @@ def test_dbus_p2p_discovery(dev, apdev):
 
         def deviceLost(self, path):
             logger.debug("deviceLost: path=%s" % path)
+            if not self.found or not self.found2:
+                # This may happen if a previous test case ended up scheduling
+                # deviceLost event and that event did not get delivered before
+                # starting the next test execution.
+                logger.debug("Ignore deviceLost before the deviceFound events")
+                return
             self.lost = True
             try:
                 p2p.RejectPeer(path)