diff options
author | Jean-Sébastien Pédron <[email protected]> | 2017-01-17 14:26:24 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-01-24 11:40:52 +0100 |
commit | d8d7838a77cdb5c83e1994452122b5891db599cb (patch) | |
tree | b827f722860c9e73a4954730beacb6f6380740ec | |
parent | 2166733628bbab0eb77eeed58bdf204727c48ec6 (diff) | |
download | cowboy-d8d7838a77cdb5c83e1994452122b5891db599cb.tar.gz cowboy-d8d7838a77cdb5c83e1994452122b5891db599cb.tar.bz2 cowboy-d8d7838a77cdb5c83e1994452122b5891db599cb.zip |
examples_SUITE: Query system to find GNU Make executable2.0.0-pre.6
... 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`.
-rw-r--r-- | test/examples_SUITE.erl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/examples_SUITE.erl b/test/examples_SUITE.erl index afeb78b..6ef5471 100644 --- a/test/examples_SUITE.erl +++ b/test/examples_SUITE.erl @@ -35,6 +35,19 @@ init_per_suite(Config) -> end_per_suite(_) -> 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. do_get_paths(Example0) -> @@ -46,9 +59,10 @@ do_get_paths(Example0) -> {Dir, Rel, Log}. do_compile_and_start(Example) -> + Make = do_find_make_cmd(), {Dir, Rel, _} = do_get_paths(Example), %% 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 ++ " start")]), timer:sleep(2000), |