From 043a29ecc4ff958ae9176f8568b81aa8d7b3e79a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 15 Mar 2019 13:40:04 +0200 Subject: [PATCH] tests: Clear pending monitor events before starting scan The wait_event() call for scan completion could have processed a previously received event from a prior scan instead of the newly started one. This could result in flush_scan_cache() assuming there are still results in the cache even though the scan request to clear the cache had not even be started yet. Signed-off-by: Jouni Malinen --- tests/hwsim/wpasupplicant.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index bd42350a6..f5cc851d0 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -1050,6 +1050,8 @@ class WpaSupplicant: def scan(self, type=None, freq=None, no_wait=False, only_new=False, passive=False): + if not no_wait: + self.dump_monitor() if type: cmd = "SCAN TYPE=" + type else: