1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-12-23 15:42:08 +03:00

Set a minumum test timeout for all unit tests

See #94 (https://github.com/civetweb/civetweb/issues/94#issuecomment-131843701)
This commit is contained in:
bel2125
2015-08-17 19:05:24 +02:00
parent c1832493a4
commit 30afbf03f7
4 changed files with 18 additions and 2 deletions

View File

@@ -40,4 +40,7 @@
#pragma clang diagnostic pop
#endif
/* A minimal timeout used for all tests with the "check" framework. */
#define civetweb_min_test_timeout (10)
#endif /* TEST_CIVETWEB_CHECK_H_ */

View File

@@ -471,11 +471,13 @@ Suite *make_private_suite(void)
tcase_add_test(http_message, test_parse_http_message);
tcase_add_test(http_message, test_should_keep_alive);
tcase_set_timeout(http_message, civetweb_min_test_timeout);
suite_add_tcase(suite, http_message);
tcase_add_test(url_parsing, test_match_prefix);
tcase_add_test(url_parsing, test_remove_double_dots_and_double_slashes);
tcase_add_test(url_parsing, test_is_valid_uri);
tcase_set_timeout(url_parsing, civetweb_min_test_timeout);
suite_add_tcase(suite, url_parsing);
tcase_add_test(internal_parse, test_next_option);
@@ -483,9 +485,11 @@ Suite *make_private_suite(void)
tcase_add_test(internal_parse, test_mg_strcasestr);
tcase_add_test(internal_parse, test_alloc_vprintf);
tcase_add_test(internal_parse, test_parse_port_string);
tcase_set_timeout(internal_parse, civetweb_min_test_timeout);
suite_add_tcase(suite, internal_parse);
tcase_add_test(encode_decode, test_encode_decode);
tcase_set_timeout(encode_decode, civetweb_min_test_timeout);
suite_add_tcase(suite, encode_decode);
return suite;

View File

@@ -438,26 +438,33 @@ Suite *make_public_func_suite(void)
TCase *const md5 = tcase_create("MD5");
tcase_add_test(version, test_mg_version);
tcase_set_timeout(version, civetweb_min_test_timeout);
suite_add_tcase(suite, version);
tcase_add_test(get_valid_options, test_mg_get_valid_options);
tcase_set_timeout(get_valid_options, civetweb_min_test_timeout);
suite_add_tcase(suite, get_valid_options);
tcase_add_test(get_builtin_mime_type, test_mg_get_builtin_mime_type);
tcase_set_timeout(get_builtin_mime_type, civetweb_min_test_timeout);
suite_add_tcase(suite, get_builtin_mime_type);
tcase_add_test(tstrncasecmp, test_mg_strncasecmp);
tcase_set_timeout(tstrncasecmp, civetweb_min_test_timeout);
suite_add_tcase(suite, tstrncasecmp);
tcase_add_test(urlencodingdecoding, test_mg_url_encode);
tcase_add_test(urlencodingdecoding, test_mg_url_decode);
tcase_set_timeout(urlencodingdecoding, civetweb_min_test_timeout);
suite_add_tcase(suite, urlencodingdecoding);
tcase_add_test(cookies, test_mg_get_cookie);
tcase_add_test(cookies, test_mg_get_var);
tcase_set_timeout(cookies, civetweb_min_test_timeout);
suite_add_tcase(suite, cookies);
tcase_add_test(md5, test_mg_md5);
tcase_set_timeout(md5, civetweb_min_test_timeout);
suite_add_tcase(suite, md5);
return suite;

View File

@@ -1114,17 +1114,19 @@ Suite *make_public_server_suite(void)
tcase_add_test(checktestenv, test_the_test_environment);
tcase_set_timeout(checktestenv, civetweb_min_test_timeout);
suite_add_tcase(suite, checktestenv);
tcase_add_test(startthreads, test_threading);
tcase_set_timeout(startthreads, civetweb_min_test_timeout);
suite_add_tcase(suite, startthreads);
tcase_add_test(startstophttp, test_mg_start_stop_http_server);
tcase_set_timeout(startstophttp, 10);
tcase_set_timeout(startstophttp, civetweb_min_test_timeout);
suite_add_tcase(suite, startstophttp);
tcase_add_test(startstophttps, test_mg_start_stop_https_server);
tcase_set_timeout(startstophttps, 10);
tcase_set_timeout(startstophttps, civetweb_min_test_timeout);
suite_add_tcase(suite, startstophttps);
tcase_add_test(serverrequests, test_request_handlers);