summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Smith <dizzyd@dizzyd.com>2013-06-25 15:59:19 -0600
committerDave Smith <dizzyd@dizzyd.com>2013-06-25 15:59:19 -0600
commit9cf7cf7cb06e0f2546b3cd37be0a9f8566312fc4 (patch)
tree9005035e0785a603f87cecc0b443c3a6e962d8c6
parent490d00f0d6c5be2e513829185e011aa46a696037 (diff)
Use ct_run if available; fixes strange issues with getting erl/ct to stop
-rw-r--r--src/rebar_ct.erl31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl
index 66b9d76..cdcbeb6 100644
--- a/src/rebar_ct.erl
+++ b/src/rebar_ct.erl
@@ -192,6 +192,15 @@ make_cmd(TestDir, RawLogDir, Config) ->
""
end,
+ %% Check for the availability of ct_run; if we can't find it, generate a
+ %% warning and use the old school, less reliable approach to running CT.
+ BaseCmd = case os:find_executable("ct_run") of
+ false ->
+ "erl -noshell -s ct_run script_start -s erlang halt";
+ _ ->
+ "ct_run"
+ end,
+
%% Add the code path of the rebar process to the code path. This
%% includes the dependencies in the code path. The directories
%% that are part of the root Erlang install are filtered out to
@@ -203,14 +212,15 @@ make_cmd(TestDir, RawLogDir, Config) ->
CodePathString = string:join(CodeDirs, " "),
Cmd = case get_ct_specs(Cwd) of
undefined ->
- ?FMT("erl " % should we expand ERL_PATH?
- " -noshell -pa ~s ~s"
+ ?FMT("~s"
+ " -pa ~s"
+ " ~s"
" ~s"
" -logdir \"~s\""
" -env TEST_DIR \"~s\""
- " ~s"
- " -s ct_run script_start -s erlang halt",
- [CodePathString,
+ " ~s",
+ [BaseCmd,
+ CodePathString,
Include,
build_name(Config),
LogDir,
@@ -222,14 +232,15 @@ make_cmd(TestDir, RawLogDir, Config) ->
get_suites(Config, TestDir) ++
get_case(Config);
SpecFlags ->
- ?FMT("erl " % should we expand ERL_PATH?
- " -noshell -pa ~s ~s"
+ ?FMT("~s"
+ " -pa ~s"
+ " ~s"
" ~s"
" -logdir \"~s\""
" -env TEST_DIR \"~s\""
- " ~s"
- " -s ct_run script_start -s erlang halt",
- [CodePathString,
+ " ~s",
+ [BaseCmd,
+ CodePathString,
Include,
build_name(Config),
LogDir,