summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar_erlc_compiler.erl14
-rw-r--r--src/rebar_eunit.erl2
-rw-r--r--src/rebar_qc.erl2
3 files changed, 10 insertions, 8 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index 7123395..561a2a6 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -30,7 +30,7 @@
clean/2]).
%% for internal use by only eunit and qc
--export([test_compile/1]).
+-export([test_compile/2]).
-include("rebar.hrl").
@@ -114,7 +114,7 @@ clean(_Config, _AppFile) ->
%% .erl Compilation API (externally used by only eunit and qc)
%% ===================================================================
-test_compile(Config) ->
+test_compile(Config, Cmd) ->
%% Obtain all the test modules for inclusion in the compile stage.
%% Notice: this could also be achieved with the following
%% rebar.config option: {test_compile_opts, [{src_dirs, ["test"]}]}
@@ -157,7 +157,7 @@ test_compile(Config) ->
%% Compile erlang code to ?TEST_DIR, using a tweaked config
%% with appropriate defines for eunit, and include all the test modules
%% as well.
- ok = doterl_compile(test_compile_config(Config), ?TEST_DIR, TestErls),
+ ok = doterl_compile(test_compile_config(Config, Cmd), ?TEST_DIR, TestErls),
{ok, SrcErls}.
@@ -165,19 +165,21 @@ test_compile(Config) ->
%% Internal functions
%% ===================================================================
-test_compile_config(Config) ->
+test_compile_config(Config, Cmd) ->
{Config1, TriqOpts} = triq_opts(Config),
{Config2, PropErOpts} = proper_opts(Config1),
{Config3, EqcOpts} = eqc_opts(Config2),
ErlOpts = rebar_config:get_list(Config3, erl_opts, []),
- EunitOpts = rebar_config:get_list(Config3, test_compile_opts, []),
+ OptsAtom = list_to_atom(Cmd ++ "_compile_opts"),
+ EunitOpts = rebar_config:get_list(Config3, OptsAtom, []),
Opts0 = [{d, 'TEST'}] ++
ErlOpts ++ EunitOpts ++ TriqOpts ++ PropErOpts ++ EqcOpts,
Opts = [O || O <- Opts0, O =/= no_debug_info],
Config4 = rebar_config:set(Config3, erl_opts, Opts),
- FirstErls = rebar_config:get_list(Config4, test_first_files, []),
+ FirstFilesAtom = list_to_atom(Cmd ++ "_first_files"),
+ FirstErls = rebar_config:get_list(Config4, FirstFilesAtom, []),
rebar_config:set(Config4, erl_first_files, FirstErls).
triq_opts(Config) ->
diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl
index 772c671..5e7f91c 100644
--- a/src/rebar_eunit.erl
+++ b/src/rebar_eunit.erl
@@ -68,7 +68,7 @@ eunit(Config, _AppFile) ->
CodePath = setup_code_path(),
CompileOnly = rebar_utils:get_experimental_global(Config, compile_only,
false),
- {ok, SrcErls} = rebar_erlc_compiler:test_compile(Config),
+ {ok, SrcErls} = rebar_erlc_compiler:test_compile(Config, "eunit"),
case CompileOnly of
"true" ->
true = code:set_path(CodePath),
diff --git a/src/rebar_qc.erl b/src/rebar_qc.erl
index 1800540..0920a5b 100644
--- a/src/rebar_qc.erl
+++ b/src/rebar_qc.erl
@@ -119,7 +119,7 @@ run(Config, QC, QCOpts) ->
%% Compile erlang code to ?TEST_DIR, using a tweaked config
%% with appropriate defines, and include all the test modules
%% as well.
- {ok, _SrcErls} = rebar_erlc_compiler:test_compile(Config),
+ {ok, _SrcErls} = rebar_erlc_compiler:test_compile(Config, "qc"),
case CompileOnly of
"true" ->