Skip to content

Commit 0f809ce

Browse files
committed
Skip some cases in httpd_bench_SUITE on Windows, and if wget or nginx not found
1 parent 5d9eaa9 commit 0f809ce

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

lib/inets/test/httpd_bench_SUITE.erl

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,18 @@ erl_dummy_big(Config) when is_list(Config) ->
164164
notify(Result, Config, "erl_1M_file").
165165

166166
wget_small(Config) when is_list(Config) ->
167-
{ok, Result} = run_test(wget_client, "1k_file", Config),
168-
notify(Result, Config, "wget_1k_file").
167+
ensure_non_windows_and_executable_exists("wget",
168+
fun() ->
169+
{ok, Result} = run_test(wget_client, "1k_file", Config),
170+
notify(Result, Config, "wget_1k_file")
171+
end).
169172

170173
wget_big(Config) when is_list(Config) ->
171-
{ok, Result} = run_test(wget_client, "1M_file", Config),
172-
notify(Result, Config, "wget_1M_file").
174+
ensure_non_windows_and_executable_exists("wget",
175+
fun() ->
176+
{ok, Result} = run_test(wget_client, "1M_file", Config),
177+
notify(Result, Config, "wget_1M_file")
178+
end).
173179

174180
httpc_small(Config) when is_list(Config) ->
175181
{ok, Result} = run_test(httpc_client, "1k_file", Config),
@@ -485,16 +491,23 @@ start_web_server(Group, Config) when Group == https_inets;
485491

486492
start_web_server(Group, Config) when Group == http_nginx;
487493
Group == http_nginx_keep_alive ->
488-
case os:find_executable("nginx") of
489-
false -> {skip, "nginx not found"};
490-
_ -> start_nginx("http", Config)
491-
end;
494+
ensure_non_windows_and_executable_exists("nginx",
495+
fun() -> start_nginx("http", Config) end);
492496

493497
start_web_server(Group, Config) when Group == https_nginx;
494498
Group == https_nginx_keep_alive ->
495-
case os:find_executable("nginx") of
496-
false -> {skip, "nginx not found"};
497-
_ -> start_nginx("https", cert_opts(Config) ++ Config)
499+
ensure_non_windows_and_executable_exists("nginx",
500+
fun() -> start_nginx("https", cert_opts(Config) ++ Config) end).
501+
502+
ensure_non_windows_and_executable_exists(Executable, SuccessFn) ->
503+
case os:type() of
504+
{win32, _} ->
505+
{skip, "skip: not running the benchmark on Windows"};
506+
_ ->
507+
case os:find_executable(Executable) of
508+
false -> {skip, "skip: executable not found: " ++ Executable};
509+
_Filename -> SuccessFn()
510+
end
498511
end.
499512

500513
start_inets_server(Protocol, ConfHttpd, Config) ->

0 commit comments

Comments
 (0)