From 8b414131703c3f07142205947b2fb44f53a8ba06 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 10 Sep 2020 16:12:44 -0700 Subject: [PATCH] auto-t: harden testHotspot This test occationally failed, and it uses the old style of waiting for connected on the network object instead of the device object. The hwsim rule was also moved ahead of the IWD() initializer which ensures that IWD doesn't scan before the rule can be set/processed. --- autotests/testHotspot/anqp_delay_test.py | 11 ++++++----- autotests/testHotspot/hessid_test.py | 4 ++-- autotests/testHotspot/hotspot_test.py | 4 ++-- autotests/testHotspot/roaming_test.py | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/autotests/testHotspot/anqp_delay_test.py b/autotests/testHotspot/anqp_delay_test.py index 431f16c1..adfa57fc 100644 --- a/autotests/testHotspot/anqp_delay_test.py +++ b/autotests/testHotspot/anqp_delay_test.py @@ -23,10 +23,8 @@ class Test(unittest.TestCase): rule0 = hwsim.rules.create() rule0.source = bss_radio.addresses[0] rule0.bidirectional = True - # Force the case where ANQP does not finish before Connect() comes in - rule0.delay = 100 - wd = IWD(True, '/tmp') + wd = IWD(True) hapd = HostapdCLI(config='ssidHotspot.conf') @@ -53,12 +51,15 @@ class Test(unittest.TestCase): condition = 'not obj.connected' wd.wait_for_object_condition(ordered_network.network_object, condition) + # Force the case where ANQP does not finish before Connect() comes in + rule0.delay = 100 + ordered_network.network_object.connect() rule0.delay = 1 - condition = 'obj.connected' - wd.wait_for_object_condition(ordered_network.network_object, condition) + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) testutil.test_iface_operstate() testutil.test_ifaces_connected(device.name, hapd.ifname) diff --git a/autotests/testHotspot/hessid_test.py b/autotests/testHotspot/hessid_test.py index f511fd62..d22c5d61 100644 --- a/autotests/testHotspot/hessid_test.py +++ b/autotests/testHotspot/hessid_test.py @@ -42,8 +42,8 @@ class Test(unittest.TestCase): ordered_network.network_object.connect() - condition = 'obj.connected' - wd.wait_for_object_condition(ordered_network.network_object, condition) + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) testutil.test_iface_operstate() testutil.test_ifaces_connected(device.name, hapd.ifname) diff --git a/autotests/testHotspot/hotspot_test.py b/autotests/testHotspot/hotspot_test.py index 0f18fae1..4fb6b071 100644 --- a/autotests/testHotspot/hotspot_test.py +++ b/autotests/testHotspot/hotspot_test.py @@ -42,8 +42,8 @@ class Test(unittest.TestCase): ordered_network.network_object.connect() - condition = 'obj.connected' - wd.wait_for_object_condition(ordered_network.network_object, condition) + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) testutil.test_iface_operstate() testutil.test_ifaces_connected(device.name, hapd.ifname) diff --git a/autotests/testHotspot/roaming_test.py b/autotests/testHotspot/roaming_test.py index a7274a82..52d89f84 100644 --- a/autotests/testHotspot/roaming_test.py +++ b/autotests/testHotspot/roaming_test.py @@ -42,8 +42,8 @@ class Test(unittest.TestCase): ordered_network.network_object.connect() - condition = 'obj.connected' - wd.wait_for_object_condition(ordered_network.network_object, condition) + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) testutil.test_iface_operstate() testutil.test_ifaces_connected(device.name, hapd.ifname)