From patchwork Mon Jun 12 06:29:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 774441 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wmNMY0HL4z9rxm for ; Mon, 12 Jun 2017 16:31:21 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZodaQTac"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=lOTDNCrM84XHKWJ7CH5B0jpwfdNvGgHwxwIXnyt9qt8=; b=Zod aQTacre0JRVElbQzVM9iOWmmVcBWJxAWu88ke05T0BMylJNQVdp52te5JDHbnyqwlbwNX/YTFcFR/ QOR0O9cEFbJq4xI01sQn3T28nv0ytvtOrsV4LCOG4w4Hr5hL2J+NdAn9EUcmu4B4raJuCnKzUAWv/ QD55OaEJFgrlt3GU42Dh0bTwuRvhIEERWxt6hiSYhoLD3DJwaxjMbFTHlJen6JP0Rbi0qJBLungI5 eaYCSQwQkuI6ASXcUZNwsBFqVAilbOoK8JzkizNW7+qhNKuIyNEmQCeVPgykjwE4hgnRnVGfZMikc byqq3+003UYZO3gMf7Z9WiP1kMfERUg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dKIsH-00059v-Q3; Mon, 12 Jun 2017 06:30:53 +0000 Received: from mga05.intel.com ([192.55.52.43]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dKIsE-00057j-6N for hostap@lists.infradead.org; Mon, 12 Jun 2017 06:30:51 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP; 11 Jun 2017 23:30:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.39,332,1493708400"; d="scan'208"; a="1140291628" Received: from jel00350.jer.intel.com (HELO TEMPHOSTNAME.ger.corp.intel.com) ([10.12.217.225]) by orsmga001.jf.intel.com with ESMTP; 11 Jun 2017 23:30:31 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Subject: [PATCH] tests: Make wnm_bss_tm_req_with_mbo_ie more robust Date: Mon, 12 Jun 2017 09:29:28 +0300 Message-Id: <1497248968-25795-2-git-send-email-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170611_233050_260039_DE1F62CC X-CRM114-Status: UNSURE ( 8.36 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.55.52.43 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrei Otcheretianski MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On slow machines or inside VM it may take some time for "DISCONNECTED" event to arrive. Since the retry delay counter is started already, it may result in less than 5 seconds time between "DISCONNECTED" and "CONNECTED" events. Fix the test by taking more accurate timestamps between the events. Signed-off-by: Andrei Otcheretianski --- tests/hwsim/test_wnm.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py index 4a526a8..eeb2350 100644 --- a/tests/hwsim/test_wnm.py +++ b/tests/hwsim/test_wnm.py @@ -16,6 +16,7 @@ import hostapd from wpasupplicant import WpaSupplicant from utils import alloc_fail, fail_test, wait_fail_trigger from wlantest import Wlantest +from datetime import datetime @remote_compatible def test_wnm_bss_transition_mgmt(dev, apdev): @@ -1548,6 +1549,8 @@ def test_wnm_bss_tm_req_with_mbo_ie(dev, apdev): if ev is None or "reason=3" not in ev: raise Exception("Timeout waiting for MBO-TRANSITION-REASON event") + t0 = datetime.now() + ev = hapd.wait_event(['BSS-TM-RESP'], timeout=10) if ev is None: raise Exception("No BSS Transition Management Response") @@ -1562,16 +1565,16 @@ def test_wnm_bss_tm_req_with_mbo_ie(dev, apdev): if 'OK' not in dev[0].request("SCAN_INTERVAL 1"): raise Exception("Failed to set scan interval") + # Wait until connected + ev = dev[0].wait_event(['CTRL-EVENT-CONNECTED'], 10) + if ev is None: + raise Exception("Station did not connect") + # Make sure no connection is made during the retry delay - ev = dev[0].wait_event(['CTRL-EVENT-CONNECTED'], 5) - if ev is not None: + time_diff = datetime.now() - t0 + if time_diff.total_seconds() < 5: raise Exception("Station connected before assoc retry delay was over") - # After the assoc retry delay is over, we can reconnect - ev = dev[0].wait_event(['CTRL-EVENT-CONNECTED'], 5) - if ev is None: - raise Exception("Station did not connect after assoc retry delay is over") - if "OK" not in dev[0].request("SET mbo_cell_capa 3"): raise Exception("Failed to set STA as cellular data not-capable")