pytest_wifi_getting_started.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: CC0-1.0
  3. import os.path
  4. from typing import Tuple
  5. import pytest
  6. from pytest_embedded_idf.dut import IdfDut
  7. # @pytest.mark.supported_targets
  8. # This test should support all targets, even between different target types
  9. # For now our CI only support multi dut with esp32
  10. # If you want to enable different target type, please use the following param
  11. # @pytest.mark.parametrize(
  12. # 'count, app_path, target', [
  13. # (2,
  14. # f'{os.path.join(os.path.dirname(__file__), "softAP")}|{os.path.join(os.path.dirname(__file__), "station")}',
  15. # 'esp32|esp32s2'),
  16. # ],
  17. # indirect=True,
  18. # )
  19. @pytest.mark.esp32
  20. @pytest.mark.esp32c3
  21. @pytest.mark.esp32s3
  22. @pytest.mark.wifi_two_dut
  23. @pytest.mark.parametrize(
  24. 'count, app_path', [
  25. (2,
  26. f'{os.path.join(os.path.dirname(__file__), "softAP")}|{os.path.join(os.path.dirname(__file__), "station")}'),
  27. ], indirect=True
  28. )
  29. def test_wifi_getting_started(dut: Tuple[IdfDut, IdfDut]) -> None:
  30. softap = dut[0]
  31. station = dut[1]
  32. ssid = softap.app.sdkconfig.get('ESP_WIFI_SSID')
  33. password = softap.app.sdkconfig.get('ESP_WIFI_PASSWORD')
  34. assert station.app.sdkconfig.get('ESP_WIFI_SSID') == ssid
  35. assert station.app.sdkconfig.get('ESP_WIFI_PASSWORD') == password
  36. tag = 'wifi station'
  37. station.expect(f'{tag}: got ip:', timeout=60)
  38. station.expect(f'{tag}: connected to ap SSID:{ssid} password:{password}', timeout=60)
  39. softap.expect('station .+ join, AID=', timeout=60)
  40. @pytest.mark.esp32c2
  41. @pytest.mark.wifi_two_dut
  42. @pytest.mark.xtal_26mhz
  43. @pytest.mark.parametrize(
  44. 'count, config, baud, app_path', [
  45. (2, 'esp32c2_xtal26m', '74880',
  46. f'{os.path.join(os.path.dirname(__file__), "softAP")}|{os.path.join(os.path.dirname(__file__), "station")}'),
  47. ], indirect=True
  48. )
  49. def test_wifi_getting_started_esp32c2_xtal_26mhz(dut: Tuple[IdfDut, IdfDut]) -> None:
  50. softap = dut[0]
  51. station = dut[1]
  52. assert station.app.sdkconfig['ESP_WIFI_SOFTAP_SUPPORT'] is False
  53. ssid = softap.app.sdkconfig.get('ESP_WIFI_SSID')
  54. password = softap.app.sdkconfig.get('ESP_WIFI_PASSWORD')
  55. assert station.app.sdkconfig.get('ESP_WIFI_SSID') == ssid
  56. assert station.app.sdkconfig.get('ESP_WIFI_PASSWORD') == password
  57. tag = 'wifi station'
  58. station.expect(f'{tag}: got ip:', timeout=60)
  59. station.expect(f'{tag}: connected to ap SSID:{ssid} password:{password}', timeout=60)
  60. softap.expect('station .+ join, AID=', timeout=60)