From c258ef705e4727acb1ec2f0ad29a6c5b2e4f6c15 Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Thu, 13 Oct 2022 18:32:28 +0800 Subject: [PATCH] CI: optimize wifi get started example test --- .gitlab/ci/target-test.yml | 6 +++--- .../getting_started/pytest_wifi_getting_started.py | 10 ++++++---- examples/wifi/getting_started/softAP/sdkconfig.ci | 2 ++ examples/wifi/getting_started/station/sdkconfig.ci | 2 ++ pytest.ini | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 examples/wifi/getting_started/softAP/sdkconfig.ci create mode 100644 examples/wifi/getting_started/station/sdkconfig.ci diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index 94c0916b45..e1a8694db5 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -199,13 +199,13 @@ example_test_pytest_esp32_flash_encryption: - build_pytest_examples_esp32 tags: [ esp32, flash_encryption ] -example_test_pytest_esp32_multi_dut_generic: +example_test_pytest_esp32_wifi_two_dut: extends: - .pytest_examples_dir_template - - .rules:test:example_test-esp32 + - .rules:test:example_test-esp32-wifi needs: - build_pytest_examples_esp32 - tags: [ esp32, multi_dut_generic ] + tags: [ esp32, wifi_two_dut ] example_test_pytest_esp32c3_flash_encryption: extends: diff --git a/examples/wifi/getting_started/pytest_wifi_getting_started.py b/examples/wifi/getting_started/pytest_wifi_getting_started.py index a85e0a9aa8..5e095d27dc 100644 --- a/examples/wifi/getting_started/pytest_wifi_getting_started.py +++ b/examples/wifi/getting_started/pytest_wifi_getting_started.py @@ -22,7 +22,7 @@ from pytest_embedded_idf.dut import IdfDut @pytest.mark.esp32 -@pytest.mark.multi_dut_generic +@pytest.mark.wifi_two_dut @pytest.mark.parametrize( 'count, app_path', [ (2, @@ -33,10 +33,12 @@ def test_wifi_getting_started(dut: Tuple[IdfDut, IdfDut]) -> None: softap = dut[0] station = dut[1] - ssid = 'myssid' - password = 'mypassword' - tag = 'wifi station' + ssid = softap.app.sdkconfig.get('ESP_WIFI_SSID') + password = softap.app.sdkconfig.get('ESP_WIFI_PASSWORD') + assert station.app.sdkconfig.get('ESP_WIFI_SSID') == ssid + assert station.app.sdkconfig.get('ESP_WIFI_PASSWORD') == password + tag = 'wifi station' station.expect(f'{tag}: got ip:', timeout=60) station.expect(f'{tag}: connected to ap SSID:{ssid} password:{password}', timeout=60) softap.expect('station .+ join, AID=', timeout=60) diff --git a/examples/wifi/getting_started/softAP/sdkconfig.ci b/examples/wifi/getting_started/softAP/sdkconfig.ci new file mode 100644 index 0000000000..b416e9f87c --- /dev/null +++ b/examples/wifi/getting_started/softAP/sdkconfig.ci @@ -0,0 +1,2 @@ +CONFIG_ESP_WIFI_SSID="ssid_${IDF_TARGET}_${CI_PIPELINE_ID}" +CONFIG_ESP_WIFI_PASSWORD="password_${IDF_TARGET}_${CI_PIPELINE_ID}" diff --git a/examples/wifi/getting_started/station/sdkconfig.ci b/examples/wifi/getting_started/station/sdkconfig.ci new file mode 100644 index 0000000000..b416e9f87c --- /dev/null +++ b/examples/wifi/getting_started/station/sdkconfig.ci @@ -0,0 +1,2 @@ +CONFIG_ESP_WIFI_SSID="ssid_${IDF_TARGET}_${CI_PIPELINE_ID}" +CONFIG_ESP_WIFI_PASSWORD="password_${IDF_TARGET}_${CI_PIPELINE_ID}" diff --git a/pytest.ini b/pytest.ini index 587da2f348..a75c5de62d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -66,7 +66,7 @@ markers = # multi-dut markers i154_multi_dut: tests should be used for i154, such as openthread. - multi_dut_generic: tests should be run on generic runners, at least have two duts connected. + wifi_two_dut: tests should be run on runners which has two wifi duts connected. generic_multi_device: generic multiple devices whose corresponding gpio pins are connected to each other. # host_test markers