]> granicus.if.org Git - esp-idf/commitdiff
provisioning : tweak example test timeouts to reduce failures
authorAnurag Kar <anurag.kar@espressif.com>
Thu, 8 Nov 2018 07:44:54 +0000 (13:14 +0530)
committerAnurag Kar <anurag.kar@espressif.com>
Thu, 13 Dec 2018 05:31:33 +0000 (11:01 +0530)
examples/provisioning/ble_prov/ble_prov_test.py
examples/provisioning/ble_prov/main/app_prov.c
examples/provisioning/softap_prov/softap_prov_test.py
tools/esp_prov/transport/ble_cli.py

index 537dc93099b4f35129de18df4e1e8a39b408cb93..55da793e37cc9dfcab97ebbbde8276de67e23b09 100644 (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
index b574513ce44cc4d022b0bfeb62dc9a9265faf670..0ab4df47086c3220ffbc97bab4c45f20453251a1 100644 (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;
 }
 
index d986847d8eb84fad1fe7fcfa0087aaa15041afb1..2abd9e7c7c0ba9827df4027c0c333c8a550dc448 100644 (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")
index d8b2dff8824111b85077087b07b3b5a9c2ecda27..9ba46a6951441e7229511f9d36963f2dbdbb33bd 100644 (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))