0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

examples_SUITE: Query system to find GNU Make executable

... instead of hard-coding "make".

First, we check the value of `$MAKE`. If it's unset, we look for `gmake`
in the `$PATH`. If it's missing, we assume it's `make`.

This fixes the testsuite where GNU Make is installed as `gmake`.
This commit is contained in:
Jean-Sébastien Pédron 2017-01-17 14:26:24 +01:00 committed by Loïc Hoguin
parent 2166733628
commit d8d7838a77
No known key found for this signature in database
GPG key ID: 71366FF21851DF03

View file

@ -35,6 +35,19 @@ init_per_suite(Config) ->
end_per_suite(_) -> end_per_suite(_) ->
ok. ok.
%% Find GNU Make.
do_find_make_cmd() ->
case os:getenv("MAKE") of
false ->
case os:find_executable("gmake") of
false -> "make";
Cmd -> Cmd
end;
Cmd ->
Cmd
end.
%% Compile, start and stop releases. %% Compile, start and stop releases.
do_get_paths(Example0) -> do_get_paths(Example0) ->
@ -46,9 +59,10 @@ do_get_paths(Example0) ->
{Dir, Rel, Log}. {Dir, Rel, Log}.
do_compile_and_start(Example) -> do_compile_and_start(Example) ->
Make = do_find_make_cmd(),
{Dir, Rel, _} = do_get_paths(Example), {Dir, Rel, _} = do_get_paths(Example),
%% TERM=dumb disables relx coloring. %% TERM=dumb disables relx coloring.
ct:log("~s~n", [os:cmd("cd " ++ Dir ++ " && make distclean && make all TERM=dumb")]), ct:log("~s~n", [os:cmd("cd " ++ Dir ++ " && " ++ Make ++ " distclean && " ++ Make ++ " all TERM=dumb")]),
ct:log("~s~n", [os:cmd(Rel ++ " stop")]), ct:log("~s~n", [os:cmd(Rel ++ " stop")]),
ct:log("~s~n", [os:cmd(Rel ++ " start")]), ct:log("~s~n", [os:cmd(Rel ++ " start")]),
timer:sleep(2000), timer:sleep(2000),