diff --git a/examples/protocols/.build-test-rules.yml b/examples/protocols/.build-test-rules.yml index c64d4da25d..883a88cd09 100644 --- a/examples/protocols/.build-test-rules.yml +++ b/examples/protocols/.build-test-rules.yml @@ -12,10 +12,12 @@ examples/protocols/coap_server: - if: IDF_TARGET in ["esp32h2"] examples/protocols/esp_http_client: + enable: + - if: INCLUDE_DEFAULT == 1 or IDF_TARGET == "linux" disable: - if: IDF_TARGET in ["esp32h2"] disable_test: - - if: IDF_TARGET != "esp32" + - if: IDF_TARGET not in ["esp32", "linux"] temporary: true reason: only test on esp32 diff --git a/examples/protocols/esp_http_client/README.md b/examples/protocols/esp_http_client/README.md index e4d347def2..220426fdd3 100644 --- a/examples/protocols/esp_http_client/README.md +++ b/examples/protocols/esp_http_client/README.md @@ -1,6 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | - +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | Linux | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | ----- | # ESP HTTP Client Example See the README.md file in the upper level 'examples' directory for more information about examples. diff --git a/examples/protocols/esp_http_client/pytest_esp_http_client.py b/examples/protocols/esp_http_client/pytest_esp_http_client.py index ec6d01444f..1fc58d016f 100644 --- a/examples/protocols/esp_http_client/pytest_esp_http_client.py +++ b/examples/protocols/esp_http_client/pytest_esp_http_client.py @@ -98,3 +98,44 @@ def test_examples_protocol_esp_http_client_dynamic_buffer(dut: Dut) -> None: dut.expect(r'HTTP Status = 206, content_length = 10') dut.expect(r'HTTP Status = 206, content_length = 10') dut.expect('Finish http example') + + +@pytest.mark.linux +@pytest.mark.host_test +@pytest.mark.parametrize('config', [ + 'default', 'ssldyn', +], indirect=True) +def test_examples_protocol_esp_http_client_linux(dut: Dut) -> None: + # start test + dut.expect('Connected to AP, begin http example', timeout=120) + dut.expect(r'HTTP GET Status = 200, content_length = (\d)') + dut.expect(r'HTTP POST Status = 200, content_length = (\d)') + dut.expect(r'HTTP PUT Status = 200, content_length = (\d)') + dut.expect(r'HTTP PATCH Status = 200, content_length = (\d)') + dut.expect(r'HTTP DELETE Status = 200, content_length = (\d)') + dut.expect(r'HTTP HEAD Status = 200, content_length = (\d)') + dut.expect(r'HTTP GET Status = 200, content_length = (\d)') + dut.expect(r'HTTP POST Status = 200, content_length = (\d)') + dut.expect(r'HTTP PUT Status = 200, content_length = (\d)') + dut.expect(r'HTTP PATCH Status = 200, content_length = (\d)') + dut.expect(r'HTTP DELETE Status = 200, content_length = (\d)') + dut.expect(r'HTTP HEAD Status = 200, content_length = (\d)') + dut.expect(r'HTTP Basic Auth Status = 200, content_length = (\d)') + dut.expect(r'HTTP Basic Auth redirect Status = 200, content_length = (\d)') + dut.expect(r'HTTP Relative path redirect Status = 200, content_length = (\d)') + dut.expect(r'HTTP Absolute path redirect Status = 200, content_length = (\d)') + dut.expect(r'HTTP Absolute path redirect \(manual\) Status = 200, content_length = (\d)') + dut.expect(r'HTTPS Status = 200, content_length = (\d)') + dut.expect(r'HTTPS Status = 200, content_length = (\d)') + dut.expect(r'HTTP redirect to HTTPS Status = 200, content_length = (\d)') + dut.expect(r'HTTP chunk encoding Status = 200, content_length = (-?\d)') + # content-len for chunked encoding is typically -1, could be a positive length in some cases + dut.expect(r'HTTP Stream reader Status = 200, content_length = (\d)') + dut.expect(r'HTTPS Status = 200, content_length = (\d)') + dut.expect(r'Last esp error code: 0x8001') + dut.expect(r'HTTP GET Status = 200, content_length = (\d)') + dut.expect(r'HTTP POST Status = 200, content_length = (\d)') + dut.expect(r'HTTP Status = 206, content_length = (\d)') + dut.expect(r'HTTP Status = 206, content_length = 10') + dut.expect(r'HTTP Status = 206, content_length = 10') + dut.expect('Finish http example') diff --git a/examples/protocols/esp_http_client/sdkconfig.defaults b/examples/protocols/esp_http_client/sdkconfig.defaults new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/protocols/linux_stubs/esp_stubs/esp_stubs.c b/examples/protocols/linux_stubs/esp_stubs/esp_stubs.c index b0edaecd2b..53116fcecf 100644 --- a/examples/protocols/linux_stubs/esp_stubs/esp_stubs.c +++ b/examples/protocols/linux_stubs/esp_stubs/esp_stubs.c @@ -29,7 +29,7 @@ esp_err_t nvs_flash_erase(void) return ESP_OK; } -int main() +int main(void) { app_main();