Explorar el Código

Add release-structured compiling tests

pull/74/head
Fred Hebert hace 10 años
padre
commit
c3a2725fc7
Se han modificado 2 ficheros con 26 adiciones y 5 borrados
  1. +17
    -2
      test/rebar_compile_SUITE.erl
  2. +9
    -3
      test/rebar_test_utils.erl

+ 17
- 2
test/rebar_compile_SUITE.erl Ver fichero

@ -5,7 +5,8 @@
end_per_suite/1,
init_per_testcase/2,
all/0,
build_basic_app/1]).
build_basic_app/1,
build_release_apps/1]).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
@ -24,7 +25,7 @@ init_per_testcase(_, Config) ->
rebar_test_utils:init_rebar_state(Config).
all() ->
[build_basic_app].
[build_basic_app, build_release_apps].
build_basic_app(Config) ->
AppDir = ?config(apps, Config),
@ -35,3 +36,17 @@ build_basic_app(Config) ->
rebar_test_utils:run_and_check(Config, [], ["compile"], {ok, [{app, Name}]}).
build_release_apps(Config) ->
AppDir = ?config(apps, Config),
Name1 = rebar_test_utils:create_random_name("app1_"),
Vsn1 = rebar_test_utils:create_random_vsn(),
rebar_test_utils:create_app(filename:join([AppDir,Name1]), Name1, Vsn1, [kernel, stdlib]),
Name2 = rebar_test_utils:create_random_name("app2_"),
Vsn2 = rebar_test_utils:create_random_vsn(),
rebar_test_utils:create_app(filename:join([AppDir,Name2]), Name2, Vsn2, [kernel, stdlib]),
rebar_test_utils:run_and_check(
Config, [], ["compile"],
{ok, [{app, Name1}, {app, Name2}]}
).

+ 9
- 3
test/rebar_test_utils.erl Ver fichero

@ -97,13 +97,19 @@ create_random_vsn() ->
%%%%%%%%%%%%%%%
check_results(AppDir, Expected) ->
BuildDir = filename:join([AppDir, "_build", "lib"]),
Apps = rebar_app_discover:find_apps([AppDir]),
AppsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- Apps],
Deps = rebar_app_discover:find_apps([BuildDir], all),
DepsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- Deps],
lists:foreach(
fun({app, Name}) ->
[App] = rebar_app_discover:find_apps([AppDir]),
ct:pal("Name: ~p", [Name]),
?assertEqual(Name, ec_cnv:to_list(rebar_app_info:name(App)))
case lists:keyfind(Name, 1, AppsNames) of
false ->
error({app_not_found, Name});
{Name, _App} ->
ok
end
; ({dep, Name}) ->
ct:pal("Name: ~p", [Name]),
?assertNotEqual(false, lists:keyfind(Name, 1, DepsNames))
@ -111,7 +117,7 @@ check_results(AppDir, Expected) ->
ct:pal("Name: ~p, Vsn: ~p", [Name, Vsn]),
case lists:keyfind(Name, 1, DepsNames) of
false ->
error({app_not_found, Name});
error({dep_not_found, Name});
{Name, App} ->
?assertEqual(iolist_to_binary(Vsn),
iolist_to_binary(rebar_app_info:original_vsn(App)))

Cargando…
Cancelar
Guardar