Add test for Linux in pytest_esp_http_client.py

This commit is contained in:
Harshit Malpani 2023-02-17 11:39:54 +05:30
parent af686f2eed
commit ae403c6210
No known key found for this signature in database
GPG Key ID: FF1193D150EF75C3
5 changed files with 47 additions and 5 deletions

View File

@ -12,10 +12,12 @@ examples/protocols/coap_server:
- if: IDF_TARGET in ["esp32h2"] - if: IDF_TARGET in ["esp32h2"]
examples/protocols/esp_http_client: examples/protocols/esp_http_client:
enable:
- if: INCLUDE_DEFAULT == 1 or IDF_TARGET == "linux"
disable: disable:
- if: IDF_TARGET in ["esp32h2"] - if: IDF_TARGET in ["esp32h2"]
disable_test: disable_test:
- if: IDF_TARGET != "esp32" - if: IDF_TARGET not in ["esp32", "linux"]
temporary: true temporary: true
reason: only test on esp32 reason: only test on esp32

View File

@ -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 # ESP HTTP Client Example
See the README.md file in the upper level 'examples' directory for more information about examples. See the README.md file in the upper level 'examples' directory for more information about examples.

View File

@ -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(r'HTTP Status = 206, content_length = 10') dut.expect(r'HTTP Status = 206, content_length = 10')
dut.expect('Finish http example') 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')

View File

@ -29,7 +29,7 @@ esp_err_t nvs_flash_erase(void)
return ESP_OK; return ESP_OK;
} }
int main() int main(void)
{ {
app_main(); app_main();