provisioning : tweak example test timeouts to reduce failures

This commit is contained in:
Anurag Kar 2018-11-08 13:14:54 +05:30
parent 647145a734
commit 3fe8065b7f
4 changed files with 12 additions and 6 deletions

View file

@ -53,11 +53,11 @@ def test_examples_provisioning_ble(env, extra_data):
dut1.start_app()
# Parse BLE devname
devname = dut1.expect(re.compile(r"(?:[\s\S]*) Provisioning started with BLE devname : (PROV_\S\S\S\S\S\S)"))[0]
devname = dut1.expect(re.compile(r"Provisioning started with BLE devname : '(PROV_\S\S\S\S\S\S)'"), timeout=60)[0]
print("BLE Device Alias for DUT :", devname)
# Match additional headers sent in the request
dut1.expect("BLE Provisioning started")
dut1.expect("BLE Provisioning started", timeout=30)
print("Starting Provisioning")
verbose = False

View file

@ -114,7 +114,7 @@ static esp_err_t app_prov_start_service(void)
return ESP_FAIL;
}
ESP_LOGI(TAG, "Provisioning started with BLE devname : %s", config.device_name);
ESP_LOGI(TAG, "Provisioning started with BLE devname : '%s'", config.device_name);
return ESP_OK;
}

View file

@ -54,9 +54,9 @@ def test_examples_provisioning_softap(env, extra_data):
dut1.start_app()
# Parse IP address of STA
dut1.expect("Starting WiFi SoftAP provisioning")
dut1.expect("SoftAP started")
[ssid, password] = dut1.expect(re.compile(r"(?:[\s\S]*)SoftAP Provisioning started with SSID '(\S+)', Password '(\S+)'"))
dut1.expect("Starting WiFi SoftAP provisioning", timeout=60)
dut1.expect("SoftAP started", timeout=30)
[ssid, password] = dut1.expect(re.compile(r"SoftAP Provisioning started with SSID '(\S+)', Password '(\S+)'"), timeout=30)
iface = wifi_tools.get_wiface_name()
if iface == None:
@ -68,6 +68,9 @@ def test_examples_provisioning_softap(env, extra_data):
ctrl = wifi_tools.wpa_cli(iface, reset_on_exit = True)
print("Connecting to DUT SoftAP...")
ip = ctrl.connect(ssid, password)
got_ip = dut1.expect(re.compile(r"softAP assign IP to station,IP is: (\d+.\d+.\d+.\d+)"), timeout=30)[0]
if ip != got_ip:
raise RuntimeError("SoftAP connected to another host! " + ip + "!=" + got_ip)
print("Connected to DUT SoftAP")
print("Starting Provisioning")

View file

@ -126,6 +126,8 @@ class BLE_Bluez_Client:
break
if srv_path == None:
self.device.Disconnect(dbus_interface='org.bluez.Device1')
self.device = None
raise RuntimeError("Provisioning service not found")
self.characteristics = dict()
@ -148,6 +150,7 @@ class BLE_Bluez_Client:
self.device.Disconnect(dbus_interface='org.bluez.Device1')
if self.adapter:
self.adapter.RemoveDevice(self.device)
self.device = None
if self.adapter_props:
self.adapter_props.Set("org.bluez.Adapter1", "Powered", dbus.Boolean(0))