From: Anurag Kar Date: Wed, 3 Apr 2019 13:31:40 +0000 (+0530) Subject: esp_http_server : Test added to check limit on max_open_sockets config option X-Git-Tag: v3.3-beta3~16^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8bd09fb0a52df5bc477977d530087c464e7310a2;p=esp-idf esp_http_server : Test added to check limit on max_open_sockets config option --- diff --git a/components/esp_http_server/test/test_http_server.c b/components/esp_http_server/test/test_http_server.c index 682a54d039..186df6c9bc 100644 --- a/components/esp_http_server/test/test_http_server.c +++ b/components/esp_http_server/test/test_http_server.c @@ -232,3 +232,22 @@ TEST_CASE("URI Wildcard Matcher Tests", "[HTTP SERVER]") ut++; } } + +TEST_CASE("Max Allowed Sockets Test", "[HTTP SERVER]") +{ + test_case_uses_tcpip(); + + httpd_handle_t hd; + httpd_config_t config = HTTPD_DEFAULT_CONFIG(); + + /* Starting server with default config options should pass */ + TEST_ASSERT(httpd_start(&hd, &config) == ESP_OK); + TEST_ASSERT(httpd_stop(hd) == ESP_OK); + + /* Default value of max_open_sockets is already set as per + * maximum limit imposed by LWIP. Increasing this beyond the + * maximum allowed value, without increasing LWIP limit, + * should fail */ + config.max_open_sockets += 1; + TEST_ASSERT(httpd_start(&hd, &config) != ESP_OK); +}