summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/rebar_dialyzer_SUITE.erl34
-rw-r--r--test/rebar_dir_SUITE.erl12
-rw-r--r--test/rebar_eunit_SUITE.erl18
-rw-r--r--test/rebar_src_dirs_SUITE.erl12
4 files changed, 56 insertions, 20 deletions
diff --git a/test/rebar_dialyzer_SUITE.erl b/test/rebar_dialyzer_SUITE.erl
index 31e02d9..22a4894 100644
--- a/test/rebar_dialyzer_SUITE.erl
+++ b/test/rebar_dialyzer_SUITE.erl
@@ -69,7 +69,16 @@ update_base_plt(Config) ->
?assertEqual(ErtsFiles, BasePltFiles2),
{ok, PltFiles} = plt_files(Plt),
- ?assertEqual(ErtsFiles, PltFiles).
+ ?assertEqual(ErtsFiles, PltFiles),
+
+ add_missing_file(BasePlt),
+ ok = file:delete(Plt),
+
+ rebar_test_utils:run_and_check(Config, RebarConfig, ["dialyzer"],
+ {ok, [{app, Name}]}),
+
+ {ok, BasePltFiles3} = plt_files(BasePlt),
+ ?assertEqual(ErtsFiles, BasePltFiles3).
update_app_plt(Config) ->
@@ -103,7 +112,15 @@ update_app_plt(Config) ->
{ok, [{app, Name}]}),
{ok, PltFiles3} = plt_files(Plt),
- ?assertEqual(ErtsFiles, PltFiles3).
+ ?assertEqual(ErtsFiles, PltFiles3),
+
+ add_missing_file(Plt),
+
+ rebar_test_utils:run_and_check(Config, RebarConfig, ["dialyzer"],
+ {ok, [{app, Name}]}),
+
+ {ok, PltFiles4} = plt_files(Plt),
+ ?assertEqual(ErtsFiles, PltFiles4).
build_release_plt(Config) ->
AppDir = ?config(apps, Config),
@@ -211,6 +228,19 @@ alter_plt(Plt) ->
{files, [code:which(dialyzer)]}]),
ok.
+add_missing_file(Plt) ->
+ Source = code:which(dialyzer),
+ Dest = filename:join(filename:dirname(Plt), "dialyzer.beam"),
+ {ok, _} = file:copy(Source, Dest),
+ _ = try
+ dialyzer:run([{analysis_type, plt_add},
+ {init_plt, Plt},
+ {files, [Dest]}])
+ after
+ ok = file:delete(Dest)
+ end,
+ ok.
+
-spec merge_config(Config, Config) -> Config when
Config :: [{term(), term()}].
merge_config(NewConfig, OldConfig) ->
diff --git a/test/rebar_dir_SUITE.erl b/test/rebar_dir_SUITE.erl
index a9e44db..526f827 100644
--- a/test/rebar_dir_SUITE.erl
+++ b/test/rebar_dir_SUITE.erl
@@ -55,19 +55,19 @@ src_dirs(Config) ->
RebarConfig = [{erl_opts, [{src_dirs, ["foo", "bar", "baz"]}]}],
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
- ["foo", "bar", "baz"] = rebar_dir:src_dirs(rebar_state:opts(State)).
+ ["bar", "baz", "foo"] = rebar_dir:src_dirs(rebar_state:opts(State)).
extra_src_dirs(Config) ->
RebarConfig = [{erl_opts, [{extra_src_dirs, ["foo", "bar", "baz"]}]}],
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
- ["foo", "bar", "baz"] = rebar_dir:extra_src_dirs(rebar_state:opts(State)).
+ ["bar", "baz", "foo"] = rebar_dir:extra_src_dirs(rebar_state:opts(State)).
all_src_dirs(Config) ->
RebarConfig = [{erl_opts, [{src_dirs, ["foo", "bar"]}, {extra_src_dirs, ["baz", "qux"]}]}],
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
- ["foo", "bar", "baz", "qux"] = rebar_dir:all_src_dirs(rebar_state:opts(State)).
+ ["bar", "baz", "foo", "qux"] = rebar_dir:all_src_dirs(rebar_state:opts(State)).
profile_src_dirs(Config) ->
RebarConfig = [
@@ -79,7 +79,7 @@ profile_src_dirs(Config) ->
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["as", "more", "compile"], return),
R = lists:sort(["foo", "bar", "baz", "qux"]),
- R = lists:sort(rebar_dir:src_dirs(rebar_state:opts(State))).
+ R = rebar_dir:src_dirs(rebar_state:opts(State)).
profile_extra_src_dirs(Config) ->
RebarConfig = [
@@ -91,7 +91,7 @@ profile_extra_src_dirs(Config) ->
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["as", "more", "compile"], return),
R = lists:sort(["foo", "bar", "baz", "qux"]),
- R = lists:sort(rebar_dir:extra_src_dirs(rebar_state:opts(State))).
+ R = rebar_dir:extra_src_dirs(rebar_state:opts(State)).
profile_all_src_dirs(Config) ->
RebarConfig = [
@@ -103,7 +103,7 @@ profile_all_src_dirs(Config) ->
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["as", "more", "compile"], return),
R = lists:sort(["foo", "bar", "baz", "qux"]),
- R = lists:sort(rebar_dir:all_src_dirs(rebar_state:opts(State))).
+ R = rebar_dir:all_src_dirs(rebar_state:opts(State)).
retarget_path(Config) ->
{ok, State} = rebar_test_utils:run_and_check(Config, [], ["compile"], return),
diff --git a/test/rebar_eunit_SUITE.erl b/test/rebar_eunit_SUITE.erl
index 609be51..262eb92 100644
--- a/test/rebar_eunit_SUITE.erl
+++ b/test/rebar_eunit_SUITE.erl
@@ -268,7 +268,7 @@ missing_application_arg(Config) ->
State = rebar_state:command_parsed_args(S, Args),
Error = {error, {rebar_prv_eunit, {eunit_test_errors, ["Application `missing_app' not found in project."]}}},
- Error = rebar_prv_eunit:prepare_tests(State).
+ Error = rebar_prv_eunit:validate_tests(State, rebar_prv_eunit:prepare_tests(State)).
%% check that the --module cmd line opt generates the correct test set
single_module_arg(Config) ->
@@ -311,8 +311,11 @@ missing_module_arg(Config) ->
{ok, Args} = getopt:parse(rebar_prv_eunit:eunit_opts(S), ["--module=missing_app"]),
State = rebar_state:command_parsed_args(S, Args),
+ T = rebar_prv_eunit:prepare_tests(State),
+ Tests = rebar_prv_eunit:validate_tests(S, T),
+
Error = {error, {rebar_prv_eunit, {eunit_test_errors, ["Module `missing_app' not found in project."]}}},
- Error = rebar_prv_eunit:prepare_tests(State).
+ Error = Tests.
%% check that the --suite cmd line opt generates the correct test set
single_suite_arg(Config) ->
@@ -356,7 +359,7 @@ missing_suite_arg(Config) ->
State = rebar_state:command_parsed_args(S, Args),
Error = {error, {rebar_prv_eunit, {eunit_test_errors, ["Module `missing_app' not found in project."]}}},
- Error = rebar_prv_eunit:prepare_tests(State).
+ Error = rebar_prv_eunit:validate_tests(State, rebar_prv_eunit:prepare_tests(State)).
%% check that the --file cmd line opt generates the correct test set
single_file_arg(Config) ->
@@ -390,7 +393,7 @@ missing_file_arg(Config) ->
State = rebar_state:command_parsed_args(S, Args),
Error = {error, {rebar_prv_eunit, {eunit_test_errors, ["File `" ++ Path ++"' not found."]}}},
- Error = rebar_prv_eunit:prepare_tests(State).
+ Error = rebar_prv_eunit:validate_tests(State, rebar_prv_eunit:prepare_tests(State)).
%% check that the --dir cmd line opt generates the correct test set
single_dir_arg(Config) ->
@@ -424,7 +427,7 @@ missing_dir_arg(Config) ->
State = rebar_state:command_parsed_args(S, Args),
Error = {error, {rebar_prv_eunit, {eunit_test_errors, ["Directory `" ++ Path ++"' not found."]}}},
- Error = rebar_prv_eunit:prepare_tests(State).
+ Error = rebar_prv_eunit:validate_tests(State, rebar_prv_eunit:prepare_tests(State)).
%% check that multiple args are composed
multiple_arg_composition(Config) ->
@@ -470,11 +473,14 @@ multiple_arg_errors(Config) ->
"--dir=" ++ DirPath]),
State = rebar_state:command_parsed_args(S, Args),
+ T = rebar_prv_eunit:prepare_tests(State),
+ Tests = rebar_prv_eunit:validate_tests(S, T),
+
Expect = ["Application `missing_app' not found in project.",
"Directory `" ++ DirPath ++ "' not found.",
"File `" ++ FilePath ++ "' not found.",
"Module `missing_app' not found in project.",
"Module `missing_app' not found in project."],
- {error, {rebar_prv_eunit, {eunit_test_errors, Expect}}} = rebar_prv_eunit:prepare_tests(State).
+ {error, {rebar_prv_eunit, {eunit_test_errors, Expect}}} = Tests.
diff --git a/test/rebar_src_dirs_SUITE.erl b/test/rebar_src_dirs_SUITE.erl
index 5a00515..f854a94 100644
--- a/test/rebar_src_dirs_SUITE.erl
+++ b/test/rebar_src_dirs_SUITE.erl
@@ -49,7 +49,7 @@ src_dirs_at_root(Config) ->
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
- ["foo", "bar", "baz"] = rebar_dir:src_dirs(rebar_state:opts(State), []).
+ ["bar", "baz", "foo"] = rebar_dir:src_dirs(rebar_state:opts(State), []).
extra_src_dirs_at_root(Config) ->
AppDir = ?config(apps, Config),
@@ -62,7 +62,7 @@ extra_src_dirs_at_root(Config) ->
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
- ["foo", "bar", "baz"] = rebar_dir:extra_src_dirs(rebar_state:opts(State), []).
+ ["bar", "baz", "foo"] = rebar_dir:extra_src_dirs(rebar_state:opts(State), []).
src_dirs_in_erl_opts(Config) ->
AppDir = ?config(apps, Config),
@@ -75,7 +75,7 @@ src_dirs_in_erl_opts(Config) ->
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
- ["foo", "bar", "baz"] = rebar_dir:src_dirs(rebar_state:opts(State), []).
+ ["bar", "baz", "foo"] = rebar_dir:src_dirs(rebar_state:opts(State), []).
extra_src_dirs_in_erl_opts(Config) ->
AppDir = ?config(apps, Config),
@@ -88,7 +88,7 @@ extra_src_dirs_in_erl_opts(Config) ->
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
- ["foo", "bar", "baz"] = rebar_dir:extra_src_dirs(rebar_state:opts(State), []).
+ ["bar", "baz", "foo"] = rebar_dir:extra_src_dirs(rebar_state:opts(State), []).
src_dirs_at_root_and_in_erl_opts(Config) ->
AppDir = ?config(apps, Config),
@@ -101,7 +101,7 @@ src_dirs_at_root_and_in_erl_opts(Config) ->
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
- ["baz", "qux", "foo", "bar"] = rebar_dir:src_dirs(rebar_state:opts(State), []).
+ ["bar", "baz", "foo", "qux"] = rebar_dir:src_dirs(rebar_state:opts(State), []).
extra_src_dirs_at_root_and_in_erl_opts(Config) ->
AppDir = ?config(apps, Config),
@@ -114,7 +114,7 @@ extra_src_dirs_at_root_and_in_erl_opts(Config) ->
{ok, State} = rebar_test_utils:run_and_check(Config, RebarConfig, ["compile"], return),
- ["baz", "qux", "foo", "bar"] = rebar_dir:extra_src_dirs(rebar_state:opts(State), []).
+ ["bar", "baz", "foo", "qux"] = rebar_dir:extra_src_dirs(rebar_state:opts(State), []).
build_basic_app(Config) ->
AppDir = ?config(apps, Config),