25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.9 KiB

  1. -module(rebar_release_SUITE).
  2. -compile(export_all).
  3. -include_lib("common_test/include/ct.hrl").
  4. -include_lib("eunit/include/eunit.hrl").
  5. all() -> [release, tar].
  6. init_per_testcase(Case, Config0) ->
  7. Config = rebar_test_utils:init_rebar_state(Config0),
  8. Name = rebar_test_utils:create_random_name(atom_to_list(Case)),
  9. AppDir = ?config(apps, Config),
  10. application:load(rebar),
  11. ok = ec_file:mkdir_p(AppDir),
  12. State = rebar_state:new([{base_dir, filename:join([AppDir, "_build"])}]),
  13. rebar_test_utils:create_app(AppDir, Name, "1.0.0", [kernel, stdlib]),
  14. [{name, Name}, {apps, AppDir}, {state, State} | Config].
  15. end_per_testcase(_, Config) ->
  16. meck:unload(),
  17. Config.
  18. release(Config) ->
  19. AppDir = ?config(apps, Config),
  20. Name = ?config(name, Config),
  21. Vsn = "1.0.0",
  22. {ok, RebarConfig} =
  23. file:consult(rebar_test_utils:create_config(AppDir,
  24. [{relx, [{release, {list_to_atom(Name), Vsn},
  25. [list_to_atom(Name)]},
  26. {lib_dirs, [AppDir]}]}])),
  27. rebar_test_utils:run_and_check(
  28. Config, RebarConfig,
  29. ["release"],
  30. {ok, [{release, list_to_atom(Name), Vsn}]}
  31. ).
  32. tar(Config) ->
  33. AppDir = ?config(apps, Config),
  34. Name = ?config(name, Config),
  35. Vsn = "1.0.0",
  36. {ok, RebarConfig} =
  37. file:consult(rebar_test_utils:create_config(AppDir,
  38. [{relx, [{release, {list_to_atom(Name), Vsn},
  39. [list_to_atom(Name)]},
  40. {lib_dirs, [AppDir]}]}])),
  41. rebar_test_utils:run_and_check(
  42. Config, RebarConfig,
  43. ["tar"],
  44. {ok, [{release, list_to_atom(Name), Vsn}, {tar, Name, Vsn}]}
  45. ).