From patchwork Thu Jul 2 13:14:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peer, Ilan" X-Patchwork-Id: 490619 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id 4CF0114029E for ; Thu, 2 Jul 2015 23:16:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 357CB17C65D; Thu, 2 Jul 2015 09:16:19 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kZCqIFl5HXuk; Thu, 2 Jul 2015 09:16:18 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id CDB0717C65E; Thu, 2 Jul 2015 09:15:34 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id C901F17C64A for ; Thu, 2 Jul 2015 09:15:31 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0tiM4Hr1ASAd for ; Thu, 2 Jul 2015 09:15:27 -0400 (EDT) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 4F8DC17C64B for ; Thu, 2 Jul 2015 09:15:21 -0400 (EDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 02 Jul 2015 06:15:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,393,1432623600"; d="scan'208";a="721729440" Received: from unknown (HELO ipeer-dev-3.jer.intel.com) ([10.12.217.137]) by orsmga001.jf.intel.com with ESMTP; 02 Jul 2015 06:15:19 -0700 From: Ilan Peer To: hostap@lists.shmoo.com Subject: [PATCH 2/9] tests: Wait for scan to complete on all interfaces in reset() Date: Thu, 2 Jul 2015 16:14:53 +0300 Message-Id: <1435842900-25523-3-git-send-email-ilan.peer@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435842900-25523-1-git-send-email-ilan.peer@intel.com> References: <1435842900-25523-1-git-send-email-ilan.peer@intel.com> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Andrei Otcheretianski When wpasupplicant executes reset() it waits until all the ongoing scans are completed. However it checks the status of the wlanX interface only. If a dedicated P2P device interface is used, scan may be still running on the P2P Device interface, e.g., P2P_FIND. This might affect subsequent tests. Fix this by waiting until the scan is done both on wlanX and P2P Device interfaces. Signed-off-by: Andrei Otcheretianski Reviewed-by: Ilan Peer --- tests/hwsim/wpasupplicant.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 4323ff5..1531969 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -138,8 +138,10 @@ class WpaSupplicant: iter = 0 while iter < 60: - state = self.get_driver_status_field("scan_state") - if "SCAN_STARTED" in state or "SCAN_REQUESTED" in state: + state1 = self.get_driver_status_field("scan_state") + state2 = self.get_driver_status_field("scan_state", ifname="p2p-dev-" + self.ifname) + states = str(state1) + " " + str(state2) + if "SCAN_STARTED" in states or "SCAN_REQUESTED" in states: logger.info(self.ifname + ": Waiting for scan operation to complete before continuing") time.sleep(1) else: @@ -354,8 +356,11 @@ class WpaSupplicant: return vals[field] return None - def get_driver_status(self): - res = self.request("STATUS-DRIVER") + def get_driver_status(self, ifname=None): + if ifname is None: + res = self.request("STATUS-DRIVER") + else: + res = self.global_request("IFNAME=%s STATUS-DRIVER" % ifname) lines = res.splitlines() vals = dict() for l in lines: @@ -367,8 +372,8 @@ class WpaSupplicant: vals[name] = value return vals - def get_driver_status_field(self, field): - vals = self.get_driver_status() + def get_driver_status_field(self, field, ifname=None): + vals = self.get_driver_status(ifname) if field in vals: return vals[field] return None